-
-
Notifications
You must be signed in to change notification settings - Fork 318
Change GuildMemberUpdatedEventArgs to contain before and after DiscordMember objects #1359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change GuildMemberUpdatedEventArgs to contain before and after DiscordMember objects #1359
Conversation
Giggitybyte
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
|
This is a really well-done PR, thank you for opening it. After a quick review, I haven't noticed any breaking changes. Have these changes been tested? |
There is a breaking change unfortunately. I think it was necessary change to make it less confusing and line it up to how the properties are named on the DiscordMember class.
I have tested them locally while trying to get a feature working on my own bot. |
|
I'm perfectly fine with merging this, awaiting @VelvetThePanda's approval |
* Change GuildMemberUpdatedEventArgs to contain before and after DiscordMember objects (#1359) * Fix #1325 - WebhookBuilder Throws Bad Request (#1363) * use DiscordMentions on RestWebhookPayloads * keep null value when null * remove null check from discordmentions arg * Implemented PATCH /guilds/:guild_id/roles (tested) (#1311) * Fix compile errors caused by #1333 * Update hosting.md * Remove unused DSharpPlus.MSTest folder * Cache threads upon thread creation (#1366) * categorization for the cnext default help command (#1371) * Fix memberBefore missing roles in GuildMemberUpdateEventArgs when not… (#1364) * Fix memberBefore missing roles in GuildMemberUpdateEventArgs when not in cache * Update cached guild member in OnGuildMemberUpdateEventAsync internal event handler * Update DiscordClient.Dispatch.cs Co-authored-by: Lunar Starstrum <lunar@forsaken-borders.net> * Ported CommandsNext cooldown attribute to Slash Commands (#1375) * Ported CommandsNext cooldown attribute to Slash Commands; Fixed compiler warnings and suggestions * Still untested; Attempted to resolve @Erisa's review * Made all exceptions inherit from ApplicationCommandExecutionChecksFailedException (previously Exception) * Start on converters * Added custom converter support: - No, I did not implement the checks in the converters. I felt that should be done in a separate area of code - Yes, I did break my Enter, Backspace, D and Apostrophe keys because of this PR. Don't ask how. * Fixed startup errors; Added DiscordMessageArgumentConverter; Added (un)register converter methods (untested). * Fix registering converters * (untested) Add number converters; Fix enums not registering choices correctly * Add DiscordMember converter; Switch from ArgumentException to new MissingArgumentConverterException * Actually fix Nullable and update TimeSpan converter to match with CNext * Add params/array support * Boundry checks * [ci-skip] Resolve naming errors * "One less variable allocation" * Remove unsupport NETSTANDARD1_3 support; Un-Emziware those variable names * Remove unused property * Extra parameter limit attribute check * Remove UnregisterConverter(s) methods * Changed BCL types to use framework names * Pass InnerException to prevent passing TargetInvocationException * Fix enum support (again) --------- Co-authored-by: Bob Loblaw <razvanmandache@gmail.com> Co-authored-by: waffle-lord <76401815+waffle-lord@users.noreply.github.com> Co-authored-by: Iris Féanorá <61018569+ExaInsanity@users.noreply.github.com>
Summary
When user properties change e.g. Username and Avatar (not guild avatar) GuildMemberUpdated event is broadcasted. This makes it easier to grab the old username or avatar from the cached user (if it exists).
Changes proposed
Add MemberAfter and MemberBefore properties to GuildMemberUpdatedEventArgs.
NicknameBefore/After, RolesBefore/After, (non-guild)AvatarBefore/After are now just shortcuts to properties of MemberAfter and MemberBefore respectively.