diff --git a/src/Discord.Net.Core/Entities/Emotes/GuildEmote.cs b/src/Discord.Net.Core/Entities/Emotes/GuildEmote.cs index 9affb1e89..1c5b3af9e 100644 --- a/src/Discord.Net.Core/Entities/Emotes/GuildEmote.cs +++ b/src/Discord.Net.Core/Entities/Emotes/GuildEmote.cs @@ -30,12 +30,20 @@ namespace Discord /// A read-only list containing snowflake identifiers for roles that are allowed to use this emoji. /// public IReadOnlyList RoleIds { get; } + /// + /// Gets the user Id that created this emoji. + /// + /// + /// A user Id of the user who created this emoji, which may be null. A null value only indicates that the creator was not supplied as part of the API response. + /// + public ulong? CreatorId { get; } - internal GuildEmote(ulong id, string name, bool animated, bool isManaged, bool requireColons, IReadOnlyList roleIds) : base(id, name, animated) + internal GuildEmote(ulong id, string name, bool animated, bool isManaged, bool requireColons, IReadOnlyList roleIds, ulong? userId) : base(id, name, animated) { IsManaged = isManaged; RequireColons = requireColons; RoleIds = roleIds; + CreatorId = userId; } private string DebuggerDisplay => $"{Name} ({Id})"; diff --git a/src/Discord.Net.Rest/API/Common/Emoji.cs b/src/Discord.Net.Rest/API/Common/Emoji.cs index 2bdfdcc36..945cc6d7e 100644 --- a/src/Discord.Net.Rest/API/Common/Emoji.cs +++ b/src/Discord.Net.Rest/API/Common/Emoji.cs @@ -1,4 +1,4 @@ -#pragma warning disable CS1591 +#pragma warning disable CS1591 using Newtonsoft.Json; namespace Discord.API @@ -17,5 +17,7 @@ namespace Discord.API public bool RequireColons { get; set; } [JsonProperty("managed")] public bool Managed { get; set; } + [JsonProperty("user")] + public Optional User { get; set; } } } diff --git a/src/Discord.Net.Rest/Extensions/EntityExtensions.cs b/src/Discord.Net.Rest/Extensions/EntityExtensions.cs index 74b05dacd..4d164df96 100644 --- a/src/Discord.Net.Rest/Extensions/EntityExtensions.cs +++ b/src/Discord.Net.Rest/Extensions/EntityExtensions.cs @@ -1,4 +1,4 @@ -using System.Collections.Immutable; +using System.Collections.Immutable; using System.Linq; namespace Discord.Rest @@ -6,9 +6,13 @@ namespace Discord.Rest internal static class EntityExtensions { public static GuildEmote ToEntity(this API.Emoji model) - { - return new GuildEmote(model.Id.Value, model.Name, model.Animated.GetValueOrDefault(), model.Managed, model.RequireColons, ImmutableArray.Create(model.Roles)); - } + => new GuildEmote(model.Id.Value, + model.Name, + model.Animated.GetValueOrDefault(), + model.Managed, + model.RequireColons, + ImmutableArray.Create(model.Roles), + model.User.IsSpecified ? model.User.Value.Id : (ulong?)null); public static Embed ToEntity(this API.Embed model) {