0

i'm following a tutorial in youtube (since i'm new to coding) and i'm practically coping to code in the video, but when i try to test the commands the bot doesn't send anything back, and i don't know if i misspelled something.

here's the code `

const Discord = require('discord.js');

const client = new Discord.Client({intents: 32767});

const prefix = '+';

client.once('ready', () => {
    console.log('Miccussi Activated');
});

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');
    }
});

`

i actually searched for an answer but i found people only talking about intents, i initially tried to change the prefix hoping that it was the problem but the bot just didin't respond

  • Can you console.log args and command and share it in your post? – Pompedup Nov 22 '22 at 18:04
  • Does this answer your question? [message.content doesn't have any value in Discord.js](https://stackoverflow.com/questions/73036854/message-content-doesnt-have-any-value-in-discord-js) – Jiralite Nov 22 '22 at 18:04
  • @Pompedup a bit field of 32767 does not include the `MESSAGE_CONTENT` intent. One more reason why magic numbers shouldn't be used. – Jiralite Nov 22 '22 at 18:05
  • @Jiralite hi! actually what u sended doesn't answer :s, it worked before with the "magical numbers", but now that i changed it to what the post says the console says that the intents are not defined, idk – RaBerry Nov 22 '22 at 19:02
  • It's only defined if you define it (in this case, you need to import them). This is very basic JavaScript. – Jiralite Nov 22 '22 at 19:47

0 Answers0