mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-08 10:53:10 +00:00
Document that the cache retrieval functions require an int ID.
Closes #2285
This commit is contained in:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user