1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Add commands list

This commit is contained in:
Steffo 2020-07-18 03:11:28 +02:00
parent 28e98cef31
commit 4948302324
Signed by: steffo
GPG key ID: 896A80F55F7C97F0

View file

@ -11,6 +11,16 @@ class HelpCommand(rc.Command):
syntax: str = "{comando}"
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
if len(args) == 0:
message = [
" Comandi disponibili:"
]
for command in sorted(list(set(self.serf.commands.values())), key=lambda c: c.name):
message.append(f"- [c]{self.interface.prefix}{command.name}[/c]")
await data.reply("\n".join(message))
else:
name: str = args[0].lstrip(self.interface.prefix)
try:
@ -19,7 +29,7 @@ class HelpCommand(rc.Command):
raise rc.InvalidInputError("Il comando richiesto non esiste.")
message = [
f"[c]{self.interface.prefix}{command.name} {command.syntax}[/c]",
f" [c]{self.interface.prefix}{command.name} {command.syntax}[/c]",
"",
f"{command.description}"
]