command discord js code example

Example 1: If statement discord js

<client>.on('message', message => {
	if (message.content === '!ping') {
		message.channel.send('Pong.');
	} else if (message.content.startsWith('beep')) {
		message.channel.send('Boop.');
    }
});
// The client is the bot itself. 
// You would have defined this at the top of your index.js/app.js
// It would look like 'const client = new Discord.Client()'
// Put that in place for '<client>' and remove the <>

Example 2: commands discord.js

bot.on('message', function(message) {
    if(message.author.bot) return;
    if(message.content === '/lvl') {
        message.channel.send("lvl system.")
    }
});