feat(argparse): show available commands as choices for disable_command option

This commit is contained in:
Pagliacii
2023-12-16 14:30:05 +08:00
parent 93fb98f7b5
commit d410f48db6
2 changed files with 12 additions and 1 deletions

View File

@ -80,3 +80,13 @@ def load_handlers(bot: TeleBot, disable_commands: list[str]) -> None:
if all_commands:
bot.set_my_commands(all_commands)
print("Setting commands done.")
def available_commands() -> list[str]:
commands = []
this_path = Path(__file__).parent
for child in this_path.iterdir():
if child.name.startswith("_"):
continue
commands.append(child.stem)
return commands