INNER CODE UNIT · Python
_rebuild_commands
PleasePrompto/ductor · ductor_bot/messenger/telegram/app.py:115
def _rebuild_commands() -> None:
"""Rebuild module-level command lists from current translations."""
global _BOT_COMMANDS # noqa: PLW0603
from ductor_bot.commands import get_bot_commands, get_multiagent_sub_commands
cmd_defs = get_bot_commands()
ma_defs = get_multiagent_sub_commands()
_BOT_COMMANDS = [BotCommand(command=cmd, description=desc) for cmd, desc in cmd_defs]
_CMD_DESC.clear()
_CMD_DESC.update({**dict(cmd_defs), **dict(ma_defs)})
def _help_line(command: str) -> str:
"""Return one command line for the help panel."""
description = _CMD_DESC.get(command, "")
return f"/{command} -- {description}" if description else f"/{command}"