diff options
Diffstat (limited to 'discord/ext/commands')
| -rw-r--r-- | discord/ext/commands/bot.py | 22 | ||||
| -rw-r--r-- | discord/ext/commands/cog.py | 2 | ||||
| -rw-r--r-- | discord/ext/commands/context.py | 6 | ||||
| -rw-r--r-- | discord/ext/commands/converter.py | 11 | ||||
| -rw-r--r-- | discord/ext/commands/core.py | 35 | ||||
| -rw-r--r-- | discord/ext/commands/help.py | 5 |
6 files changed, 38 insertions, 43 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py index 413d435a..157fbe21 100644 --- a/discord/ext/commands/bot.py +++ b/discord/ext/commands/bot.py @@ -208,7 +208,7 @@ class BotBase(GroupMixin): ----------- func The function that was used as a global check. - call_once: bool + call_once: :class:`bool` If the function should only be called once per :meth:`.Command.invoke` call. """ @@ -228,7 +228,7 @@ class BotBase(GroupMixin): ----------- func The function to remove from the global checks. - call_once: bool + call_once: :class:`bool` If the function was added with ``call_once=True`` in the :meth:`.Bot.add_check` call or using :meth:`.check_once`. """ @@ -370,9 +370,9 @@ class BotBase(GroupMixin): Parameters ----------- - func : :ref:`coroutine <coroutine>` + func: :ref:`coroutine <coroutine>` The function to call. - name : Optional[str] + name: Optional[:class:`str`] The name of the event to listen for. Defaults to ``func.__name__``. Example @@ -404,7 +404,7 @@ class BotBase(GroupMixin): ----------- func The function that was used as a listener to remove. - name + name: :class:`str` The name of the event we want to remove. Defaults to ``func.__name__``. """ @@ -462,7 +462,7 @@ class BotBase(GroupMixin): Parameters ----------- - cog + cog: :class:`.Cog` The cog to register to the bot. Raises @@ -486,7 +486,7 @@ class BotBase(GroupMixin): Parameters ----------- - name : str + name: :class:`str` The name of the cog you are requesting. This is equivalent to the name passed via keyword argument in class creation or the class name if unspecified. @@ -535,7 +535,7 @@ class BotBase(GroupMixin): Parameters ------------ - name: str + name: :class:`str` The extension name to load. It must be dot separated like regular Python imports if accessing a sub-module. e.g. ``foo.test`` if you want to import ``foo/test.py``. @@ -573,7 +573,7 @@ class BotBase(GroupMixin): Parameters ------------ - name: str + name: :class:`str` The extension name to unload. It must be dot separated like regular Python imports if accessing a sub-module. e.g. ``foo.test`` if you want to import ``foo/test.py``. @@ -668,7 +668,7 @@ class BotBase(GroupMixin): Returns -------- - Union[List[str], str] + Union[List[:class:`str`], :class:`str`] A list of prefixes or a single prefix that the bot is listening for. """ @@ -857,7 +857,7 @@ class Bot(BotBase, discord.Client): .. note:: When passing multiple prefixes be careful to not pass a prefix - that matches a longer prefix occuring later in the sequence. For + that matches a longer prefix occurring later in the sequence. For example, if the command prefix is ``('!', '!?')`` the ``'!?'`` prefix will never be matched to any message as the previous one matches messages starting with ``!?``. This is especially important diff --git a/discord/ext/commands/cog.py b/discord/ext/commands/cog.py index 628a7a1c..109824ed 100644 --- a/discord/ext/commands/cog.py +++ b/discord/ext/commands/cog.py @@ -174,7 +174,7 @@ class Cog(metaclass=CogMeta): # Get the latest parent reference parent = lookup[parent.qualified_name] - # Update our parent's reference to ourself + # Update our parent's reference to our self removed = parent.remove_command(command.name) parent.add_command(command) diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py index f7601914..edce974a 100644 --- a/discord/ext/commands/context.py +++ b/discord/ext/commands/context.py @@ -145,9 +145,9 @@ class Context(discord.abc.Messageable): Parameters ------------ - call_hooks: bool + call_hooks: :class:`bool` Whether to call the before and after invoke hooks. - restart: bool + restart: :class:`bool` Whether to start the call chain from the very beginning or where we left off (i.e. the command that caused the error). The default is to start where we left off. @@ -241,7 +241,7 @@ class Context(discord.abc.Messageable): Due to the way this function works, instead of returning something similar to :meth:`~.commands.HelpCommand.command_not_found` - this returns :obj:`None` on bad input or no help command. + this returns :class:`None` on bad input or no help command. Parameters ------------ diff --git a/discord/ext/commands/converter.py b/discord/ext/commands/converter.py index 32476380..9fc6cf6d 100644 --- a/discord/ext/commands/converter.py +++ b/discord/ext/commands/converter.py @@ -69,7 +69,7 @@ class Converter: ----------- ctx: :class:`.Context` The invocation context that the argument is being used in. - argument: str + argument: :class:`str` The argument that is being converted. """ raise NotImplementedError('Derived classes need to implement this.') @@ -304,7 +304,6 @@ class ColourConverter(Converter): class RoleConverter(IDConverter): """Converts to a :class:`Role`. - All lookups are via the local guild. If in a DM context, then the lookup is done by the global cache. @@ -349,7 +348,6 @@ class InviteConverter(Converter): class EmojiConverter(IDConverter): """Converts to a :class:`Emoji`. - All lookups are done for the local guild first, if available. If that lookup fails, then it checks the client's global cache. @@ -390,7 +388,6 @@ class EmojiConverter(IDConverter): class PartialEmojiConverter(Converter): """Converts to a :class:`PartialEmoji`. - This is done by extracting the animated flag, name and ID from the emoji. """ async def convert(self, ctx, argument): @@ -413,11 +410,11 @@ class clean_content(Converter): Attributes ------------ - fix_channel_mentions: :obj:`bool` + fix_channel_mentions: :class:`bool` Whether to clean channel mentions. - use_nicknames: :obj:`bool` + use_nicknames: :class:`bool` Whether to use nicknames when transforming mentions. - escape_markdown: :obj:`bool` + escape_markdown: :class:`bool` Whether to also escape special markdown characters. """ def __init__(self, *, fix_channel_mentions=False, use_nicknames=True, escape_markdown=False): diff --git a/discord/ext/commands/core.py b/discord/ext/commands/core.py index 30e110da..3f413075 100644 --- a/discord/ext/commands/core.py +++ b/discord/ext/commands/core.py @@ -651,7 +651,7 @@ class Command(_BaseCommand): Returns -------- - bool + :class:`bool` A boolean indicating if the command is on cooldown. """ if not self._buckets.valid: @@ -708,7 +708,7 @@ class Command(_BaseCommand): Parameters ----------- - coro : :ref:`coroutine <coroutine>` + coro: :ref:`coroutine <coroutine>` The coroutine to register as the local error handler. Raises @@ -736,7 +736,7 @@ class Command(_BaseCommand): Parameters ----------- - coro + coro: :ref:`coroutine <coroutine>` The coroutine to register as the pre-invoke hook. Raises @@ -763,7 +763,7 @@ class Command(_BaseCommand): Parameters ----------- - coro + coro: :ref:`coroutine <coroutine>` The coroutine to register as the post-invoke hook. Raises @@ -863,7 +863,7 @@ class Command(_BaseCommand): Returns -------- - bool + :class:`bool` A boolean indicating if the command can be invoked. """ @@ -963,7 +963,7 @@ class GroupMixin: Parameters ----------- - name: str + name: :class:`str` The name of the command to remove. Returns @@ -1006,12 +1006,12 @@ class GroupMixin: Parameters ----------- - name: str + name: :class:`str` The name of the command to get. Returns -------- - Command or subclass + :class:`Command` or subclass The command that was requested. If not found, returns ``None``. """ @@ -1170,7 +1170,7 @@ def command(name=None, cls=None, **attrs): Parameters ----------- - name: str + name: :class:`str` The name to create the command with. By default this uses the function name unchanged. cls @@ -1221,11 +1221,6 @@ def check(predicate): These functions can either be regular functions or coroutines. - Parameters - ----------- - predicate - The predicate to check if the command should be invoked. - Examples --------- @@ -1255,6 +1250,10 @@ def check(predicate): async def only_me(ctx): await ctx.send('Only you!') + Parameters + ----------- + predicate: Callable[:class:`Context`, :class:`bool`] + The predicate to check if the command should be invoked. """ def decorator(func): @@ -1283,7 +1282,7 @@ def has_role(item): Parameters ----------- - item: Union[int, str] + item: Union[:class:`int`, :class:`str`] The name or ID of the role to check. """ @@ -1308,7 +1307,7 @@ def has_any_role(*items): Parameters ----------- - items + items: List[Union[:class:`str`, :class:`int`]] An argument list of names or IDs to check that the member has roles wise. Example @@ -1482,9 +1481,9 @@ def cooldown(rate, per, type=BucketType.default): Parameters ------------ - rate: int + rate: :class:`int` The number of times a command can be used before triggering a cooldown. - per: float + per: :class:`float` The amount of seconds to wait for a cooldown when it's been triggered. type: ``BucketType`` The type of cooldown to have. diff --git a/discord/ext/commands/help.py b/discord/ext/commands/help.py index 8ad58a6a..78c16717 100644 --- a/discord/ext/commands/help.py +++ b/discord/ext/commands/help.py @@ -107,9 +107,9 @@ class Paginator: Parameters ----------- - line: str + line: :class:`str` The line to add. - empty: bool + empty: :class:`bool` Indicates if another empty line should be added. Raises @@ -725,7 +725,6 @@ class HelpCommand: - :meth:`send_error_message` - :meth:`on_help_command_error` - :meth:`prepare_help_command` - """ await self.prepare_help_command(ctx, command) bot = ctx.bot |