Compare commits
No commits in common. "29ceb95404c276c7d4c694b2976a8f2cac8b1771" and "31767a78ef4a7b8409bddee8a545c557481e82fd" have entirely different histories.
29ceb95404
...
31767a78ef
2
.gitignore
vendored
2
.gitignore
vendored
@ -160,5 +160,3 @@ cython_debug/
|
|||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
# Configuration file
|
|
||||||
config.ini
|
|
||||||
|
|||||||
23
db.py
23
db.py
@ -1,23 +0,0 @@
|
|||||||
import psycopg2
|
|
||||||
|
|
||||||
|
|
||||||
class PostgreSQLDatabase:
|
|
||||||
def __init__(self, host, database, user, password):
|
|
||||||
self.__host = host
|
|
||||||
self.__database = database
|
|
||||||
self.__user = user
|
|
||||||
self.__password = password
|
|
||||||
|
|
||||||
def execute_query(self, query):
|
|
||||||
connection = psycopg2.connect(
|
|
||||||
host=self.__host,
|
|
||||||
database=self.__database,
|
|
||||||
user=self.__user,
|
|
||||||
password=self.__password
|
|
||||||
)
|
|
||||||
cursor = connection.cursor()
|
|
||||||
cursor.execute(query)
|
|
||||||
result = cursor.fetchall()
|
|
||||||
cursor.close()
|
|
||||||
connection.close()
|
|
||||||
return result
|
|
||||||
45
main.py
45
main.py
@ -1,45 +0,0 @@
|
|||||||
import telebot
|
|
||||||
import configparser
|
|
||||||
|
|
||||||
|
|
||||||
config = configparser.ConfigParser()
|
|
||||||
config.read()
|
|
||||||
|
|
||||||
TG_TOKEN = config.get('telebot', 'token')
|
|
||||||
API_TOKEN = config.get('hotels_api', 'token')
|
|
||||||
DB_HOST = config.get('database', 'host')
|
|
||||||
DB_PORT = config.get('database', 'port')
|
|
||||||
DB_DATABASE = config.get('database', 'database')
|
|
||||||
DB_USER = config.get('database', 'user')
|
|
||||||
DB_PASSWORD = config.get('database', 'password')
|
|
||||||
|
|
||||||
|
|
||||||
bot = telebot.TeleBot(token=TG_TOKEN)
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=['start', 'help'])
|
|
||||||
def handle_start(message):
|
|
||||||
pass # TODO добавить логику обработки команд start и help
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=['low'])
|
|
||||||
def handle_low(message):
|
|
||||||
pass # TODO добавить логику обработки команды low
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=['high'])
|
|
||||||
def handle_high(message):
|
|
||||||
pass # TODO добавить логику обработки команды high
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=['custom'])
|
|
||||||
def handle_custom(message):
|
|
||||||
pass # TODO добавить логику обработки команды custom
|
|
||||||
|
|
||||||
|
|
||||||
@bot.message_handler(commands=['history'])
|
|
||||||
def handle_history(message):
|
|
||||||
pass # TODO добавить логику обработки команды history
|
|
||||||
|
|
||||||
|
|
||||||
bot.polling()
|
|
||||||
Loading…
x
Reference in New Issue
Block a user