My code:
const Discord = require("discord.js");
module.exports.run = async (bot, message, args) => {
const amount = args[0]
if (!amount) return message.reply('Must specify an amount to delete!');
message.channel.fetchMessages({
limit: amount,
}).then((messages) => {
message.delete(messages).catch(error => console.log(error.stack));
});
message.delete().catch(O_o => { });
}
module.exports.help = {
name: "clear"
}
Problem: I'm running the bot on my account and trying to make it delete messages on a command execution. Errors: DiscordAPIError: Unknown Message at item.request.gen.end (C:\Users\brian\node_modules\discord.js\src\client\rest\RequestHandlers\Sequential.js:79:15) at then (C:\Users\brian\node_modules\snekfetch\src\index.js:215:21) at process._tickCallback (internal/process/next_tick.js:68:7)