mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-05-12 08:49:48 +00:00
Allow PartialMessage.channel to be a PartialMessageable
This commit is contained in:
parent
92d1b4cd2b
commit
ce01033e06
@ -1627,7 +1627,7 @@ class PartialMessage(Hashable):
|
|||||||
|
|
||||||
Attributes
|
Attributes
|
||||||
-----------
|
-----------
|
||||||
channel: Union[:class:`TextChannel`, :class:`Thread`, :class:`DMChannel`]
|
channel: Union[:class:`PartialMessageable`, :class:`TextChannel`, :class:`Thread`, :class:`DMChannel`]
|
||||||
The channel associated with this partial message.
|
The channel associated with this partial message.
|
||||||
id: :class:`int`
|
id: :class:`int`
|
||||||
The message ID.
|
The message ID.
|
||||||
@ -1650,7 +1650,7 @@ class PartialMessage(Hashable):
|
|||||||
to_message_reference_dict = Message.to_message_reference_dict
|
to_message_reference_dict = Message.to_message_reference_dict
|
||||||
|
|
||||||
def __init__(self, *, channel: PartialMessageableChannel, id: int):
|
def __init__(self, *, channel: PartialMessageableChannel, id: int):
|
||||||
if channel.type not in (
|
if not isinstance(channel, PartialMessageable) and channel.type not in (
|
||||||
ChannelType.text,
|
ChannelType.text,
|
||||||
ChannelType.news,
|
ChannelType.news,
|
||||||
ChannelType.private,
|
ChannelType.private,
|
||||||
@ -1658,7 +1658,7 @@ class PartialMessage(Hashable):
|
|||||||
ChannelType.public_thread,
|
ChannelType.public_thread,
|
||||||
ChannelType.private_thread,
|
ChannelType.private_thread,
|
||||||
):
|
):
|
||||||
raise TypeError(f'Expected TextChannel, DMChannel or Thread not {type(channel)!r}')
|
raise TypeError(f'Expected PartialMessageable, TextChannel, DMChannel or Thread not {type(channel)!r}')
|
||||||
|
|
||||||
self.channel: PartialMessageableChannel = channel
|
self.channel: PartialMessageableChannel = channel
|
||||||
self._state: ConnectionState = channel._state
|
self._state: ConnectionState = channel._state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user