Hello, I created A discord bot everything is working fine, the bot is online
but doesn’t respond to command his prefix is ‘C!’. the command is
‘C!ping’ and he should respond with ‘pong!’ but he doesn’t. I am using node.js
The code:
const Discord = require(‘discord.js’);
const client = new Discord.Client();
const prefix = ‘C!’;
client.once(‘ready’, () => {
console.log(‘Chill Lounge is online!!’);
});
client.on(‘message’, message => {
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = message.content.split(prefix.length).split(/ +/);
const command = args.shift().toLowerCase();
if(command === ‘ping’){
message.channel.send('pong!');
}
});
client.login(‘MY TOKEN’);