26 lines
692 B
Python
26 lines
692 B
Python
from maxapi.bot import Bot
|
|
from maxapi.context import MemoryContext
|
|
from maxapi.dispatcher import Dispatcher, Router
|
|
|
|
import config
|
|
from bot.bot_instance import set_bot
|
|
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)
|
|
set_bot(bot)
|
|
|
|
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
|