29 lines
888 B
JavaScript
29 lines
888 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);
|
|
},
|
|
};
|