Remove implicit SocketGuildUser.RoleIds; refactor Roles to ReadOnly

This commit is contained in:
Christopher F
2017-02-21 16:19:33 -05:00
parent e601cea255
commit bb9f144eae

View File

@@ -33,8 +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 IEnumerable<SocketRole> Roles => _roleIds.Select(id => Guild.GetRole(id)).ToReadOnlyCollection(() => _roleIds.Count());
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 ?? "";
public SocketVoiceState? VoiceState => Guild.GetVoiceState(Id); public SocketVoiceState? VoiceState => Guild.GetVoiceState(Id);
@@ -117,7 +116,7 @@ namespace Discord.WebSocket
//IGuildUser //IGuildUser
IGuild IGuildUser.Guild => Guild; IGuild IGuildUser.Guild => Guild;
ulong IGuildUser.GuildId => Guild.Id; ulong IGuildUser.GuildId => Guild.Id;
IReadOnlyCollection<ulong> IGuildUser.RoleIds => RoleIds; IReadOnlyCollection<ulong> IGuildUser.RoleIds => _roleIds;
//IUser //IUser
Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options) Task<IDMChannel> IUser.GetDMChannelAsync(CacheMode mode, RequestOptions options)