feat: now compatible with kubernetes and docker :3
This commit is contained in:
29
bot/commands/emotes/rm.js
Normal file
29
bot/commands/emotes/rm.js
Normal file
@@ -0,0 +1,29 @@
|
||||
const { SlashCommandBuilder } = require("discord.js");
|
||||
|
||||
module.exports = {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName("rm")
|
||||
.setDescription("Removes emotes from the server.")
|
||||
.addStringOption(option =>
|
||||
option.setName("emotes")
|
||||
.setDescription("Emotes to remove.")
|
||||
.setRequired(true)),
|
||||
async execute(interaction) {
|
||||
await interaction.reply("Removing emotes...");
|
||||
// find every emote in the message and remove them
|
||||
let emoteList = interaction.options.getString("emotes");
|
||||
let emoteIdRegex = /<(?<animated>a?):(?<name>\w{0,22})\w*:(?<id>\d+)>/gm;
|
||||
let replyMessage = "";
|
||||
for (const match of emoteList.matchAll(emoteIdRegex)) {
|
||||
let emote = interaction.guild.emojis.cache.find(emoji => emoji.id === match.groups.id);
|
||||
if (emote) {
|
||||
await emote.delete();
|
||||
replyMessage += `Removed ${match[0]}!\n`;
|
||||
} else {
|
||||
replyMessage += `Could not find ${match[0]}!\n`;
|
||||
}
|
||||
interaction.editReply(replyMessage);
|
||||
replyMessage = "";
|
||||
}
|
||||
},
|
||||
};
|
Reference in New Issue
Block a user