-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
36 lines (29 loc) · 1.12 KB
/
run.py
File metadata and controls
36 lines (29 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import asyncio
import logging
from aiogram import Bot, Dispatcher
from aiogram.types import BotCommand, BotCommandScopeDefault
from app.handlers import routers
from app.utils import TOKEN
from app.database.models import async_main
bot = Bot(token=TOKEN)
dp = Dispatcher()
async def set_bot_commands(bot: Bot):
commands = [
BotCommand(command="/start", description="🚀 Запустить бота"),
BotCommand(command="/profile", description="👤 Открыть профиль"),
BotCommand(command="/feedback", description="💡 Обратная связь"),
BotCommand(command="/info", description="ℹ️ Информация о проекте"),
]
await bot.set_my_commands(commands, scope=BotCommandScopeDefault())
async def main():
await async_main()
for router in routers:
dp.include_router(router)
await set_bot_commands(bot)
await dp.start_polling(bot)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
try:
asyncio.run(main())
except KeyboardInterrupt:
print("Программа завершилась")