feat: initial Papo bot scaffold
This commit is contained in:
22
src/commands/admin/clear.ts
Normal file
22
src/commands/admin/clear.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { SlashCommandBuilder, PermissionFlagsBits, ChatInputCommandInteraction } from 'discord.js';
|
||||
import { SlashCommand } from '../../utils/types.js';
|
||||
|
||||
const command: SlashCommand = {
|
||||
guildOnly: true,
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('clear')
|
||||
.setDescription('Löscht Nachrichten (max 100).')
|
||||
.addIntegerOption((opt) => opt.setName('amount').setDescription('Anzahl').setRequired(true))
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
|
||||
async execute(interaction: ChatInputCommandInteraction) {
|
||||
const amount = interaction.options.getInteger('amount', true);
|
||||
if (!interaction.channel || amount < 1 || amount > 100) {
|
||||
await interaction.reply({ content: 'Anzahl muss zwischen 1 und 100 liegen.', ephemeral: true });
|
||||
return;
|
||||
}
|
||||
const messages = await interaction.channel.bulkDelete(amount, true);
|
||||
await interaction.reply({ content: `Gelöschte Nachrichten: ${messages.size}`, ephemeral: true });
|
||||
}
|
||||
};
|
||||
|
||||
export default command;
|
||||
Reference in New Issue
Block a user