diff options
| author | Rapptz <[email protected]> | 2020-12-11 02:32:51 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-12-11 02:32:51 -0500 |
| commit | 52d587d286fe52e04fe4e458ed7e9dbc83af3453 (patch) | |
| tree | e83092b945649abe70cf8f369a2624c97122cdf8 /discord/channel.py | |
| parent | Export to_message_reference_dict to make PartialMessage.reply work (diff) | |
| download | discord.py-52d587d286fe52e04fe4e458ed7e9dbc83af3453.tar.xz discord.py-52d587d286fe52e04fe4e458ed7e9dbc83af3453.zip | |
Allow PartialMessage to work with DM channels as well
Diffstat (limited to 'discord/channel.py')
| -rw-r--r-- | discord/channel.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/discord/channel.py b/discord/channel.py index 00d96835..2bac8b1a 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -1096,6 +1096,28 @@ class DMChannel(discord.abc.Messageable, Hashable): base.manage_messages = False return base + def get_partial_message(self, message_id): + """Creates a :class:`PartialMessage` from the message ID. + + This is useful if you want to work with a message and only have its ID without + doing an unnecessary API call. + + .. versionadded:: 1.6 + + Parameters + ------------ + message_id: :class:`int` + The message ID to create a partial message for. + + Returns + --------- + :class:`PartialMessage` + The partial message. + """ + + from .message import PartialMessage + return PartialMessage(channel=self, id=message_id) + class GroupChannel(discord.abc.Messageable, Hashable): """Represents a Discord group channel. |