Code for a slash command that sends a message to the channel with a large image of the emoji. This only works for custom emojis. Your slash command needs one 'string' option to function.
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
// Get the custom emoji from the first command option
const emoji = context.params.event.data.options[0].value;
// Is it a custom emoji?
const emojiParts = emoji.split(':');
const isCustomEmoji = emojiParts.length === 3;
if (isCustomEmoji) {
// Get the custom emoji ID
const emojiId = emojiParts[2].slice(0, -1);
// Send the embed!
await lib.discord.channels['@0.1.2'].messages.create({
channel_id: context.params.event.channel_id,
content: ``,
embed: {
title: 'Large emoji viewer',
image: {
url: `https://cdn.discordapp.com/emojis/${emojiId}.png`,
},
},
});
} else {
await lib.discord.channels['@0.1.2'].messages.create({
channel_id: context.params.event.channel_id,
content: `Standard emojis like ${emoji} aren't supported. Please use a custom one.`,
});
}