Skip to content

Commit

Permalink
fix: allow PartialMessage to have PartialMessageable as a channel (Py…
Browse files Browse the repository at this point in the history
…cord-Development#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>
  • Loading branch information
plun1331 and pre-commit-ci[bot] authored Sep 4, 2024
1 parent bdbb802 commit f51057b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions discord/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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}"
)

Expand Down

0 comments on commit f51057b

Please sign in to comment.