Better implementation of .se
This commit is contained in:
parent
ae90282070
commit
88eabf6d90
@ -290,14 +290,12 @@ namespace NadekoBot.Modules.Utility
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Regex emojiFinder { get; } = new Regex(@"<:(?<name>.+?):(?<id>\d*)>", RegexOptions.Compiled);
|
|
||||||
[NadekoCommand, Usage, Description, Aliases]
|
[NadekoCommand, Usage, Description, Aliases]
|
||||||
public async Task Showemojis([Remainder] string emojis)
|
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<Match>()
|
var result = string.Join("\n", tags.Select(m => $"**Name:** {m} **Link:** {m.Url}"));
|
||||||
.Select(m => $"**Name:** {m.Groups["name"]} **Link:** http://discordapp.com/api/emojis/{m.Groups["id"]}.png"));
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(result))
|
if (string.IsNullOrWhiteSpace(result))
|
||||||
await Context.Channel.SendErrorAsync("No special emojis found.");
|
await Context.Channel.SendErrorAsync("No special emojis found.");
|
||||||
|
Loading…
Reference in New Issue
Block a user