-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redundant Message Update Events #10153
Comments
These logs are coming from Discord, so it's not a discord.js issue. You should open an issue over at https://github.com/discord/discord-api-docs and report your findings. |
Simple temporary solution for users
client.on(Events.MessageUpdate, (oldMsg, newMsg) => {
if (oldMsg.editedTimestamp === newMsg.editedTimestamp) return;
// ...
}); Reason for this to workTake a look at the previous redundant
[
{
"t": "MESSAGE_UPDATE",
"s": 86,
"op": 0,
"d": {
"id": "1211645783686782996",
"channel_id": "748114061966835772",
"attachments": [],
"guild_id": "678164358378946580"
}
},
{
"t": "MESSAGE_UPDATE",
"s": 87,
"op": 0,
"d": {
"webhook_id": "826343609824575504",
"type": 20,
"tts": false,
"timestamp": "2024-02-26T12:07:46.121000+00:00",
"position": 0,
"pinned": false,
"mentions": [],
"mention_roles": [],
"mention_everyone": false,
"member": {
"roles": [
"710374276049534977",
"986909666820898867",
"678176821321138189",
"742414428208758815"
],
"premium_since": null,
"pending": false,
"nick": "( b. ) Bloony 🌸",
"mute": false,
"joined_at": "2022-09-16T20:35:00.838000+00:00",
"flags": 0,
"deaf": false,
"communication_disabled_until": null,
"avatar": null
},
"interaction_metadata": {
"user_id": "676103178323886085",
"type": 2,
"name": "ping",
"id": "1211645782789201970",
"authorizing_integration_owners": {
"0": "678164358378946580"
}
},
"interaction": {
"user": {
"username": "bloonatics",
"public_flags": 4194432,
"id": "676103178323886085",
"global_name": "Bloonatics",
"discriminator": "0",
"avatar_decoration_data": null,
"avatar": "a236da7641db588ca84c75541a8c8759"
},
"type": 2,
"name": "ping",
"member": {
"roles": [
"756248495110881360",
"995756877075988570",
"986909666820898867"
],
"premium_since": null,
"pending": false,
"nick": "Bloonatics 🌸",
"mute": false,
"joined_at": "2020-04-24T06:59:30.136000+00:00",
"flags": 2,
"deaf": false,
"communication_disabled_until": null,
"avatar": null
},
"id": "1211645782789201970"
},
"id": "1211645783686782996",
"flags": 0,
"embeds": [
{
"type": "rich",
"title": "Pong!",
"footer": {
"text": "bloonatics",
"proxy_icon_url": "https://images-ext-2.discordapp.net/external/xRotzEa3IhzPRr5ah464AOJarA5gfjVMDeDuFVvr4ng/https/cdn.discordapp.com/avatars/676103178323886085/a236da7641db588ca84c75541a8c8759.webp",
"icon_url": "https://cdn.discordapp.com/avatars/676103178323886085/a236da7641db588ca84c75541a8c8759.webp"
},
"description": "Roundtrip latency: `241ms`\nWebsocket heartbeat: `74ms`",
"color": 12845022
}
],
"edited_timestamp": "2024-02-26T12:07:46.412817+00:00",
"content": "",
"components": [],
"channel_id": "748114061966835772",
"author": {
"username": "Bloony",
"public_flags": 65536,
"premium_type": 0,
"id": "826343609824575504",
"global_name": null,
"discriminator": "0615",
"bot": true,
"avatar_decoration_data": null,
"avatar": "a_c7b487a96f23f21aac1a54125d821714"
},
"attachments": [],
"application_id": "826343609824575504",
"guild_id": "678164358378946580"
}
},
{
"t": "MESSAGE_UPDATE",
"s": 88,
"op": 0,
"d": {
"id": "1211645783686782996",
"channel_id": "748114061966835772",
"attachments": [],
"guild_id": "678164358378946580"
}
}
] Focus on the first packet: {
"t": "MESSAGE_UPDATE",
"s": 86,
"op": 0,
"d": {
"id": "1211645783686782996",
"channel_id": "748114061966835772",
"attachments": [],
"guild_id": "678164358378946580"
}
} Please note that this data does not have Focus on the second packet: {
"t": "MESSAGE_UPDATE",
"s": 87,
"op": 0,
"d": {
"webhook_id": "826343609824575504",
"type": 20,
"tts": false,
"timestamp": "2024-02-26T12:07:46.121000+00:00",
"position": 0,
"pinned": false,
"mentions": [],
"mention_roles": [],
"mention_everyone": false,
"member": {
"roles": [
"710374276049534977",
"986909666820898867",
"678176821321138189",
"742414428208758815"
],
"premium_since": null,
"pending": false,
"nick": "( b. ) Bloony 🌸",
"mute": false,
"joined_at": "2022-09-16T20:35:00.838000+00:00",
"flags": 0,
"deaf": false,
"communication_disabled_until": null,
"avatar": null
},
"interaction_metadata": {
"user_id": "676103178323886085",
"type": 2,
"name": "ping",
"id": "1211645782789201970",
"authorizing_integration_owners": {
"0": "678164358378946580"
}
},
"interaction": {
"user": {
"username": "bloonatics",
"public_flags": 4194432,
"id": "676103178323886085",
"global_name": "Bloonatics",
"discriminator": "0",
"avatar_decoration_data": null,
"avatar": "a236da7641db588ca84c75541a8c8759"
},
"type": 2,
"name": "ping",
"member": {
"roles": [
"756248495110881360",
"995756877075988570",
"986909666820898867"
],
"premium_since": null,
"pending": false,
"nick": "Bloonatics 🌸",
"mute": false,
"joined_at": "2020-04-24T06:59:30.136000+00:00",
"flags": 2,
"deaf": false,
"communication_disabled_until": null,
"avatar": null
},
"id": "1211645782789201970"
},
"id": "1211645783686782996",
"flags": 0,
"embeds": [
{
"type": "rich",
"title": "Pong!",
"footer": {
"text": "bloonatics",
"proxy_icon_url": "https://images-ext-2.discordapp.net/external/xRotzEa3IhzPRr5ah464AOJarA5gfjVMDeDuFVvr4ng/https/cdn.discordapp.com/avatars/676103178323886085/a236da7641db588ca84c75541a8c8759.webp",
"icon_url": "https://cdn.discordapp.com/avatars/676103178323886085/a236da7641db588ca84c75541a8c8759.webp"
},
"description": "Roundtrip latency: `241ms`\nWebsocket heartbeat: `74ms`",
"color": 12845022
}
],
"edited_timestamp": "2024-02-26T12:07:46.412817+00:00",
"content": "",
"components": [],
"channel_id": "748114061966835772",
"author": {
"username": "Bloony",
"public_flags": 65536,
"premium_type": 0,
"id": "826343609824575504",
"global_name": null,
"discriminator": "0615",
"bot": true,
"avatar_decoration_data": null,
"avatar": "a_c7b487a96f23f21aac1a54125d821714"
},
"attachments": [],
"application_id": "826343609824575504",
"guild_id": "678164358378946580"
}
} As we all know, this data is necessary and we want to handle it because its Focus on the third packet: {
"t": "MESSAGE_UPDATE",
"s": 88,
"op": 0,
"d": {
"id": "1211645783686782996",
"channel_id": "748114061966835772",
"attachments": [],
"guild_id": "678164358378946580"
}
} You probably know what I want to say already. Since the values of the previous packet are cached, we will receive |
Which package is this bug report for?
discord.js
Issue description
Setup
discord.js/packages/discord.js/src/client/websocket/WebSocketManager.js
Lines 235 to 243 in efa3cac
Specification
Guilds
740192346024443964
- 16 members (903556716547960862
is a text channel there)678164358378946580
- about 22k members (748114061966835772
is a text channel there)Users
676103178323886085
- my account (non bot)866765758566236200
- the client to run this experiment (bot)826343609824575504
- another botExperiment
1. user
676103178323886085
channel903556716547960862
(non bot in smaller guild)Send a message with content
.
and edit it to..
./debug.json
There's no problem, it fires a single
MESSAGE_UPDATE
event.2. user
676103178323886085
channel748114061966835772
(non bot in larger guild)Send a message with content
.
and edit it to..
./debug.json
There's no problem, it fires a single
MESSAGE_UPDATE
event.3. user
826343609824575504
channel903556716547960862
(bot in smaller guild)Run
/ping
, what the bot does areChatInputCommandInteraction#reply
ChatInputCommandInteraction#editReply
./debug.json
There's no problem, it fires a single
MESSAGE_UPDATE
event.4. user
826343609824575504
channel748114061966835772
(bot in larger guild)Run
/ping
, what the bot does areChatInputCommandInteraction#reply
ChatInputCommandInteraction#editReply
./debug.json
We can see that there are three
MESSAGE_UPDATE
events with the same message id1211645783686782996
and an ascending sequence number of event. This experiment is done with the same conditions as the 3rd experiment but in a larger guild.Summary
After additional testing, I have found that this bug:
270904126974590976
but not235148962103951360
).Code sample
No response
Versions
Issue priority
Medium (should be fixed soon)
Which partials do you have configured?
No Partials
Which gateway intents are you subscribing to?
Guilds, GuildMessages, MessageContent
I have tested this issue on a development release
No response
The text was updated successfully, but these errors were encountered: