This snippet shows an example of how you can create emojis via your bot in your server. The command to trigger the code is set to !emoji. There is a preset emoji in there that I added and the bot will create the emoji in your server then will send a followup message that includes the emoji inside of it!
const lib = require('lib')({token: process.env.STDLIB_SECRET_TOKEN});
//To add your own emoji link DO NOT JUST SEND THE EMOJI THE COPY LINK
//You want to save the image for the emoji, then upload that to discord
//Now that the file is in discord copy the link and paste on line 9
let fileRequest = await lib.http.request['@1.1.5']({
method: 'GET',
url: 'https://cdn.discordapp.com/attachments/931429162659495987/941894200293752892/937267129059770388.gif', //<-- Emoji link
});
let file = fileRequest.body;
//If you add a variable before the API request you can get info from the request like the emoji name, ID, etc!
let emoji = await lib.discord.guilds['@0.2.2'].emojis.create({
guild_id: `${context.params.event.guild_id}`,
name: `beats`, //<-- Emoji name
image: file,
});
await lib.discord.channels['@0.3.0'].messages.create({
channel_id: `${context.params.event.channel_id}`,
content: `Created the emoji! `,
message_reference: {message_id: `${context.params.event.id}`}
});