Union Message Parsed Mentions with Discord Mention Lists
Created by: ProfDoof
Summary
Fixes #782 (closed)
Details
This fixes #782 (closed) which prevents the reply mentioned user from showing up in the DSharpPlus MentionedUsers list by unioning the Discord provided Mention lists with the parsed mention lists. The reason that it was decided to union instead of only use the Discord provided lists is that users who are in the cache and are mentioned in a context outside of a guild where they are member are not sent by Discord. So, to circumvent that we parse the message mentions. To ensure that no changes occur for the other mention lists we also union them with whatever is parsed from the message. This allows us to respect old behavior while still ensuring that any Discord-provided data is used.
One change was made that can easily be remedied, I set all Mention lists to empty lists rather than null. This is because the two separate behaviors didn't really make sense. Especially since Discord always sends the mentioned roles list (even if they don't always send the mention channels list) even if it's empty. So, for consistency's sake, it makes sense to just go ahead and provide empty lists instead. If y'all disagree just comment and let me know and I will change it.
Also, I need to fix this, I forgot to set the MinimumLogLevel in the TestBot back to Debug.
Changes proposed
- Added 4 test commands to test different aspects of the mention parsing and mention objects received from Discord
- Update the User Cache with the partial user objects received from Discord in the mention but only for users that are in some guild and not those that are in DMs.
- Added a DiscordUserComparer so that I could use a HashSet for unioning the parsed mentions and the discord sent mentioned users together.