discord-api-docs icon indicating copy to clipboard operation
discord-api-docs copied to clipboard

Embeds object always empty if Discord updates embeds w/o message content intent, even when it should be there

Open dangeredwolf opened this issue 1 year ago • 0 comments

Description

If you @ mention a bot, it is expected that you receive message content even without needing the message content intent. This is documented on https://support-dev.discord.com/hc/en-us/articles/4404772028055-Message-Content-Privileged-Intent-FAQ

If an embed for a website is uncached, Discord will fire MESSAGE_CREATE with en empty embeds array, and will fire a MESSAGE_UPDATE containing the new embeds array if such an update is necessary. If Discord already cached the embed, it is included on MESSAGE_CREATE and MESSAGE_UPDATE does not fire.

However, without message content intent MESSAGE_UPDATE fires with an empty embeds array, even though it is supposed to contain the new embeds. With the message content intent enabled, this works as expected.

User-initiated edits to the message cause the embeds array to suddenly appear in the subsequent MESSAGE_UPDATE event.

Steps to Reproduce

Create a bot using the necessary gateway intents to listen to MESSAGE_CREATE and MESSAGE_UPDATE events (i.e. guild messages). Do not enable message content intent.

@ mention the bot with an uncached web link with an embed that will defer populating embeds until later (thus requiring a MESSAGE_UPDATE for them to appear)

Important: The URL must not be cached by Discord, otherwise it will be sent along with the MESSAGE_CREATE event and MESSAGE_UPDATE won't be fired when the embed shows up

Notice that MESSAGE_UPDATE contains an empty array instead of containing the embeds.

Expected Behavior

MESSAGE_UPDATE should contain the new embeds in embeds array if the bot is mentioned in the message and an update of the embeds occurs, consistent with message content intent guidelines, other gateway events, and other MESSAGE_UPDATE events that may occur on messages mentioning the connected bot without the message content intent.

Current Behavior

embeds is an empty array when the entire point of the MESSAGE_UPDATE event being sent in the first place is that embeds are being added

Screenshots/Videos

Example of a raw gateway MESSAGE_UPDATE event with empty embeds.

An empty MESSAGE_UPDATE

On the contrary, with the message content intent, it will contain embeds.

Client and System Information

Issue originally discovered using discord.py 2.0.1 on Windows 10

dangeredwolf avatar Sep 01 '22 11:09 dangeredwolf