Skip to content

Commit

Permalink
Prevent firing voice state update events if member is not cached
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Nov 14, 2024
1 parent 39e1a6e commit 4e32d16
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ private void handleGuildVoiceState(DataObject content)

DataObject memberJson = content.getObject("member");
MemberImpl member = getJDA().getEntityBuilder().createMember((GuildImpl) guild, memberJson);
if (member == null) return;
// Only fire the events below if the member is cached
// If the member isn't cached, we would be firing every event that doesn't correspond to the default voice state
if (guild.getMemberById(member.getIdLong()) == null) return;

GuildVoiceStateImpl vState = (GuildVoiceStateImpl) member.getVoiceState();
if (vState == null)
Expand Down

0 comments on commit 4e32d16

Please sign in to comment.