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(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
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs•2y ago
The message and interaction events were renamed to messageCreate and interactionCreate respectively, to bring the library in line with Discord's naming conventions.
- client.on('message', message => { ... });
+ client.on('messageCreate', message => { ... });
- client.on('interaction', interaction => { ... });
+ client.on('interactionCreate', interaction => { ... });
- client.on('message', message => { ... });
+ client.on('messageCreate', message => { ... });
- client.on('interaction', interaction => { ... });
+ client.on('interactionCreate', interaction => { ... });
Aram
Aram•2y ago
i edited it and it still doesnt react, sadly
Dagan
Dagan•2y ago
and could you send the new code
Aram
Aram•2y ago
Thanks for wanting to help, but another person from another discord server helped me, and it works now😃