예제 #1
0
        /// <summary>
        /// Parses the emoji in either the guild emote format or in unicode. Named emojis are not supported here.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="emojiText">Raw emoji in either guild emote format (&lt;:name:id&gt;) or in unicode.</param>
        public static DiscordEmoji?Parse(DiscordClient client, string emojiText)
        {
            var match = GuildEmoteRegex.Match(emojiText);

            if (match.Success)
            {
                return(ParseGuildEmote(client, match));
            }

            if (!DiscordEmoji.IsValidUnicode(emojiText))
            {
                return(null);
            }

            return(DiscordEmoji.FromUnicode(client, emojiText));
        }