Files
telegram/main.py
T
2024-12-21 22:21:38 +07:00

43 lines
1.1 KiB
Python

import asyncio
from aiogram import Bot, Dispatcher
from aiogram.types import BotCommand
from bot.bot import bot, storage
from bot.commands.help import router as help_router
from bot.commands.start import router as start_router
from bot.commands.user import router as user_router
async def set_commands(commands_bot: Bot):
"""
Устанавливает список команд для бота.
:param commands_bot: экземпляр бота
:return: None
"""
commands = [
BotCommand(command="start", description="Начать работу с ботом"),
BotCommand(command="help", description="Получить справку"),
]
await commands_bot.set_my_commands(commands)
async def main():
"""
Основная точка входа для запуска бота.
:return: None
"""
print("Запуск бота...")
dp = Dispatcher(storage=storage)
dp.include_router(start_router)
dp.include_router(help_router)
dp.include_router(user_router)
await set_commands(bot)
await dp.start_polling(bot)
if __name__ == "__main__":
asyncio.run(main())