Files
myfirstprogram/bot/core.py
T
2025-10-04 16:59:38 +03:00

25 lines
903 B
Python

from aiogram import Bot, Dispatcher
from config import Config
from models.state import BotState
class TelegramBot:
def __init__(self):
self.bot = Bot(token=Config.API_TOKEN)
self.dp = Dispatcher()
self.state = BotState()
def setup_handlers(self):
"""Регистрация всех обработчиков"""
from handlers import admin, schedule#, media, common
# Регистрируем обработчики из разных модулей
admin.register_handlers(self.dp, self.state, self.bot)
schedule.register_handlers(self.dp, self.state, self.bot)
#media.register_handlers(self.dp, self.state, self.bot)
#common.register_handlers(self.dp, self.state, self.bot)
async def start(self):
"""Запуск бота"""
self.setup_handlers()
await self.dp.start_polling(self.bot)