Add project files

This commit is contained in:
Nika
2025-12-29 04:26:49 +03:00
parent ace5cf9e70
commit 32e797bce7
26 changed files with 602 additions and 0 deletions
View File
View File
+28
View File
@@ -0,0 +1,28 @@
# bot/management/commands/runbot.py
from django.core.management.base import BaseCommand
from django.conf import settings
from telegram.ext import ApplicationBuilder, CommandHandler, CallbackQueryHandler
from bot.handlers import start, router
import logging
class Command(BaseCommand):
help = 'Запускает Telegram бота'
def handle(self, *args, **options):
# Логирование для отладки
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO
)
print("Starting bot...")
application = ApplicationBuilder().token(settings.TELEGRAM_TOKEN).build()
# Регистрация хендлеров
application.add_handler(CommandHandler("start", start))
# Все callback-и идут в наш роутер
application.add_handler(CallbackQueryHandler(router.handle))
application.run_polling()