Message.channel
is a DMChannel
in on_message
for an ephemeral message not sent as a DM
#7370
Open
3 tasks done
Labels
bug
This is a bug with the library.
discord limitation
This can't be fixed because it's a discord limitation
Summary
When an ephemeral message is sent, the resulting
Message
object dispatched toon_message
has achannel
attribute that is an instance ofDMChannel
, even if the ephemeral message was not sent as a Direct Message.Reproduction Steps
type(message.channel)
for the corresponding message inon_message
Expected Results
message.channel
should be the proper type (e.g.TextChannel
), rather thanDMChannel
.Actual Results
message.channel
is aDMChannel
.Intents
N/A
System Information
Checklist
Additional Context
This seems to be because Discord's API does not provide
guild_id
for ephemeral messages for the Message Create event.When discord.py receives the event,
ConnectionState.parse_message_create
assigns the channel withConnectionState._get_guild_channel
:discord.py/discord/state.py
Lines 509 to 511 in 1e17b7f
When the data doesn't have
guild_id
,ConnectionState._get_guild_channel
returns aDMChannel
:discord.py/discord/state.py
Lines 403 to 413 in 1e17b7f
The text was updated successfully, but these errors were encountered: