Browse Source

Fix documentation linking issue in Messageables and Context

pull/1990/head
Rapptz 6 years ago
parent
commit
053e2f5b9a
  1. 52
      discord/abc.py
  2. 10
      discord/ext/commands/context.py

52
discord/abc.py

@ -695,11 +695,11 @@ class Messageable(metaclass=abc.ABCMeta):
be provided. be provided.
To upload a single file, the ``file`` parameter should be used with a To upload a single file, the ``file`` parameter should be used with a
single :class:`File` object. To upload multiple files, the ``files`` single :class:`.File` object. To upload multiple files, the ``files``
parameter should be used with a :class:`list` of :class:`File` objects. parameter should be used with a :class:`list` of :class:`.File` objects.
**Specifying both parameters will lead to an exception**. **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. it must be a rich embed type.
Parameters Parameters
@ -708,11 +708,11 @@ class Messageable(metaclass=abc.ABCMeta):
The content of the message to send. The content of the message to send.
tts: bool tts: bool
Indicates if the message should be sent using text-to-speech. Indicates if the message should be sent using text-to-speech.
embed: :class:`Embed` embed: :class:`.Embed`
The rich embed for the content. The rich embed for the content.
file: :class:`File` file: :class:`.File`
The file to upload. The file to upload.
files: List[:class:`File`] files: List[:class:`.File`]
A list of files to upload. Must be a maximum of 10. A list of files to upload. Must be a maximum of 10.
nonce: int nonce: int
The nonce to use for sending this message. If the message was successfully sent, The nonce to use for sending this message. If the message was successfully sent,
@ -724,17 +724,17 @@ class Messageable(metaclass=abc.ABCMeta):
Raises Raises
-------- --------
HTTPException :exc:`.HTTPException`
Sending the message failed. Sending the message failed.
Forbidden :exc:`.Forbidden`
You do not have the proper permissions to send the message. You do not have the proper permissions to send the message.
InvalidArgument :exc:`.InvalidArgument`
The ``files`` list is not of the appropriate size or The ``files`` list is not of the appropriate size or
you specified both ``file`` and ``files``. you specified both ``file`` and ``files``.
Returns Returns
--------- ---------
:class:`Message` :class:`.Message`
The message that was sent. The message that was sent.
""" """
@ -815,27 +815,27 @@ class Messageable(metaclass=abc.ABCMeta):
async def get_message(self, id): async def get_message(self, id):
"""|coro| """|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. This can only be used by bot accounts.
Parameters Parameters
------------ ------------
id: int id: :class:`int`
The message ID to look for. The message ID to look for.
Returns Returns
-------- --------
:class:`Message` :class:`.Message`
The message asked for. The message asked for.
Raises Raises
-------- --------
NotFound :exc:`.NotFound`
The specified message was not found. The specified message was not found.
Forbidden :exc:`.Forbidden`
You do not have the permissions required to get a message. You do not have the permissions required to get a message.
HTTPException :exc:`.HTTPException`
Retrieving the message failed. Retrieving the message failed.
""" """
@ -846,11 +846,11 @@ class Messageable(metaclass=abc.ABCMeta):
async def pins(self): async def pins(self):
"""|coro| """|coro|
Returns a :class:`list` of :class:`Message` that are currently pinned. Returns a :class:`list` of :class:`.Message` that are currently pinned.
Raises Raises
------- -------
HTTPException :exc:`.HTTPException`
Retrieving the pinned messages failed. 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] 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): 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. You must have :attr:`~.Permissions.read_message_history` permissions to use this.
@ -868,17 +868,17 @@ class Messageable(metaclass=abc.ABCMeta):
Parameters Parameters
----------- -----------
limit: Optional[int] limit: Optional[:class:`int`]
The number of messages to retrieve. The number of messages to retrieve.
If ``None``, retrieves every message in the channel. Note, however, If ``None``, retrieves every message in the channel. Note, however,
that this would make it a slow operation. 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. Retrieve messages before this date or message.
If a date is provided it must be a timezone-naive datetime representing UTC time. 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. Retrieve messages after this date or message.
If a date is provided it must be a timezone-naive datetime representing UTC time. 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. Retrieve messages around this date or message.
If a date is provided it must be a timezone-naive datetime representing UTC time. 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 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 Raises
------ ------
Forbidden :exc:`.Forbidden`
You do not have permissions to get channel message history. You do not have permissions to get channel message history.
HTTPException :exc:`.HTTPException`
The request to get message history failed. The request to get message history failed.
Yields Yields
------- -------
:class:`Message` :class:`.Message`
The message with the message data parsed. The message with the message data parsed.
Examples Examples

10
discord/ext/commands/context.py

@ -38,7 +38,7 @@ class Context(discord.abc.Messageable):
Attributes Attributes
----------- -----------
message: :class:`discord.Message` message: :class:`.Message`
The message that triggered the command being executed. The message that triggered the command being executed.
bot: :class:`.Bot` bot: :class:`.Bot`
The bot that contains the command being executed. The bot that contains the command being executed.
@ -204,22 +204,22 @@ class Context(discord.abc.Messageable):
@discord.utils.cached_property @discord.utils.cached_property
def channel(self): 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 return self.message.channel
@discord.utils.cached_property @discord.utils.cached_property
def author(self): 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 return self.message.author
@discord.utils.cached_property @discord.utils.cached_property
def me(self): 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 return self.guild.me if self.guild is not None else self.bot.user
@property @property
def voice_client(self): 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 g = self.guild
return g.voice_client if g else None return g.voice_client if g else None

Loading…
Cancel
Save