Skip to content
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

GuildMemberUpdated event is not working as expected. #1663

Open
OoLunar opened this issue Oct 27, 2023 Discussed in #1662 · 1 comment
Open

GuildMemberUpdated event is not working as expected. #1663

OoLunar opened this issue Oct 27, 2023 Discussed in #1662 · 1 comment

Comments

@OoLunar
Copy link
Member

OoLunar commented Oct 27, 2023

Discussed in #1662

Originally posted by eyagovbusiness October 27, 2023
Hey there! 👋

So, I was diving into the DiscordClient.GuildMemberUpdated AsyncEventHandler just the other day. Decided to test it out by changing my avatar image. Funny thing, I noticed that GuildMemberUpdateEventArgs.MemberAfter was the same as...well, GuildMemberUpdateEventArgs.MemberAfter itself. 😅 Here's what I was looking at:
AvatarHash
Thought I'd pull the repo and snoop around a bit. Found the quirk in the "internal async Task OnGuildMemberUpdateEventAsync(TransportMember member, DiscordGuild guild)" inside DiscordClient.Dispatch.cs. Looks like this method is doing double duty - updating the cached member and users. Cool, but it makes MemberBefore and MemberAfter end up being identical after the UserCache and guild.Members update.

Got some thoughts on how to tweak this, but wanted to touch base with you first. Were you guys aiming to track every change when a member's updated in this handler? Or was it more about just keeping the cached items fresh?

Thank you for your work and your time


Ideally the GuildMemberUpdate event should work like this: Any *Before properties should contain the "old" cached information that we received previously. Any *After properties should contain the new information copied straight from Discord, with minimal (ideally none!) modification.

@akiraveliara
Copy link
Member

this might be fixed by #1647 once that's ready and merged, will need to specifically test for this

@OoLunar OoLunar mentioned this issue Oct 27, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants