Skip to content

Commit

Permalink
Made IGuildEmoji.Creator optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
Quahu committed Jun 23, 2024
1 parent 49a8b81 commit beed8b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Disqord.Core/Entities/Core/Emoji/IGuildEmoji.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public interface IGuildEmoji : ICustomEmoji, IGuildEntity, IClientEntity, INamab
/// <summary>
/// Gets the user that created this emoji.
/// </summary>
IUser Creator { get; }
IUser? Creator { get; }

/// <summary>
/// Gets whether this emoji requires colons in chat.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Disqord.Models;
using Qommon;

namespace Disqord;

Expand All @@ -21,7 +22,7 @@ public class TransientGuildEmoji : TransientClientEntity<EmojiJsonModel>, IGuild
public IReadOnlyList<Snowflake> RoleIds => Model.Roles.Value;

/// <inheritdoc/>
public IUser Creator => _creator ??= new TransientUser(Client, Model.User.Value);
public IUser? Creator => _creator ??= Optional.ConvertOrDefault(Model.User, static (user, client) => new TransientUser(client, user), Client);

private IUser? _creator;

Expand Down

0 comments on commit beed8b3

Please sign in to comment.