mirror of
https://github.com/Mestima/luna.git
synced 2025-05-06 06:00:14 +00:00
added clear admin command
This commit is contained in:
parent
c2785eab8c
commit
a980822345
26
src/commands/clear/index.js
Normal file
26
src/commands/clear/index.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import { SlashCommandBuilder, EmbedBuilder, PermissionsBitField } from 'discord.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: new SlashCommandBuilder()
|
||||||
|
.setName('clear')
|
||||||
|
.setDescription('Deletes chosen amount of messages')
|
||||||
|
.addIntegerOption((option) => {
|
||||||
|
option.setName('amount')
|
||||||
|
.setDescription('amount of messages to delete')
|
||||||
|
.setMinValue(1)
|
||||||
|
.setMaxValue(25)
|
||||||
|
.setRequired(true);
|
||||||
|
return option;
|
||||||
|
})
|
||||||
|
.setDMPermission(false)
|
||||||
|
.setDefaultMemberPermissions(PermissionsBitField.Flags['Administrator']),
|
||||||
|
async execute(interaction, api) {
|
||||||
|
const amount = interaction.options.getInteger('amount');
|
||||||
|
await interaction.channel.bulkDelete(amount);
|
||||||
|
|
||||||
|
const embed = new EmbedBuilder()
|
||||||
|
.setTitle(`Deleted ${amount} messages in total`)
|
||||||
|
.setColor(interaction.member.displayColor);
|
||||||
|
await interaction.reply({ embeds: [ embed ] });
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user