fix: await set_my_commands via post_init async hook

This commit is contained in:
2026-06-17 11:48:10 +02:00
parent f25ff56bab
commit 4f7cb86c81
+6 -5
View File
@@ -223,12 +223,13 @@ async def _refresh_kw_card(bot, chat_id: int, message_id: int, kw_id_full: str):
# ── handler registration + global commands ────────────────────────────────
def register_handlers(app: Application) -> None:
# Set the bot's command menu (shown when user types /)
app.bot.set_my_commands([
{"command": "start", "description": "Open main menu"},
{"command": "admin", "description": "Admin panel (admins only)"},
])
async def _setup_commands(application: Application) -> None:
await application.bot.set_my_commands([
{"command": "start", "description": "Open main menu"},
{"command": "admin", "description": "Admin panel (admins only)"},
])
app.post_init(_setup_commands)
app.add_handler(CommandHandler("start", start_handler))
app.add_handler(CommandHandler("admin", admin_handler))
app.add_handler(CallbackQueryHandler(callback_router))