Files
emot_man/commands/emotes/list.js
2023-11-05 20:28:44 -05:00

28 lines
881 B
JavaScript

const { SlashCommandBuilder } = require("discord.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("listemotes")
.setDescription("Lists all emotes in the server."),
async execute(interaction) {
await interaction.reply("Fetching emotes...");
let replyMessage = "";
interaction.guild.emojis.fetch()
.then(emojis => {
// we need to make followup messages if the list is too long
let emoteList = "";
emojis.forEach(emoji => {
emoteList += `${emoji} - ${emoji.name}\n`;
if (emoteList.length > 1900) {
interaction.followUp(emoteList);
emoteList = "";
}
});
if (emoteList.length > 0) {
interaction.followUp(emoteList);
}
interaction.followUp("Total emotes: " + emojis.size + "\n");
}).catch(console.error);
},
};