That's my code
const { SlashCommandBuilder } = require('@discordjs/builders');
const { Permissions } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('clear')
.setDescription('Deletes shit')
.addNumberOption(option => option.setName('amount')
.setDescription('amount to clear')
.setRequired(true)),
permissions: [Permissions.FLAGS.MANAGE_MESSAGES],
async execute(interaction) {
const amount = interaction.options.getNumber('amount');
interaction.channel.bulkDelete(amount, true);
await interaction.reply(`Удалено ${amount} сообщение(сообщений)`);
},
}
When I try to delete something my bot writes that he deleted null messages and deletes 50 messages. And if I enter 2, he deletes 100 messages. Please, help!
I've found solution. I needed to just restart deploy-commands.js file. System just didn't notice my IntegerOption. I restarted deploy-commands.js and all is working now.