Feat: removed unnecessary bot

This commit is contained in:
2025-01-02 22:00:44 +03:00
parent 5d6310e5a4
commit e73bc6569b
3 changed files with 10 additions and 8 deletions

View File

@@ -1,4 +1,3 @@
import asyncio
import logging
from sys import exit
@@ -21,5 +20,5 @@ if __name__ == "__main__":
# Start bot
bot = NwXrayBot(config.bot_token.get_secret_value())
bot.include_routers(HelloHandler(bot), MenuHandler(bot))
bot.include_routers(HelloHandler(), MenuHandler())
uvloop.run(bot.start(skip_updates=True))

View File

@@ -6,8 +6,8 @@ from nwxraybot.models import User
class MenuHandler(Handler):
def __init__(self, bot) -> None:
super().__init__(bot)
def __init__(self) -> None:
super().__init__()
@self.router.message()
async def menu(message: types.Message) -> None:

View File

@@ -1,13 +1,16 @@
from typing import Optional
from aiogram import Bot, Router
class Handler:
bot: Bot
bot: Optional[Bot]
router: Router
def __init__(self, bot) -> None:
assert isinstance(bot.bot, Bot)
self.bot = bot.bot
def __init__(self, bot: Optional[Bot] = None) -> None:
if bot:
assert isinstance(bot.bot, Optional[Bot])
self.bot = bot.bot
self.router = Router()
def __call__(self) -> Router: