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:
parent
28e98cef31
commit
4948302324
1 changed files with 21 additions and 11 deletions
|
@ -11,17 +11,27 @@ class HelpCommand(rc.Command):
|
||||||
syntax: str = "{comando}"
|
syntax: str = "{comando}"
|
||||||
|
|
||||||
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
|
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
|
||||||
name: str = args[0].lstrip(self.interface.prefix)
|
if len(args) == 0:
|
||||||
|
message = [
|
||||||
|
"ℹ️ Comandi disponibili:"
|
||||||
|
]
|
||||||
|
|
||||||
try:
|
for command in sorted(list(set(self.serf.commands.values())), key=lambda c: c.name):
|
||||||
command: rc.Command = self.serf.commands[f"{self.interface.prefix}{name}"]
|
message.append(f"- [c]{self.interface.prefix}{command.name}[/c]")
|
||||||
except KeyError:
|
|
||||||
raise rc.InvalidInputError("Il comando richiesto non esiste.")
|
|
||||||
|
|
||||||
message = [
|
await data.reply("\n".join(message))
|
||||||
f"[c]{self.interface.prefix}{command.name} {command.syntax}[/c]",
|
else:
|
||||||
"",
|
name: str = args[0].lstrip(self.interface.prefix)
|
||||||
f"{command.description}"
|
|
||||||
]
|
|
||||||
|
|
||||||
await data.reply("\n".join(message))
|
try:
|
||||||
|
command: rc.Command = self.serf.commands[f"{self.interface.prefix}{name}"]
|
||||||
|
except KeyError:
|
||||||
|
raise rc.InvalidInputError("Il comando richiesto non esiste.")
|
||||||
|
|
||||||
|
message = [
|
||||||
|
f"ℹ️ [c]{self.interface.prefix}{command.name} {command.syntax}[/c]",
|
||||||
|
"",
|
||||||
|
f"{command.description}"
|
||||||
|
]
|
||||||
|
|
||||||
|
await data.reply("\n".join(message))
|
||||||
|
|
Loading…
Reference in a new issue