1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-27 13:34:28 +00:00

Add command docs

This commit is contained in:
Steffo 2019-08-01 18:03:09 +02:00
parent 664b4ff41c
commit 51ff4e59dd

View file

@ -6,22 +6,22 @@ if typing.TYPE_CHECKING:
class Command:
"""The base class from which all commands should inherit.
"""The base class from which all commands should inherit."""
Attributes:
command_name: The name of the command. To have ``/example`` on Telegram, the name should be ``example``.
command_description: A small description of the command, to be displayed when the command is being autocompleted.
command_syntax: The syntax of the command, to be displayed when a :py:exc:`royalnet.error.InvalidInputError` is raised, in the format ``(required_arg) [optional_arg]``.
require_alchemy_tables: A set of :py:class:`royalnet.database` tables, that must exist for this command to work.
network_handlers: A list of :py:class:`royalnet.utils.NetworkHandler`s that must exist for this command to work."""
command_name: typing.Optional[str] = NotImplemented
"""The name of the command. To have ``/example`` on Telegram, the name should be ``example``. If the name is None or empty, the command won't be registered."""
command_name: str = NotImplemented
command_description: str = NotImplemented
"""A small description of the command, to be displayed when the command is being autocompleted."""
command_syntax: str = NotImplemented
"""The syntax of the command, to be displayed when a :py:exc:`royalnet.error.InvalidInputError` is raised, in the format ``(required_arg) [optional_arg]``."""
require_alchemy_tables: typing.Set = set()
"""A set of :py:class:`royalnet.database` tables, that must exist for this command to work."""
network_handlers: typing.List[typing.Type["NetworkHandler"]] = {}
network_handlers: typing.List[typing.Type["NetworkHandler"]] = []
"""A set of :py:class:`royalnet.utils.NetworkHandler`s that must exist for this command to work."""
@classmethod
async def common(cls, call: "Call"):