Skip to content

Commit f51057b

Browse files
fix: allow PartialMessage to have PartialMessageable as a channel (#2568)
* fix: allow PartialMessage to have PartialMessageable as a channel Signed-off-by: plun1331 <[email protected]> * Update CHANGELOG.md Signed-off-by: plun1331 <[email protected]> * style(pre-commit): auto fixes from pre-commit.com hooks --------- Signed-off-by: plun1331 <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent bdbb802 commit f51057b

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ These changes are available on the `master` branch, but have not yet been releas
5050
([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
5151
- Fixed the type of `ForumChannel.default_sort_order`, changing it from `int` to
5252
`SortOrder`. ([#2500](https://github.com/Pycord-Development/pycord/pull/2500))
53+
- Fixed `PartialMessage`s causing errors when created from `PartialMessageable`.
54+
([#2568](https://github.com/Pycord-Development/pycord/pull/2500))
5355

5456
## [2.6.0] - 2024-07-09
5557

discord/message.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from urllib.parse import parse_qs, urlparse
4343

4444
from . import utils
45+
from .channel import PartialMessageable
4546
from .components import _component_factory
4647
from .embeds import Embed
4748
from .emoji import Emoji
@@ -2001,6 +2002,7 @@ class PartialMessage(Hashable):
20012002
- :meth:`DMChannel.get_partial_message`
20022003
- :meth:`VoiceChannel.get_partial_message`
20032004
- :meth:`StageChannel.get_partial_message`
2005+
- :meth:`PartialMessageable.get_partial_message`
20042006
20052007
Note that this class is trimmed down and has no rich attributes.
20062008
@@ -2022,7 +2024,7 @@ class PartialMessage(Hashable):
20222024
20232025
Attributes
20242026
----------
2025-
channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`VoiceChannel`, :class:`StageChannel`]
2027+
channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`, :class:`VoiceChannel`, :class:`StageChannel`, :class:`PartialMessageable`]
20262028
The channel associated with this partial message.
20272029
id: :class:`int`
20282030
The message ID.
@@ -2053,9 +2055,9 @@ def __init__(self, *, channel: PartialMessageableChannel, id: int):
20532055
ChannelType.news_thread,
20542056
ChannelType.public_thread,
20552057
ChannelType.private_thread,
2056-
):
2058+
) and not isinstance(channel, PartialMessageable):
20572059
raise TypeError(
2058-
"Expected TextChannel, VoiceChannel, StageChannel, DMChannel or Thread not"
2060+
"Expected TextChannel, VoiceChannel, StageChannel, DMChannel, Thread or PartialMessageable not"
20592061
f" {type(channel)!r}"
20602062
)
20612063

0 commit comments

Comments
 (0)