module.exports = {
name: 'clear',
description: 'clear certain amount of messages',
async execute(message, args){
if(!args[0]) return message.reply("please enter the amount of messages");
if(isNaN(args[0])) return message.reply("please type a number");
if(args[0] > 100) return message.reply("you can not delete more than 100 messages at a time.")
if(args[0] < 1) return message.reply("Number has to be more than 1")
await message.channel.messages.fetch({limit: args[0]}).then(message =>{
message.channel.bulkDelete(messages);
});
}
}
Every time I run it, an error occurs:
Cannot read property 'bulkDelete' of undefined
i have no idea what i did wrong. I checked the code in the video as well as went on discord.js.org to see if they had a different solution. If anyone can help, I'll really appreciate it.