| @@ -6,7 +6,7 @@ using Model = Discord.API.Emoji; | |||
| namespace Discord | |||
| { | |||
| [DebuggerDisplay(@"{DebuggerDisplay,nq}")] | |||
| public struct Emoji | |||
| public struct GuildEmoji | |||
| { | |||
| public ulong Id { get; } | |||
| public string Name { get; } | |||
| @@ -14,7 +14,7 @@ namespace Discord | |||
| public bool RequireColons { get; } | |||
| public IReadOnlyList<ulong> RoleIds { get; } | |||
| private Emoji(ulong id, string name, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds) | |||
| private GuildEmoji(ulong id, string name, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds) | |||
| { | |||
| Id = id; | |||
| Name = name; | |||
| @@ -22,9 +22,9 @@ namespace Discord | |||
| RequireColons = requireColons; | |||
| RoleIds = roleIds; | |||
| } | |||
| internal static Emoji Create(Model model) | |||
| internal static GuildEmoji Create(Model model) | |||
| { | |||
| return new Emoji(model.Id, model.Name, model.Managed, model.RequireColons, ImmutableArray.Create(model.Roles)); | |||
| return new GuildEmoji(model.Id, model.Name, model.Managed, model.RequireColons, ImmutableArray.Create(model.Roles)); | |||
| } | |||
| public override string ToString() => Name; | |||
| @@ -46,7 +46,7 @@ namespace Discord | |||
| /// <summary> Gets the built-in role containing all users in this guild. </summary> | |||
| IRole EveryoneRole { get; } | |||
| /// <summary> Gets a collection of all custom emojis for this guild. </summary> | |||
| IReadOnlyCollection<Emoji> Emojis { get; } | |||
| IReadOnlyCollection<GuildEmoji> Emojis { get; } | |||
| /// <summary> Gets a collection of all extra features added to this guild. </summary> | |||
| IReadOnlyCollection<string> Features { get; } | |||
| /// <summary> Gets a collection of all roles in this guild. </summary> | |||
| @@ -13,7 +13,7 @@ namespace Discord.Rest | |||
| public class RestGuild : RestEntity<ulong>, IGuild, IUpdateable | |||
| { | |||
| private ImmutableDictionary<ulong, RestRole> _roles; | |||
| private ImmutableArray<Emoji> _emojis; | |||
| private ImmutableArray<GuildEmoji> _emojis; | |||
| private ImmutableArray<string> _features; | |||
| public string Name { get; private set; } | |||
| @@ -37,7 +37,7 @@ namespace Discord.Rest | |||
| public RestRole EveryoneRole => GetRole(Id); | |||
| public IReadOnlyCollection<RestRole> Roles => _roles.ToReadOnlyCollection(); | |||
| public IReadOnlyCollection<Emoji> Emojis => _emojis; | |||
| public IReadOnlyCollection<GuildEmoji> Emojis => _emojis; | |||
| public IReadOnlyCollection<string> Features => _features; | |||
| internal RestGuild(BaseDiscordClient client, ulong id) | |||
| @@ -67,13 +67,13 @@ namespace Discord.Rest | |||
| if (model.Emojis != null) | |||
| { | |||
| var emojis = ImmutableArray.CreateBuilder<Emoji>(model.Emojis.Length); | |||
| var emojis = ImmutableArray.CreateBuilder<GuildEmoji>(model.Emojis.Length); | |||
| for (int i = 0; i < model.Emojis.Length; i++) | |||
| emojis.Add(Emoji.Create(model.Emojis[i])); | |||
| emojis.Add(GuildEmoji.Create(model.Emojis[i])); | |||
| _emojis = emojis.ToImmutableArray(); | |||
| } | |||
| else | |||
| _emojis = ImmutableArray.Create<Emoji>(); | |||
| _emojis = ImmutableArray.Create<GuildEmoji>(); | |||
| if (model.Features != null) | |||
| _features = model.Features.ToImmutableArray(); | |||
| @@ -30,7 +30,7 @@ namespace Discord.WebSocket | |||
| private ConcurrentDictionary<ulong, SocketGuildUser> _members; | |||
| private ConcurrentDictionary<ulong, SocketRole> _roles; | |||
| private ConcurrentDictionary<ulong, SocketVoiceState> _voiceStates; | |||
| private ImmutableArray<Emoji> _emojis; | |||
| private ImmutableArray<GuildEmoji> _emojis; | |||
| private ImmutableArray<string> _features; | |||
| internal bool _available; | |||
| @@ -69,7 +69,7 @@ namespace Discord.WebSocket | |||
| return channels.Select(x => state.GetChannel(x) as SocketGuildChannel).Where(x => x != null).ToReadOnlyCollection(channels); | |||
| } | |||
| } | |||
| public IReadOnlyCollection<Emoji> Emojis => _emojis; | |||
| public IReadOnlyCollection<GuildEmoji> Emojis => _emojis; | |||
| public IReadOnlyCollection<string> Features => _features; | |||
| public IReadOnlyCollection<SocketGuildUser> Users => _members.ToReadOnlyCollection(); | |||
| public IReadOnlyCollection<SocketRole> Roles => _roles.ToReadOnlyCollection(); | |||
| @@ -79,7 +79,7 @@ namespace Discord.WebSocket | |||
| : base(client, id) | |||
| { | |||
| _audioLock = new SemaphoreSlim(1, 1); | |||
| _emojis = ImmutableArray.Create<Emoji>(); | |||
| _emojis = ImmutableArray.Create<GuildEmoji>(); | |||
| _features = ImmutableArray.Create<string>(); | |||
| } | |||
| internal static SocketGuild Create(DiscordSocketClient discord, ClientState state, ExtendedModel model) | |||
| @@ -179,13 +179,13 @@ namespace Discord.WebSocket | |||
| if (model.Emojis != null) | |||
| { | |||
| var emojis = ImmutableArray.CreateBuilder<Emoji>(model.Emojis.Length); | |||
| var emojis = ImmutableArray.CreateBuilder<GuildEmoji>(model.Emojis.Length); | |||
| for (int i = 0; i < model.Emojis.Length; i++) | |||
| emojis.Add(Emoji.Create(model.Emojis[i])); | |||
| emojis.Add(GuildEmoji.Create(model.Emojis[i])); | |||
| _emojis = emojis.ToImmutable(); | |||
| } | |||
| else | |||
| _emojis = ImmutableArray.Create<Emoji>(); | |||
| _emojis = ImmutableArray.Create<GuildEmoji>(); | |||
| if (model.Features != null) | |||
| _features = model.Features.ToImmutableArray(); | |||
| @@ -232,9 +232,9 @@ namespace Discord.WebSocket | |||
| internal void Update(ClientState state, EmojiUpdateModel model) | |||
| { | |||
| var emojis = ImmutableArray.CreateBuilder<Emoji>(model.Emojis.Length); | |||
| var emojis = ImmutableArray.CreateBuilder<GuildEmoji>(model.Emojis.Length); | |||
| for (int i = 0; i < model.Emojis.Length; i++) | |||
| emojis.Add(Emoji.Create(model.Emojis[i])); | |||
| emojis.Add(GuildEmoji.Create(model.Emojis[i])); | |||
| _emojis = emojis.ToImmutable(); | |||
| } | |||