Discord Bot doesn't react back.
if i type, .ping or ping, the bot doesnt react with pong!
const { Client, Events, GatewayIntentBits } = require('discord.js');
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
],
});
const { token } = require('./config.json');
client.once(Events.ClientReady, c => {
console.log(
const args = messsage.content.slice(prefix.length).split(/ +/); const command = args.shift().toLowerCase();
if (command === 'ping'){ message.channel.send('pong!'); } });
Ready! Logged in as ${c.user.tag}
);
});
client.login('token');
const prefix = '.';
client.on('message', message =>{
if(!message.content.startsWith(prefix) || message.author.bot) return;
const args = messsage.content.slice(prefix.length).split(/ +/); const command = args.shift().toLowerCase();
if (command === 'ping'){ message.channel.send('pong!'); } });
5 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
The
message
and interaction
events were renamed to messageCreate
and interactionCreate
respectively, to bring the library in line with Discord's naming conventions.
i edited it and it still doesnt react, sadly
and could you send the new code
Thanks for wanting to help, but another person from another discord server helped me, and it works now😃