Open FloatingMilkshake opened 1 year ago
Discord provides the message that was deleted along with the message edits.
Message update provides two responses: Old content
{
"channelId": "1012849719241883788",
"guildId": "1007457740655968327",
"id": "1082407022361850067",
"createdTimestamp": 1678136344281,
"type": 0,
"system": false,
"content": "hello world!",
"authorId": "455428041586376729",
"pinned": false,
"tts": false,
"nonce": "1082407016984477696",
"embeds": [],
"components": [],
"attachments": [],
"stickers": [],
"position": null,
"editedTimestamp": null,
"mentions": {
"everyone": false,
"users": [],
"roles": [],
"crosspostedChannels": [],
"repliedUser": null,
"members": [],
"channels": []
},
"webhookId": null,
"groupActivityApplicationId": null,
"applicationId": null,
"activity": null,
"flags": 0,
"reference": null,
"interaction": null,
"cleanContent": "hello world!"
}
New content:
{
"channelId": "1012849719241883788",
"guildId": "1007457740655968327",
"id": "1082407022361850067",
"createdTimestamp": 1678136344281,
"type": 0,
"system": false,
"content": "Hello World!",
"authorId": "455428041586376729",
"pinned": false,
"tts": false,
"nonce": "1082407016984477696",
"embeds": [],
"components": [],
"attachments": [],
"stickers": [],
"position": null,
"editedTimestamp": 1678136352029,
"mentions": {
"everyone": false,
"users": [],
"roles": [],
"crosspostedChannels": [],
"repliedUser": null,
"members": [],
"channels": []
},
"webhookId": null,
"groupActivityApplicationId": null,
"applicationId": null,
"activity": null,
"flags": 0,
"reference": null,
"interaction": null,
"cleanContent": "Hello World!"
}
And message deletions also send the content in:
{
"channelId": "1012849719241883788",
"guildId": "1007457740655968327",
"id": "1082407022361850067",
"createdTimestamp": 1678136344281,
"type": 0,
"system": false,
"content": "Hello World!",
"authorId": "455428041586376729",
"pinned": false,
"tts": false,
"nonce": "1082407016984477696",
"embeds": [],
"components": [],
"attachments": [],
"stickers": [],
"position": null,
"editedTimestamp": 1678136352029,
"mentions": {
"everyone": false,
"users": [],
"roles": [],
"crosspostedChannels": [],
"repliedUser": null,
"members": [],
"channels": []
},
"webhookId": null,
"groupActivityApplicationId": null,
"applicationId": null,
"activity": null,
"flags": 0,
"reference": null,
"interaction": null,
"cleanContent": "Hello World!"
}
That's actually a cache thing! On Message Update, Discord provides the same data as the Message Create event. On Message Delete it provides even less. It's nice that this data could be cached, but I wouldn't depend on it.
A separate message cache should be implemented somehow.
Includes message logging (edits & deletes) and user logging.
Message logging will require storing a cache of sent messages. Both will require storing some settings for each guild (think log channel).