Message reference hotfix
Created by: Neuheit
Summary
So as it turns out I was able to test my previous message reference code on a crosspost that was sent in my test server a few days ago, and it threw an exception.
Details
I noticed this when I tried to get the crosspost using GetMessageAsync()
. It threw a NRE because the DiscordClient that was supposed to fetch caches was not initialized by the time the DiscordMessageReference
constructor was being called.
I fixed this by instead creating a new struct and instead having that be deserialized with the IDs, and then manually initialize the DiscordMessageReference
in a separate method in DiscordMessage
.
Changes proposed
- Created a new internal struct,
InternalDiscordMessageReference
that holds the sent reference IDs - Removed the skeleton objects and the constructor body from
DiscordMessageReference
. - Created a new internal method in
DiscordMessage
which initializes the skeleton objects and returns a newDiscordMessageReference
Notes
I apologize for any inconveniences this may have caused anyone.