From bedf601bfe8f017a1337688c2dd4e749ae536ac5 Mon Sep 17 00:00:00 2001 From: RogueException Date: Sat, 8 Oct 2016 14:33:39 -0300 Subject: [PATCH] Added RestGuildUser IsMuted/IsDeafened --- .../Entities/Users/RestGuildUser.cs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs b/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs index 1ea4e2117..c24d03703 100644 --- a/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs +++ b/src/Discord.Net.Rest/Entities/Users/RestGuildUser.cs @@ -16,6 +16,8 @@ namespace Discord.Rest public string Nickname { get; private set; } internal IGuild Guild { get; private set; } + public bool IsDeafened { get; private set; } + public bool IsMuted { get; private set; } public ulong GuildId => Guild.Id; public GuildPermissions GuildPermissions @@ -47,6 +49,8 @@ namespace Discord.Rest _joinedAtTicks = model.JoinedAt.UtcTicks; if (model.Nick.IsSpecified) Nickname = model.Nick.Value; + IsDeafened = model.Deaf; + IsMuted = model.Mute; UpdateRoles(model.Roles); } private void UpdateRoles(ulong[] roleIds) @@ -63,8 +67,16 @@ namespace Discord.Rest var model = await Discord.ApiClient.GetGuildMemberAsync(GuildId, Id, options); Update(model); } - public Task ModifyAsync(Action func, RequestOptions options = null) - => UserHelper.ModifyAsync(this, Discord, func, options); + public async Task ModifyAsync(Action func, RequestOptions options = null) + { + var args = await UserHelper.ModifyAsync(this, Discord, func, options); + if (args.Deaf.IsSpecified) + IsDeafened = args.Deaf.Value; + if (args.Mute.IsSpecified) + IsMuted = args.Mute.Value; + if (args.RoleIds.IsSpecified) + UpdateRoles(args.RoleIds.Value); + } public Task KickAsync(RequestOptions options = null) => UserHelper.KickAsync(this, Discord, options); @@ -75,8 +87,6 @@ namespace Discord.Rest } //IVoiceState - bool IVoiceState.IsDeafened => false; - bool IVoiceState.IsMuted => false; bool IVoiceState.IsSelfDeafened => false; bool IVoiceState.IsSelfMuted => false; bool IVoiceState.IsSuppressed => false;