diff options
| author | Rapptz <[email protected]> | 2020-12-11 00:28:48 -0500 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2020-12-11 00:32:38 -0500 |
| commit | 3fe6d261f181bb1d269ed917de593e428a2229b1 (patch) | |
| tree | ddd63d4eafa98c011811d27ca23638dc2fd3ad43 /discord/channel.py | |
| parent | Fix WebhookMessages docstrings (diff) | |
| download | discord.py-3fe6d261f181bb1d269ed917de593e428a2229b1.tar.xz discord.py-3fe6d261f181bb1d269ed917de593e428a2229b1.zip | |
Add PartialMessage to allow working with channel/message_id pairs.
Fix #5905
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 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. |