Esempio n. 1
0
 public static string GetUrl(this ICustomEmoji emoji)
 {
     return(string.Format(
                EMOJI_URL,
                emoji.Id,
                emoji.IsAnimated ? "gif" : "png"
                ));
 }
Esempio n. 2
0
        public int GetHashCode(ICustomEmoji obj)
        {
            if (obj == null)
            {
                throw new ArgumentNullException(nameof(obj));
            }

            return(obj.Id.GetHashCode());
        }
Esempio n. 3
0
        public static string GetUrl(this ICustomEmoji emoji, CdnAssetFormat format = default, int?size = null)
        {
            if (format == CdnAssetFormat.Automatic)
            {
                format = emoji.IsAnimated
                    ? CdnAssetFormat.Gif
                    : CdnAssetFormat.Png;
            }

            return(Discord.Cdn.GetCustomEmojiUrl(emoji.Id, format, size));
        }
Esempio n. 4
0
        public bool Equals(ICustomEmoji x, ICustomEmoji y)
        {
            if (x == null && y == null)
            {
                return(true);
            }

            if (x == null || y == null)
            {
                return(false);
            }

            return(x.Id == y.Id);
        }
Esempio n. 5
0
 public bool Equals(ICustomEmoji other)
 => Comparers.Emoji.Equals(this, other);
Esempio n. 6
0
 public async ValueTask AddEmoteAsync(ICustomEmoji emoji)
 => await AddEmoteAsync(emoji.Name, Discord.Cdn.GetCustomEmojiUrl(emoji.Id, emoji.IsAnimated, 128));
Esempio n. 7
0
 public async ValueTask AddEmoteAsync([Regex(Global.EmoteNameRegex)] string name, ICustomEmoji emoji)
 => await AddEmoteAsync(name, Discord.Cdn.GetCustomEmojiUrl(emoji.Id, emoji.IsAnimated, 128));