I have a command that clears a set amount of messages that works fine right now, but I'm trying to have the bot send a message to a log channel that tells the mods and admin, how many messages were deleted and who deleted them. This is all the code right now from the clear file:
module.exports = {
name: 'clear',
description: "clears messages",
async execute(message, args){
if(message.member.roles.cache.has('802911784892760074')){//If mod
if(!args[0]) return message.reply('Enter amount');
if(isNaN(args[0])) return message.reply('Enter amount');
if(args[0] > 100) return message.reply('To high');
if(args[0] < 1) return message.reply('To low');
await message.channel.messages.fetch({limit: args[0]}).then(messages =>{
message.channel.bulkDelete(messages);
client.channels.cache.get('799292569825443860').send(`${message.author} has cleared ${args} messages!`)
});
}
}
This is the line of code that does not seem to be working:
client.channels.cache.get('799292569825443860').send(`${message.author} has cleared ${args} messages!`)
The command prompt says that the client is not defined, but I have the clientdefined in the main js file.
const client = new Discord.Client();
I'm still pretty new to this, and I may just be missing something very basic. (and I'm sorry if this question comes off as stupid to those who understand) any help would be awesome, as I seem to be at a roadblock here.