main commit. bot added, admin is functional

This commit is contained in:
2024-12-06 11:29:10 +09:00
parent 6e8d1fb6e3
commit 4b35dba729
4 changed files with 57 additions and 39 deletions

View File

View File

@@ -0,0 +1,28 @@
import os
import django
from django.core.management.base import BaseCommand
from telegram.ext import Application, CommandHandler
from bot.handlers import start, list_users, list_hotels # Импорт обработчиков
# Настройка Django окружения
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'touchh.settings')
django.setup()
def main():
# Создаём приложение Telegram
application = Application.builder().token("8125171867:AAGxDcSpQxJy3_pmq3TDBWtqaAVCj7b-F5k").build()
# Регистрируем обработчики команд
application.add_handler(CommandHandler("start", start))
application.add_handler(CommandHandler("users", list_users))
application.add_handler(CommandHandler("hotels", list_hotels))
# Запускаем бота
application.run_polling()
class Command(BaseCommand):
help = "Запуск Telegram бота"
def handle(self, *args, **options):
self.stdout.write("Запуск Telegram бота...")
main()