intra_max_chatbot/bot/setup.py
2026-03-26 00:25:37 +03:00

24 lines
638 B
Python

from maxapi.bot import Bot
from maxapi.context import MemoryContext
from maxapi.dispatcher import Dispatcher, Router
import config
from bot.middleware import AuthMiddleware
from bot.handlers import start, menu, create_ticket, view_tickets
def create_bot_and_dispatcher() -> tuple[Bot, Dispatcher]:
bot = Bot(token=config.BOT_TOKEN)
dp = Dispatcher(router_id="main", storage=MemoryContext)
dp.outer_middleware(AuthMiddleware())
# Подключаем роутеры
dp.include_routers(
start.router,
menu.router,
create_ticket.router,
view_tickets.router,
)
return bot, dp