29 lines
1,022 B
JavaScript
29 lines
1,022 B
JavaScript
const { SlashCommandBuilder } = require('discord.js');
|
|
|
|
const informationStatus = "[INFO]: ";
|
|
const warningStatus = "[WARNING]: ";
|
|
const errorStatus = "[ERROR]: ";
|
|
|
|
module.exports = {
|
|
data: new SlashCommandBuilder()
|
|
.setName('clear')
|
|
.setDescription('Clears a certain amount of text!')
|
|
.addNumberOption(option =>
|
|
option.setName('amount')
|
|
.setDescription('Set the amount to clear!')
|
|
.setRequired(true)),
|
|
async execute(interaction) {
|
|
const amount = interaction.options.getNumber('amount');
|
|
|
|
if(amount == isNaN() && amount <= 0) return interaction.channel.message('<:xmark:1238738768563933244> This is not a valid number!');
|
|
|
|
try {
|
|
await interaction.channel.bulkDelete(amount);
|
|
interaction.channel.send(`<:checkmark:1238736677942460438> Deleted ${amount} of messages!`);
|
|
} catch (error) {
|
|
console.log(errorStatus + "Something went wrong while trying to clear messages! Debug information is below.");
|
|
console.error(error);
|
|
}
|
|
}
|
|
}
|