1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-30 15:04:18 +00:00
royalnet/royalpack/commands/help.py

28 lines
765 B
Python
Raw Normal View History

2020-05-13 22:11:48 +00:00
from typing import *
import royalnet
import royalnet.commands as rc
class HelpCommand(rc.Command):
name: str = "help"
description: str = "Visualizza informazioni su un comando."
syntax: str = "{comando}"
async def run(self, args: rc.CommandArgs, data: rc.CommandData) -> None:
name: str = args[0].lstrip(self.interface.prefix)
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))