This snippet will help you save the emojis that you liked from other server into your server. Note that you must have nitro so that you can use other server's emoji. Use the command prefix together with the emojis separated by spaces. (eg. !emoji <emoji1> <emoji2>)
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
let emojis = context.params.event.content.split(' ').slice(1);
for (let emoji of emojis) {
try {
if (!emoji) continue;
let emojiName,
emojiUrl,
emojiID = emoji.match(/\d+/g)?.toString() || null,
ext = `png`;
if (emoji.startsWith(' {
return result.body;
});
await lib.discord.guilds['@0.2.4'].emojis.create({
guild_id: context.params.event.guild_id,
name: emojiName,
image: buffer,
});
}
} catch (e) {
await lib.discord.channels['@0.3.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `:x: Error uploading ${emoji} \nCause: ${e.message}`,
message_reference: {
message_id: context.params.event.id,
},
});
}
}
await lib.discord.channels['@0.3.2'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Emoji upload is completed!`,
message_reference: {
message_id: context.params.event.id,
},
});