Browse Source

Renamed Emoji -> GuildEmoji

tags/1.0-rc
RogueException 8 years ago
parent
commit
5415b8f8f6
4 changed files with 18 additions and 18 deletions
  1. +4
    -4
      src/Discord.Net.Core/Entities/Guilds/GuildEmoji.cs
  2. +1
    -1
      src/Discord.Net.Core/Entities/Guilds/IGuild.cs
  3. +5
    -5
      src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs
  4. +8
    -8
      src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs

src/Discord.Net.Core/Entities/Guilds/Emoji.cs → src/Discord.Net.Core/Entities/Guilds/GuildEmoji.cs View File

@@ -6,7 +6,7 @@ using Model = Discord.API.Emoji;
namespace Discord namespace Discord
{ {
[DebuggerDisplay(@"{DebuggerDisplay,nq}")] [DebuggerDisplay(@"{DebuggerDisplay,nq}")]
public struct Emoji
public struct GuildEmoji
{ {
public ulong Id { get; } public ulong Id { get; }
public string Name { get; } public string Name { get; }
@@ -14,7 +14,7 @@ namespace Discord
public bool RequireColons { get; } public bool RequireColons { get; }
public IReadOnlyList<ulong> RoleIds { 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; Id = id;
Name = name; Name = name;
@@ -22,9 +22,9 @@ namespace Discord
RequireColons = requireColons; RequireColons = requireColons;
RoleIds = roleIds; 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; public override string ToString() => Name;

+ 1
- 1
src/Discord.Net.Core/Entities/Guilds/IGuild.cs View File

@@ -46,7 +46,7 @@ namespace Discord
/// <summary> Gets the built-in role containing all users in this guild. </summary> /// <summary> Gets the built-in role containing all users in this guild. </summary>
IRole EveryoneRole { get; } IRole EveryoneRole { get; }
/// <summary> Gets a collection of all custom emojis for this guild. </summary> /// <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> /// <summary> Gets a collection of all extra features added to this guild. </summary>
IReadOnlyCollection<string> Features { get; } IReadOnlyCollection<string> Features { get; }
/// <summary> Gets a collection of all roles in this guild. </summary> /// <summary> Gets a collection of all roles in this guild. </summary>


+ 5
- 5
src/Discord.Net.Rest/Entities/Guilds/RestGuild.cs View File

@@ -13,7 +13,7 @@ namespace Discord.Rest
public class RestGuild : RestEntity<ulong>, IGuild, IUpdateable public class RestGuild : RestEntity<ulong>, IGuild, IUpdateable
{ {
private ImmutableDictionary<ulong, RestRole> _roles; private ImmutableDictionary<ulong, RestRole> _roles;
private ImmutableArray<Emoji> _emojis;
private ImmutableArray<GuildEmoji> _emojis;
private ImmutableArray<string> _features; private ImmutableArray<string> _features;


public string Name { get; private set; } public string Name { get; private set; }
@@ -37,7 +37,7 @@ namespace Discord.Rest


public RestRole EveryoneRole => GetRole(Id); public RestRole EveryoneRole => GetRole(Id);
public IReadOnlyCollection<RestRole> Roles => _roles.ToReadOnlyCollection(); public IReadOnlyCollection<RestRole> Roles => _roles.ToReadOnlyCollection();
public IReadOnlyCollection<Emoji> Emojis => _emojis;
public IReadOnlyCollection<GuildEmoji> Emojis => _emojis;
public IReadOnlyCollection<string> Features => _features; public IReadOnlyCollection<string> Features => _features;


internal RestGuild(BaseDiscordClient client, ulong id) internal RestGuild(BaseDiscordClient client, ulong id)
@@ -67,13 +67,13 @@ namespace Discord.Rest


if (model.Emojis != null) 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++) 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(); _emojis = emojis.ToImmutableArray();
} }
else else
_emojis = ImmutableArray.Create<Emoji>();
_emojis = ImmutableArray.Create<GuildEmoji>();


if (model.Features != null) if (model.Features != null)
_features = model.Features.ToImmutableArray(); _features = model.Features.ToImmutableArray();


+ 8
- 8
src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs View File

@@ -30,7 +30,7 @@ namespace Discord.WebSocket
private ConcurrentDictionary<ulong, SocketGuildUser> _members; private ConcurrentDictionary<ulong, SocketGuildUser> _members;
private ConcurrentDictionary<ulong, SocketRole> _roles; private ConcurrentDictionary<ulong, SocketRole> _roles;
private ConcurrentDictionary<ulong, SocketVoiceState> _voiceStates; private ConcurrentDictionary<ulong, SocketVoiceState> _voiceStates;
private ImmutableArray<Emoji> _emojis;
private ImmutableArray<GuildEmoji> _emojis;
private ImmutableArray<string> _features; private ImmutableArray<string> _features;
internal bool _available; 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); 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<string> Features => _features;
public IReadOnlyCollection<SocketGuildUser> Users => _members.ToReadOnlyCollection(); public IReadOnlyCollection<SocketGuildUser> Users => _members.ToReadOnlyCollection();
public IReadOnlyCollection<SocketRole> Roles => _roles.ToReadOnlyCollection(); public IReadOnlyCollection<SocketRole> Roles => _roles.ToReadOnlyCollection();
@@ -79,7 +79,7 @@ namespace Discord.WebSocket
: base(client, id) : base(client, id)
{ {
_audioLock = new SemaphoreSlim(1, 1); _audioLock = new SemaphoreSlim(1, 1);
_emojis = ImmutableArray.Create<Emoji>();
_emojis = ImmutableArray.Create<GuildEmoji>();
_features = ImmutableArray.Create<string>(); _features = ImmutableArray.Create<string>();
} }
internal static SocketGuild Create(DiscordSocketClient discord, ClientState state, ExtendedModel model) internal static SocketGuild Create(DiscordSocketClient discord, ClientState state, ExtendedModel model)
@@ -179,13 +179,13 @@ namespace Discord.WebSocket


if (model.Emojis != null) 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++) 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(); _emojis = emojis.ToImmutable();
} }
else else
_emojis = ImmutableArray.Create<Emoji>();
_emojis = ImmutableArray.Create<GuildEmoji>();


if (model.Features != null) if (model.Features != null)
_features = model.Features.ToImmutableArray(); _features = model.Features.ToImmutableArray();
@@ -232,9 +232,9 @@ namespace Discord.WebSocket


internal void Update(ClientState state, EmojiUpdateModel model) 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++) 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(); _emojis = emojis.ToImmutable();
} }




Loading…
Cancel
Save