diff --git a/CHANGELOG.md b/CHANGELOG.md index ef3e6995ba..80929555d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,8 @@ These changes are available on the `master` branch, but have not yet been releas ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) - Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to `SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500)) +- Fixed `PartialMessage`s causing errors when created from `PartialMessageable`. + ([#2568](https://github.com/Pycord-Development/pycord/pull/2500)) ## [2.6.0] - 2024-07-09 diff --git a/discord/message.py b/discord/message.py index 37ffd86f53..56d1cec968 100644 --- a/discord/message.py +++ b/discord/message.py @@ -42,6 +42,7 @@ from urllib.parse import parse_qs, urlparse from . import utils +from .channel import PartialMessageable from .components import _component_factory from .embeds import Embed from .emoji import Emoji @@ -2001,6 +2002,7 @@ class PartialMessage(Hashable): - :meth:`DMChannel.get_partial_message` - :meth:`VoiceChannel.get_partial_message` - :meth:`StageChannel.get_partial_message` + - :meth:`PartialMessageable.get_partial_message` Note that this class is trimmed down and has no rich attributes. @@ -2022,7 +2024,7 @@ class PartialMessage(Hashable): Attributes ---------- - channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`VoiceChannel`, :class:`StageChannel`] + channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`VoiceChannel`, :class:`StageChannel`, :class:`PartialMessageable`] The channel associated with this partial message. id: :class:`int` The message ID. @@ -2053,9 +2055,9 @@ def __init__(self, *, channel: PartialMessageableChannel, id: int): ChannelType.news_thread, ChannelType.public_thread, ChannelType.private_thread, - ): + ) and not isinstance(channel, PartialMessageable): raise TypeError( - "Expected TextChannel, VoiceChannel, StageChannel, DMChannel or Thread not" + "Expected TextChannel, VoiceChannel, StageChannel, DMChannel, Thread or PartialMessageable not" f" {type(channel)!r}" )