Allow PartialMessage to work with DM channels as well

This commit is contained in:
Rapptz
2020-12-11 02:32:51 -05:00
parent 186f4968d3
commit 52d587d286
2 changed files with 31 additions and 9 deletions

View File

@ -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.