refactor: убрать дублирование в TextHelpCommand.send_bot_help()

Ветки if/else по cog_or_none выполняли идентичную логику.
Объединены в один цикл — standalone-команды и команды из cog
обрабатываются одинаково.
This commit is contained in:
deadzilla 2026-07-22 22:32:50 +05:00
parent 4f2e3ec05b
commit 0f944eafe7

9
bot.py
View File

@ -39,14 +39,7 @@ class TextHelpCommand(commands.HelpCommand):
) -> None:
lines: list[str] = ["Доступные команды:"]
for cog_or_none, cog_commands in mapping.items():
if cog_or_none is None:
# Standalone-команды (без cog) — показываем если не hidden
for command in cog_commands:
if not command.hidden:
desc = command.short_doc or ""
lines.append(f" !{command.name} - {desc}")
continue
for _cog_or_none, cog_commands in mapping.items():
for command in cog_commands:
if not command.hidden:
desc = command.short_doc or ""