Fix GetMessagesAsync (and possibly others) returning messages with no channel
Created by: uwx
Summary
Fixes GetMessagesAsync (and potentially other methods that do similar things) returning messages with no channel ID, which would raise an exception when calling a method such as GetReactionsAsync
.
Details
The REST API does not always provide messages with channel IDs, for some reason. However, on all calls to PrepareMessage, we already know the channel's ID, so there's no reason that we can't force a default if one is not provided by Discord.
Changes proposed
- Add an additional parameter to DiscordApiClient.PrepareMessage used as a backup when the raw message's channel ID does not get deserialized
- Fix naming of the variables and parameters in DiscordApiClient.PrepareMessage. You said you were going to do this incrementally as needed, so I took the opportunity to fix it now.
Notes
This was reported by Paulo on Discord. I haven't had the opportunity to test this yet since I'm currently developing in a branch and my test bot is not in a working state at the moment.