From f52353fd14c1f097f3501e74523bc269d2ae7ade Mon Sep 17 00:00:00 2001 From: mihalin Date: Fri, 10 Sep 2021 23:20:06 +0300 Subject: [PATCH] commands list --- main.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index c06b3ba..27680fc 100644 --- a/main.py +++ b/main.py @@ -20,13 +20,31 @@ async def init_database(): await Tortoise.init(config=TORTOISE_ORM) +async def init_olgram(): + from olgram.router import bot + from aiogram.types import BotCommand + await bot.set_my_commands( + [ + BotCommand("start", "Запустить бота"), + BotCommand("addbot", "Добавить нового бота"), + BotCommand("mybots", "Список ботов"), + BotCommand("help", "Справка") + ] + ) + + +async def initialization(): + await init_database() + await init_redis() + await init_olgram() + + def main(): """ Classic polling """ loop = asyncio.get_event_loop() - loop.run_until_complete(init_database()) - loop.run_until_complete(init_redis()) + loop.run_until_complete(initialization()) loop.create_task(dp.start_polling()) loop.create_task(server_main().start())