Browse Source

Add the CreatorId property to GuildEmote implementation

pull/1214/head
Chris Johnston 6 years ago
parent
commit
9442e4e635
2 changed files with 11 additions and 3 deletions
  1. +9
    -1
      src/Discord.Net.Core/Entities/Emotes/GuildEmote.cs
  2. +2
    -2
      src/Discord.Net.Rest/Extensions/EntityExtensions.cs

+ 9
- 1
src/Discord.Net.Core/Entities/Emotes/GuildEmote.cs View File

@@ -30,12 +30,20 @@ namespace Discord
/// A read-only list containing snowflake identifiers for roles that are allowed to use this emoji.
/// </returns>
public IReadOnlyList<ulong> RoleIds { get; }
/// <summary>
/// Gets the user Id that created this emoji.
/// </summary>
/// <returns>
/// A User Id who created this emoji, which may be null.
/// </returns>
public ulong? CreatorId { get; }

internal GuildEmote(ulong id, string name, bool animated, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds) : base(id, name, animated)
internal GuildEmote(ulong id, string name, bool animated, bool isManaged, bool requireColons, IReadOnlyList<ulong> roleIds, ulong? userId) : base(id, name, animated)
{
IsManaged = isManaged;
RequireColons = requireColons;
RoleIds = roleIds;
CreatorId = userId;
}

private string DebuggerDisplay => $"{Name} ({Id})";


+ 2
- 2
src/Discord.Net.Rest/Extensions/EntityExtensions.cs View File

@@ -1,4 +1,4 @@
using System.Collections.Immutable;
using System.Collections.Immutable;
using System.Linq;

namespace Discord.Rest
@@ -7,7 +7,7 @@ namespace Discord.Rest
{
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));
return 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)


Loading…
Cancel
Save