From 88eabf6d907dbb3e0ab40d067f7161f84db6efd7 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sat, 14 Jan 2017 23:23:11 +0100 Subject: [PATCH] Better implementation of .se --- src/NadekoBot/Modules/Utility/Utility.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Modules/Utility/Utility.cs b/src/NadekoBot/Modules/Utility/Utility.cs index 5ffae5fc..bc413919 100644 --- a/src/NadekoBot/Modules/Utility/Utility.cs +++ b/src/NadekoBot/Modules/Utility/Utility.cs @@ -290,14 +290,12 @@ namespace NadekoBot.Modules.Utility ); } - private Regex emojiFinder { get; } = new Regex(@"<:(?.+?):(?\d*)>", RegexOptions.Compiled); [NadekoCommand, Usage, Description, Aliases] public async Task Showemojis([Remainder] string emojis) { - var matches = emojiFinder.Matches(emojis); + var tags = Context.Message.Tags.Where(t => t.Type == TagType.Emoji).Select(t => (Emoji)t.Value); - var result = string.Join("\n", matches.Cast() - .Select(m => $"**Name:** {m.Groups["name"]} **Link:** http://discordapp.com/api/emojis/{m.Groups["id"]}.png")); + var result = string.Join("\n", tags.Select(m => $"**Name:** {m} **Link:** {m.Url}")); if (string.IsNullOrWhiteSpace(result)) await Context.Channel.SendErrorAsync("No special emojis found.");