GamingWithJohn
DIAdiscord.js - Imagine an app
•Created by GamingWithJohn on 4/1/2024 in #djs-questions
12.5.3 Command not working
Heres my code, any idea why its not working?
const Discord = require('discord.js');
const client = new Discord.Client();
const prefix = '!';
client.once('ready', () => {
console.log('VividMC Bot is online!');
});
client.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'){ message.channel.send('pong!'); } }); client.login('Token goes here');
const args = message.content.slice(prefix.length).split(/ +/); const command = args.shift().toLowerCase();
if(command === 'ping'){ message.channel.send('pong!'); } }); client.login('Token goes here');
4 replies