This PR replaces the message cache service with an optimized one, adding support to sent messages and including the edited/deleted message cache into a single service.
The optimized message cache will work almost like the default message cache included in Discord.Net, but it will only cache messages from servers that have used at least 1 command in the last x hours.
The edited/deleted message cache will work as before.
Limitations:
It's not possible to directly update parts of a message, since the properties don't have public setters and the Update() method is internal. This makes it harder to update the reactions and embeds, but there are workarounds for this, like adding to a cached message private fields that represents the updated values of a property, and use them instead of the original message's properties.
Sometimes the MessageUpdated event will return partial messages with specific changes from the original messages (like link previews/embeds). In this case only the embeds will be updated on the cached message.
The Reactions property won't have the correct ReactionMetadata values because ReactionMetadata doesn't have a public constructor and its properties don't have public setters.
This PR replaces the message cache service with an optimized one, adding support to sent messages and including the edited/deleted message cache into a single service.
The optimized message cache will work almost like the default message cache included in Discord.Net, but it will only cache messages from servers that have used at least 1 command in the last x hours.
The edited/deleted message cache will work as before.
Limitations:
It's not possible to directly update parts of a message, since the properties don't have public setters and the Update() method is internal. This makes it harder to update the reactions and embeds, but there are workarounds for this, like adding to a cached message private fields that represents the updated values of a property, and use them instead of the original message's properties.
Sometimes the
MessageUpdated
event will return partial messages with specific changes from the original messages (like link previews/embeds). In this case only the embeds will be updated on the cached message.The
Reactions
property won't have the correctReactionMetadata
values becauseReactionMetadata
doesn't have a public constructor and its properties don't have public setters.