Added RestGuildUser IsMuted/IsDeafened

This commit is contained in:
RogueException
2016-10-08 14:33:39 -03:00
parent 5551a9d524
commit bedf601bfe

View File

@@ -16,6 +16,8 @@ namespace Discord.Rest
public string Nickname { get; private set; } public string Nickname { get; private set; }
internal IGuild Guild { 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 ulong GuildId => Guild.Id;
public GuildPermissions GuildPermissions public GuildPermissions GuildPermissions
@@ -47,6 +49,8 @@ namespace Discord.Rest
_joinedAtTicks = model.JoinedAt.UtcTicks; _joinedAtTicks = model.JoinedAt.UtcTicks;
if (model.Nick.IsSpecified) if (model.Nick.IsSpecified)
Nickname = model.Nick.Value; Nickname = model.Nick.Value;
IsDeafened = model.Deaf;
IsMuted = model.Mute;
UpdateRoles(model.Roles); UpdateRoles(model.Roles);
} }
private void UpdateRoles(ulong[] roleIds) private void UpdateRoles(ulong[] roleIds)
@@ -63,8 +67,16 @@ namespace Discord.Rest
var model = await Discord.ApiClient.GetGuildMemberAsync(GuildId, Id, options); var model = await Discord.ApiClient.GetGuildMemberAsync(GuildId, Id, options);
Update(model); Update(model);
} }
public Task ModifyAsync(Action<ModifyGuildMemberParams> func, RequestOptions options = null) public async Task ModifyAsync(Action<ModifyGuildMemberParams> func, RequestOptions options = null)
=> UserHelper.ModifyAsync(this, Discord, func, options); {
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) public Task KickAsync(RequestOptions options = null)
=> UserHelper.KickAsync(this, Discord, options); => UserHelper.KickAsync(this, Discord, options);
@@ -75,8 +87,6 @@ namespace Discord.Rest
} }
//IVoiceState //IVoiceState
bool IVoiceState.IsDeafened => false;
bool IVoiceState.IsMuted => false;
bool IVoiceState.IsSelfDeafened => false; bool IVoiceState.IsSelfDeafened => false;
bool IVoiceState.IsSelfMuted => false; bool IVoiceState.IsSelfMuted => false;
bool IVoiceState.IsSuppressed => false; bool IVoiceState.IsSuppressed => false;