From 18fe2035ef33b9bbaa2f8504c787a40bdaf247fe Mon Sep 17 00:00:00 2001 From: Rapptz Date: Tue, 23 Jul 2019 04:01:14 -0400 Subject: Document that the cache retrieval functions require an int ID. Closes #2285 --- discord/client.py | 49 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 9 deletions(-) (limited to 'discord/client.py') diff --git a/discord/client.py b/discord/client.py index b4f83da2..c164fc09 100644 --- a/discord/client.py +++ b/discord/client.py @@ -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) -- cgit v1.2.3