Skip to content

Commit

Permalink
Possibly fix mute & deaf state for guild users (#3070)
Browse files Browse the repository at this point in the history
  • Loading branch information
Misha-133 authored Feb 27, 2025
1 parent 6e7b3c2 commit 5f6c26b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class SocketGuildUser : SocketUser, IGuildUser
private long? _joinedAtTicks;
private ImmutableArray<ulong> _roleIds;

private bool? _isDeafened;
private bool? _isMuted;

internal override SocketGlobalUser GlobalUser { get; set; }
/// <summary>
/// Gets the guild the user is in.
Expand Down Expand Up @@ -66,9 +69,9 @@ public class SocketGuildUser : SocketUser, IGuildUser
/// <inheritdoc />
public bool IsSuppressed => VoiceState?.IsSuppressed ?? false;
/// <inheritdoc />
public bool IsDeafened => VoiceState?.IsDeafened ?? false;
public bool IsDeafened => VoiceState?.IsDeafened ?? _isDeafened ?? false;
/// <inheritdoc />
public bool IsMuted => VoiceState?.IsMuted ?? false;
public bool IsMuted => VoiceState?.IsMuted ?? _isMuted ?? false;
/// <inheritdoc />
public bool IsStreaming => VoiceState?.IsStreaming ?? false;
/// <inheritdoc />
Expand Down Expand Up @@ -191,6 +194,11 @@ internal void Update(ClientState state, MemberModel model)
if (model.Banner.IsSpecified)
GuildBannerHash = model.Banner.Value;

if (model.Mute.IsSpecified)
_isMuted = model.Mute.Value;
if (model.Deaf.IsSpecified)
_isDeafened = model.Deaf.Value;

Flags = model.Flags;
}
internal void Update(ClientState state, PresenceModel model, bool updatePresence)
Expand Down

0 comments on commit 5f6c26b

Please sign in to comment.