Add Roles property to SocketGuildUser
there's a few different ways to select a user's roles from their role IDs, and this one seems to be the most efficient. doesn't seem like there's any reason this shouldn't be included.
This commit is contained in:
@@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Model = Discord.API.GuildMember;
|
using Model = Discord.API.GuildMember;
|
||||||
using PresenceModel = Discord.API.Presence;
|
using PresenceModel = Discord.API.Presence;
|
||||||
@@ -32,6 +33,7 @@ namespace Discord.WebSocket
|
|||||||
public bool IsDeafened => VoiceState?.IsDeafened ?? false;
|
public bool IsDeafened => VoiceState?.IsDeafened ?? false;
|
||||||
public bool IsMuted => VoiceState?.IsMuted ?? false;
|
public bool IsMuted => VoiceState?.IsMuted ?? false;
|
||||||
public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks);
|
public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks);
|
||||||
|
public IEnumerable<SocketRole> Roles => _roleIds.Select(id => Guild.GetRole(id));
|
||||||
public IReadOnlyCollection<ulong> RoleIds => _roleIds;
|
public IReadOnlyCollection<ulong> RoleIds => _roleIds;
|
||||||
public SocketVoiceChannel VoiceChannel => VoiceState?.VoiceChannel;
|
public SocketVoiceChannel VoiceChannel => VoiceState?.VoiceChannel;
|
||||||
public string VoiceSessionId => VoiceState?.VoiceSessionId ?? "";
|
public string VoiceSessionId => VoiceState?.VoiceSessionId ?? "";
|
||||||
|
|||||||
Reference in New Issue
Block a user