refactor: убрать дублирование в TextHelpCommand.send_bot_help()
Ветки if/else по cog_or_none выполняли идентичную логику. Объединены в один цикл — standalone-команды и команды из cog обрабатываются одинаково.
This commit is contained in:
parent
4f2e3ec05b
commit
0f944eafe7
9
bot.py
9
bot.py
@ -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 ""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user