Skip to content

GuildMemberUpdated event is not working as expected. #1663

@OoLunar

Description

@OoLunar

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions