Browse Source

Filter null roles in SocketGuildUser

tags/1.0-rc
RogueException 8 years ago
parent
commit
8d435e994b
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs

+ 2
- 1
src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs View File

@@ -34,7 +34,8 @@ namespace Discord.WebSocket
public bool IsDeafened => VoiceState?.IsDeafened ?? false;
public bool IsMuted => VoiceState?.IsMuted ?? false;
public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks);
public IEnumerable<SocketRole> Roles => _roleIds.Select(id => Guild.GetRole(id)).ToReadOnlyCollection(() => _roleIds.Count());
public IEnumerable<SocketRole> Roles
=> _roleIds.Select(id => Guild.GetRole(id)).Where(x => x != null).ToReadOnlyCollection(() => _roleIds.Length);
public SocketVoiceChannel VoiceChannel => VoiceState?.VoiceChannel;
public string VoiceSessionId => VoiceState?.VoiceSessionId ?? "";
public SocketVoiceState? VoiceState => Guild.GetVoiceState(Id);


Loading…
Cancel
Save