I don't know what the problem is, I always get an error message when I execute the command: TypeError: Cannot read property 'bulkDelete' of undefined
module.exports = { name: 'clear', async execute(message, args) { if (!args[0]) return message.channel.send("-") if (isNaN(args[0])) return message.channel.send("-") if (args[0] > 100) return message.channel.send("-") if (args[0] < 1) return message.channel.send await message.channel.messages.fetch({Limit: args[0]}).then(message =>{ message.channel.bulkDelete(messages); }); } }
Regardless of what bulkDelete is try to check if it exists like:
bulkDelete
if (message?.channel?.bulkDelete) { message.channel.bulkDelete(); }
2.1m questions
2.1m answers
60 comments
57.0k users