From 053e2f5b9aff3921fe7b5d797c55a4847b4cc7ee Mon Sep 17 00:00:00 2001 From: Rapptz Date: Sat, 16 Mar 2019 09:55:29 -0400 Subject: [PATCH] Fix documentation linking issue in Messageables and Context --- discord/abc.py | 52 ++++++++++++++++----------------- discord/ext/commands/context.py | 10 +++---- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/discord/abc.py b/discord/abc.py index 43bdfec35..2280bd60f 100644 --- a/discord/abc.py +++ b/discord/abc.py @@ -695,11 +695,11 @@ class Messageable(metaclass=abc.ABCMeta): be provided. To upload a single file, the ``file`` parameter should be used with a - single :class:`File` object. To upload multiple files, the ``files`` - parameter should be used with a :class:`list` of :class:`File` objects. + single :class:`.File` object. To upload multiple files, the ``files`` + parameter should be used with a :class:`list` of :class:`.File` objects. **Specifying both parameters will lead to an exception**. - If the ``embed`` parameter is provided, it must be of type :class:`Embed` and + If the ``embed`` parameter is provided, it must be of type :class:`.Embed` and it must be a rich embed type. Parameters @@ -708,11 +708,11 @@ class Messageable(metaclass=abc.ABCMeta): The content of the message to send. tts: bool Indicates if the message should be sent using text-to-speech. - embed: :class:`Embed` + embed: :class:`.Embed` The rich embed for the content. - file: :class:`File` + file: :class:`.File` The file to upload. - files: List[:class:`File`] + files: List[:class:`.File`] A list of files to upload. Must be a maximum of 10. nonce: int The nonce to use for sending this message. If the message was successfully sent, @@ -724,17 +724,17 @@ class Messageable(metaclass=abc.ABCMeta): Raises -------- - HTTPException + :exc:`.HTTPException` Sending the message failed. - Forbidden + :exc:`.Forbidden` You do not have the proper permissions to send the message. - InvalidArgument + :exc:`.InvalidArgument` The ``files`` list is not of the appropriate size or you specified both ``file`` and ``files``. Returns --------- - :class:`Message` + :class:`.Message` The message that was sent. """ @@ -815,27 +815,27 @@ class Messageable(metaclass=abc.ABCMeta): async def get_message(self, id): """|coro| - Retrieves a single :class:`Message` from the destination. + Retrieves a single :class:`.Message` from the destination. This can only be used by bot accounts. Parameters ------------ - id: int + id: :class:`int` The message ID to look for. Returns -------- - :class:`Message` + :class:`.Message` The message asked for. Raises -------- - NotFound + :exc:`.NotFound` The specified message was not found. - Forbidden + :exc:`.Forbidden` You do not have the permissions required to get a message. - HTTPException + :exc:`.HTTPException` Retrieving the message failed. """ @@ -846,11 +846,11 @@ class Messageable(metaclass=abc.ABCMeta): async def pins(self): """|coro| - Returns a :class:`list` of :class:`Message` that are currently pinned. + Returns a :class:`list` of :class:`.Message` that are currently pinned. Raises ------- - HTTPException + :exc:`.HTTPException` Retrieving the pinned messages failed. """ @@ -860,7 +860,7 @@ class Messageable(metaclass=abc.ABCMeta): return [state.create_message(channel=channel, data=m) for m in data] def history(self, *, limit=100, before=None, after=None, around=None, reverse=None): - """Return an :class:`AsyncIterator` that enables receiving the destination's message history. + """Return an :class:`.AsyncIterator` that enables receiving the destination's message history. You must have :attr:`~.Permissions.read_message_history` permissions to use this. @@ -868,17 +868,17 @@ class Messageable(metaclass=abc.ABCMeta): Parameters ----------- - limit: Optional[int] + limit: Optional[:class:`int`] The number of messages to retrieve. If ``None``, retrieves every message in the channel. Note, however, that this would make it a slow operation. - before: :class:`Message` or `datetime` + before: :class:`.Message` or :class:`datetime.datetime` Retrieve messages before this date or message. If a date is provided it must be a timezone-naive datetime representing UTC time. - after: :class:`Message` or `datetime` + after: :class:`.Message` or :class:`datetime.datetime` Retrieve messages after this date or message. If a date is provided it must be a timezone-naive datetime representing UTC time. - around: :class:`Message` or `datetime` + around: :class:`.Message` or :class:`datetime.datetime` Retrieve messages around this date or message. If a date is provided it must be a timezone-naive datetime representing UTC time. When using this argument, the maximum limit is 101. Note that if the limit is an @@ -891,14 +891,14 @@ class Messageable(metaclass=abc.ABCMeta): Raises ------ - Forbidden + :exc:`.Forbidden` You do not have permissions to get channel message history. - HTTPException + :exc:`.HTTPException` The request to get message history failed. Yields ------- - :class:`Message` + :class:`.Message` The message with the message data parsed. Examples diff --git a/discord/ext/commands/context.py b/discord/ext/commands/context.py index be88ae762..f7601914f 100644 --- a/discord/ext/commands/context.py +++ b/discord/ext/commands/context.py @@ -38,7 +38,7 @@ class Context(discord.abc.Messageable): Attributes ----------- - message: :class:`discord.Message` + message: :class:`.Message` The message that triggered the command being executed. bot: :class:`.Bot` The bot that contains the command being executed. @@ -204,22 +204,22 @@ class Context(discord.abc.Messageable): @discord.utils.cached_property def channel(self): - """Returns the channel associated with this context's command. Shorthand for :attr:`Message.channel`.""" + """Returns the channel associated with this context's command. Shorthand for :attr:`.Message.channel`.""" return self.message.channel @discord.utils.cached_property def author(self): - """Returns the author associated with this context's command. Shorthand for :attr:`Message.author`""" + """Returns the author associated with this context's command. Shorthand for :attr:`.Message.author`""" return self.message.author @discord.utils.cached_property def me(self): - """Similar to :attr:`Guild.me` except it may return the :class:`ClientUser` in private message contexts.""" + """Similar to :attr:`.Guild.me` except it may return the :class:`.ClientUser` in private message contexts.""" return self.guild.me if self.guild is not None else self.bot.user @property def voice_client(self): - r"""Optional[:class:`VoiceClient`]: A shortcut to :attr:`Guild.voice_client`\, if applicable.""" + r"""Optional[:class:`.VoiceClient`]: A shortcut to :attr:`.Guild.voice_client`\, if applicable.""" g = self.guild return g.voice_client if g else None