Browse Source

Fixed User.Edit exception when null roles is passed

tags/docs-0.9
RogueException 9 years ago
parent
commit
ccedfd2326
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      src/Discord.Net/Models/User.cs

+ 6
- 2
src/Discord.Net/Models/User.cs View File

@@ -239,14 +239,18 @@ namespace Discord
if (Server == null) throw new InvalidOperationException("Unable to edit users in a private channel");

//Modify the roles collection and filter out the everyone role
var roleIds = roles == null ? null : roles.Where(x => !x.IsEveryone).Select(x => x.Id).Distinct();
var roleIds = roles == null ? null : roles
.Where(x => !x.IsEveryone)
.Select(x => x.Id)
.Distinct()
.ToArray();

var request = new UpdateMemberRequest(Server.Id, Id)
{
IsMuted = isMuted ?? IsServerMuted,
IsDeafened = isDeafened ?? IsServerDeafened,
VoiceChannelId = voiceChannel?.Id,
RoleIds = roleIds.ToArray()
RoleIds = roleIds
};
return Client.ClientAPI.Send(request);
}


Loading…
Cancel
Save