discord-api-docs
discord-api-docs copied to clipboard
Ephemeral message create events are incorrectly sent as a direct message
Description
When responding to an interaction with an ephemeral message (in a guild channel), you will get a MESSAGE_CREATE
event with a missing guild_id
. This already seems strange, however it gets even weirder. If you disable the GUILD_MESSAGES
intent and only enable DIRECT_MESSAGES
intent, you STILL get these events as if they were actually a direct message. Do the opposite and only have GUILD_MESSAGES
enabled, and you will not receive them at all.
It seems as if the API actually thinks all ephemeral messages are from private channels, which is in fact not true and causes a lot of issues if you try to handle them as such.
Steps to Reproduce
- Create a gateway session with just
DIRECT_MESSAGES
intent - Send an ephemeral message as a reply to an arbitrary interaction in a guild channel
- You receive a message create with ephemeral flag and no guild id
Expected Behavior
Either you don't send us the ephemeral message create events, which in all honesty are kind of unexpected to even exist. Or you add a guild_id to the event.
Current Behavior
Missing guild_id and incorrect intent behavior
Screenshots/Videos
Example ephemeral message from a guild:
{
"op" : 0,
"s" : 9,
"d" : {
"mention_everyone" : false,
"components" : [ ],
"pinned" : false,
"attachments" : [ ],
"author" : {
"bot" : true,
"avatar" : "55656387144ba6509be9117ebfbf0530",
"id" : 420321485757087746,
"public_flags" : 0,
"discriminator" : "3362",
"username" : "MinnBot"
},
"flags" : 64,
"mention_roles" : [ ],
"type" : 19,
"application_id" : 420321485757087746,
"nonce" : "946013605088722944",
"content" : "Hello",
"edited_timestamp" : null,
"tts" : false,
"webhook_id" : 420321485757087746,
"mentions" : [ ],
"id" : 946013608918274048,
"message_reference" : {
"guild_id" : 163772719836430337,
"message_id" : 946004982430330930,
"channel_id" : 471384828881928203
},
"channel_id" : 471384828881928203,
"embeds" : [ ],
"timestamp" : "2022-02-23T12:00:20.449000+00:00"
},
"t" : "MESSAGE_CREATE"
}
Note that the only intents I have enabled for this are GUILDS
and DIRECT_MESSAGES
. The event is also missing a member
object which is supposed to be provided for message create in a guild.
Client and System Information
Gateway and REST v9
Same issue seems to happen on MESSAGE_UPDATE
events as well.
Ephemeral messages are not dispatched through guilds, which is why there is differing behavior. They are sent directly to the user and bot user, if applicable. These messages should have the ephemeral flag set too. We can look into better documenting this behavior.