0

and I've just updated to ver 14.6.0 of discord.js and non of my cmds are working why is that my code always worked before hand? example of my code here ->

    if (message.content.startsWith('L!poke')) {
        let targetMember = message.mentions.members.first();
        if (!targetMember) return message.reply('you need to tag a user in order to poke them!!'); 
        // message goes below!
        const num = (Math.floor(Math.random()* 6)+1).toString();
        message.channel.send({files: [`./poke/poke${num}.gif`]})
        //message.channel.send({files:["./nom/"]})
        message.channel.send(` ${targetMember.user},your you getting poked!!! -_-`);
        //let embed = new Discord.RichEmbed()
        //embed.setImage('https://cdn.discordapp.com/attachments/541152846540701706/653867448553963550/fm49srQ.gif')
        //message.channel.send(embed);
FBILOLIGIRL
  • 69
  • 2
  • 3
  • 12
  • Does this answer your question? [message.content doesn't have any value in Discord.js v14](https://stackoverflow.com/questions/73036854/message-content-doesnt-have-any-value-in-discord-js-v14) – Zsolt Meszaros Oct 17 '22 at 06:30

1 Answers1

1

You need additional intent flag in order to read content of the messages.

const { Client, GatewayIntentBits } = require("discord.js");

const client = new Client({
  intents: [
    // This will give you events about messages
    GatewayIntentBits.GuildMessages,

    // And this is flag you're probably missing:
    GatewayIntentBits.MessageContent,
  ]
});

Also, don't forget that this intent should be enabled on Discord Developers Portal for your bot.

koloml
  • 525
  • 2
  • 15