added Client.get_message

This commit is contained in:
iDutchy 2021-02-11 18:38:33 -06:00
parent 86fd3fb738
commit f1309aa4a1
4 changed files with 20 additions and 2 deletions

View File

@ -280,6 +280,22 @@ class Client:
# internals
def get_message(self, id):
"""Get a message from cache if the message is still in cache.
.. versionadded:: 1.6.0.7
Parameters
-----------
id: :class:`int`
The message ID to look for.
Returns
--------
Optional[:class:`.Message`]
The message asked for."""
return utils.get(self.cached_messages, id=id)
@property
def embed_color(self):
"""Optional[:class:`.Colour`]: The default embed colour that is

View File

@ -145,7 +145,7 @@ class MemberConverter(IDConverter):
# If we're being rate limited on the WS, then fall back to using the HTTP API
# So we don't have to wait ~60 seconds for the query to finish
try:
member = await guild.fetch_member(user_id)
member = await guild.try_member(user_id)
except discord.HTTPException:
return None

View File

@ -30,4 +30,5 @@ Here are the custom features listed that have been added to enhanced-dpy. You ca
- Added :attr:`Permissions.admin` as alias to :attr:`Permissions.administrator`
- Added :attr:`CogMeta.aliases <.ext.commands.CogMeta.aliases>`
- Added :attr:`Bot.case_insensitive_prefix <.ext.commands.Bot.case_insensitive_prefix>`
- Added ``silent`` kwarg to :meth:`Message.delete`
- Added ``silent`` kwarg to :meth:`Message.delete`
- Added :meth:`Client.get_message`

View File

@ -22,6 +22,7 @@ New Features
- Add :attr:`CogMeta.aliases <.ext.commands.CogMeta.aliases>`
- Add :attr:`Bot.case_insensitive_prefix <.ext.commands.Bot.case_insensitive_prefix>`
- Add ``silent`` kwargs to :meth:`Message.delete`
- Add :meth:`Client.get_message`
.. _vp1p5p1p6: