From 533e0367b1bbbb014a4404cf0f68b011b0601589 Mon Sep 17 00:00:00 2001 From: plun1331 Date: Tue, 3 Sep 2024 10:21:41 -0700 Subject: [PATCH 1/3] fix: allow PartialMessage to have PartialMessageable as a channel Signed-off-by: plun1331 --- discord/message.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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}" ) From 4dea317bd12f8b46ae71bb84d66c647eee06d129 Mon Sep 17 00:00:00 2001 From: plun1331 Date: Tue, 3 Sep 2024 10:22:53 -0700 Subject: [PATCH 2/3] Update CHANGELOG.md Signed-off-by: plun1331 --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ef3e6995ba..d6bf120856 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 From 5b3644a7450749f640317b203f87033ddcaf7959 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 17:23:20 +0000 Subject: [PATCH 3/3] style(pre-commit): auto fixes from pre-commit.com hooks --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6bf120856..80929555d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,7 +50,7 @@ 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`. +- Fixed `PartialMessage`s causing errors when created from `PartialMessageable`. ([#2568](https://github.com/Pycord-Development/pycord/pull/2500)) ## [2.6.0] - 2024-07-09