Document that the cache retrieval functions require an int ID.

Closes #2285
This commit is contained in:
Rapptz
2019-07-23 04:01:14 -04:00
parent 45375364b7
commit 18fe2035ef
2 changed files with 76 additions and 12 deletions

View File

@ -658,31 +658,62 @@ class Client:
return list(self._connection._users.values())
def get_channel(self, id):
"""Optional[Union[:class:`.abc.GuildChannel`, :class:`.abc.PrivateChannel`]]: Returns a channel with the
given ID.
"""Returns a channel with the given ID.
If not found, returns ``None``.
Parameters
-----------
id: :class:`int`
The ID to search for.
Returns
--------
Optional[Union[:class:`.abc.GuildChannel`, :class:`.abc.PrivateChannel`]]
The returned channel or ``None`` if not found.
"""
return self._connection.get_channel(id)
def get_guild(self, id):
"""Optional[:class:`.Guild`]: Returns a guild with the given ID.
"""Returns a guild with the given ID.
If not found, returns ``None``.
Parameters
-----------
id: :class:`int`
The ID to search for.
Returns
--------
Optional[:class:`.Guild`]
The guild or ``None`` if not found.
"""
return self._connection._get_guild(id)
def get_user(self, id):
"""Optional[:class:`~discord.User`]: Returns a user with the given ID.
"""Returns a user with the given ID.
If not found, returns ``None``.
Parameters
-----------
id: :class:`int`
The ID to search for.
Returns
--------
Optional[:class:`~discord.User`]
The user or ``None`` if not found.
"""
return self._connection.get_user(id)
def get_emoji(self, id):
"""Optional[:class:`.Emoji`]: Returns an emoji with the given ID.
"""Returns an emoji with the given ID.
If not found, returns ``None``.
Parameters
-----------
id: :class:`int`
The ID to search for.
Returns
--------
Optional[:class:`.Emoji`]
The custom emoji or ``None`` if not found.
"""
return self._connection.get_emoji(id)