From 3fe6d261f181bb1d269ed917de593e428a2229b1 Mon Sep 17 00:00:00 2001 From: Rapptz Date: Fri, 11 Dec 2020 00:28:48 -0500 Subject: Add PartialMessage to allow working with channel/message_id pairs. Fix #5905 --- discord/channel.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'discord/channel.py') diff --git a/discord/channel.py b/discord/channel.py index 9343b72c..00d96835 100644 --- a/discord/channel.py +++ b/discord/channel.py @@ -517,6 +517,28 @@ class TextChannel(discord.abc.Messageable, discord.abc.GuildChannel, Hashable): data = await self._state.http.follow_webhook(self.id, webhook_channel_id=destination.id, reason=reason) return Webhook._as_follower(data, channel=destination, user=self._state.user) + 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 VoiceChannel(discord.abc.Connectable, discord.abc.GuildChannel, Hashable): """Represents a Discord guild voice channel. -- cgit v1.2.3