import logging

from vkwave.bots import SimpleLongPollBot, PhotoUploader

from blueprints import (
    menu_router, test_router, student_router, teacher_router,
)
from config import Config
from middlewares import UserMiddleware
# from nft_things.NftSender import NFTSender
from middlewares.test_state_middleware import TestStateMiddleware

logging.basicConfig(level="DEBUG")

bot = SimpleLongPollBot(Config.TOKEN, group_id=Config.GROUP_ID)

uploader = PhotoUploader(bot.api_context)
Config().api_ctx = bot.api_context
Config().uploader = uploader

bot.middleware_manager.add_middleware(UserMiddleware())
bot.middleware_manager.add_middleware(TestStateMiddleware())


bot.dispatcher.add_router(test_router)
bot.dispatcher.add_router(student_router)
bot.dispatcher.add_router(teacher_router)

# регаем последним чтобы сначала проверялись все остальные команды
bot.dispatcher.add_router(menu_router)

bot.run_forever()