if(!message.content.startWith(prefix) || message.author.bot) return;
^
The error that comes out is
ReferenceError: message is not defined
The code so far ( not including bot token)
const Discord = require(‘discord.js’);
const client = new Discord.Client();
const PREFIX = ‘,’;
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);
}
var version = ‘1.0.1’
client.once(‘ready’, () =>{
console.log(‘online!’)
})
client.on(‘message’, Message=>{
if(!message.content.startWith(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);
}
if(command === 'calc'){
client.commands.get('calc').execute(message, args);
}
});
client.login(BOT_TOKEN);