0
votes

I have

const fs = require('fs');

client.commands = new Discord.Collection();

const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js')); for(const file of commandFiles){ const command = require(./commands/${file});

client.commands.set(command.name, command);

}

cleint.once('ready', () => { console.log('KindnessBot is online!'); cleint.user.setActivity('Use !help for a list of commands, made by Keaton8legs', { type: 'WATCHING' }).catch(console.error); });

cleint.on('message', message =>{ if(!message.content.startsWith(prefix) || message.author.bot) return;

const args = message.content.slice(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();

if(command === 'ping'){
    client.commands.get('ping').execute(message, args);

and i also have

module.export = { name: 'ping', description: "this is a ping command!", execute(message, args){ message.channel.send('pong!');
} }

1
Please take the time needed to learn how to format your question properly. That will make it more likely to get an answer.PaulH

1 Answers

1
votes

client isn't defined, you need to define it as an instance of Discord.Client, like:

const Discord = require('discord.js');
const client = new Discord.Client();