From 51ff4e59ddb56ff2eab1dd08f2b55d06a31decf0 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 1 Aug 2019 18:03:09 +0200 Subject: [PATCH] Add command docs --- royalnet/utils/command.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/royalnet/utils/command.py b/royalnet/utils/command.py index d038cdc3..7c6a9e7d 100644 --- a/royalnet/utils/command.py +++ b/royalnet/utils/command.py @@ -6,22 +6,22 @@ if typing.TYPE_CHECKING: class Command: - """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.""" + """The base class from which all commands should inherit.""" + + 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"):