This commit is contained in:
2024-11-08 06:00:09 +03:00
parent 824e007786
commit 256443a27a
2 changed files with 9 additions and 2 deletions

7
.gitignore vendored
View File

@@ -4,5 +4,10 @@ bin/
include/ include/
lib/ lib/
lib64/ lib64/
__pycache__/
lib64 lib64
*.log *.log.*
*.log
__pycache__/
__pycache__/db.cpython-312.pyc
__pycache__/logger_config.cpython-312.pyc

4
bot.py
View File

@@ -1,5 +1,5 @@
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
from telegram.ext import Application, CallbackQueryHandler, ContextTypes, MessageHandler, filters from telegram.ext import Application, CallbackQueryHandler, ContextTypes, MessageHandler, filters,CommandHandler
from db import User, VPNServer, Transaction, Subscription, get_db_session, init_db, SessionLocal from db import User, VPNServer, Transaction, Subscription, get_db_session, init_db, SessionLocal
from sqlalchemy import desc from sqlalchemy import desc
from service import UserService from service import UserService
@@ -131,6 +131,8 @@ async def button_handler(update: Update, context):
def main() -> None: def main() -> None:
init_db() init_db()
application = Application.builder().token(config['token']).build() application = Application.builder().token(config['token']).build()
application.add_handler(CommandHandler("start", start))
application.add_handler(CallbackQueryHandler(button_handler)) application.add_handler(CallbackQueryHandler(button_handler))
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, sup)) application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, sup))