Organise documentation

This commit is contained in:
NCPlayz
2019-03-16 21:43:55 +00:00
committed by Rapptz
parent 5e65ec978c
commit fb02191b80
30 changed files with 417 additions and 419 deletions

View File

@ -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

View File

@ -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)

View File

@ -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
------------

View File

@ -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):

View File

@ -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.

View File

@ -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