From e601cea2555a0aa4e41ddcc73e8f7ac4dab39b8e Mon Sep 17 00:00:00 2001 From: Christopher F Date: Wed, 15 Feb 2017 15:59:23 -0500 Subject: [PATCH] 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. --- src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs b/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs index 3d827bca5..55c676901 100644 --- a/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs +++ b/src/Discord.Net.WebSocket/Entities/Users/SocketGuildUser.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; +using System.Linq; using System.Threading.Tasks; using Model = Discord.API.GuildMember; using PresenceModel = Discord.API.Presence; @@ -32,6 +33,7 @@ namespace Discord.WebSocket public bool IsDeafened => VoiceState?.IsDeafened ?? false; public bool IsMuted => VoiceState?.IsMuted ?? false; public DateTimeOffset? JoinedAt => DateTimeUtils.FromTicks(_joinedAtTicks); + public IEnumerable Roles => _roleIds.Select(id => Guild.GetRole(id)); public IReadOnlyCollection RoleIds => _roleIds; public SocketVoiceChannel VoiceChannel => VoiceState?.VoiceChannel; public string VoiceSessionId => VoiceState?.VoiceSessionId ?? "";