discord-net/Discord.Net

[Bug]: MessageUpdate not showing old message content when bot is rebooted

Taelyn opened this issue · 7 comments

Check The Docs

  • I double checked the docs and couldn't find any useful information.

Verify Issue Source

  • I verified the issue was caused by Discord.Net.

Check your intents

  • I double checked that I have the required intents.

Description

unknown

Discord is clearly able to fetsh old message data before edit when bot is rebooted
The screenshot is made with discord.js in TypeScript

Discord.Net however it does not, it will only show the edited message or null

 var cachedOldMessage = await oldMessage.DownloadAsync();
Console.WriteLine(cachedOldMessage.Content);

Only shows the edited message when bot is rebooted

oldMessage.Value

Shows old message if send when bot was online or null if bot was offline

Version

latest

Working Version

No response

Logs

-

Sample

No response

Packages

Environment

Windows 11 64bit

That is not a bug.
And no, it's not possible to fetch the old message data after it's been updated. The only way to achieve this - have a local cache of messages; dnet does exactly that, it stores N messages for each channel to in-ram cache (the N amount is configured in the DiscordSocketConfig by setting the MessageCacheSize). And since it's stored in the ram - it is cleared upon bot restarts.

Thats why Discord.JS can do it :) Even on a bot restart when the cache is cleared.
Kinda weird that this is the ONLY library that cant do it.

Tried DSharpPlus and there it works, so its clearly an issue in this library
Even Discord Devs confirmed its possible

I'm not aware how other libraries implement caching.
Could you quote or at least name the "Discord Dev" who told you it is possible so I could contact them about this?

I guess they build it in there library, something Discord.Net does not have it seems, what is weird :)
Anyway builded my own cache to fetch messages on ShardReady and this solves it.

Will look for the quote

Ah. Well we don't do that because it's extremely easy to get ratelimited this way. We don't think the lib should silently do such
a thing (that also might be unnecessary for some users) so we leave this up to the user.

I understand that, however we have a strong need of this due to the size of the community and what the bot should do for us.
I keep the message size low and see how it affects

Then make your own cache? Use redis?