Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

308
Views
Discord.js bot getting a Bitfield Invalid error after changing intent

Had another post about my bot running in the terminal, but not posting a message in the discord channel. I changed the intents because I cam across a different question where someone needed to change the intents so that the bot would post in Discord.. After I made the change to intents I am now getting this error: RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined.

require('dotenv').config();
const { Client, Intents } = require('discord.js');
const client = new Client({ intents: [Intents.FLAGS.GUILD_MESSAGES, Intents.message, Intents.channel, Intents.reaction] });


client.on('ready', () => {
  console.log(`It's welcome time`);
});

client.on('message', msg => {
  if (msg.content === 'Hi') {
    msg.reply('Welcome wallet warrior!');
    msg.channel.send('Welcome wallet warrior!');

  }
  else {
    msg.channel.send('Hi, please introduce yourself')
  };

});

client.login(TOKEN);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It's because Intents.message Intents.channel Intents.reaction is undefined, or has no value.

The right Intents you probably need:

const { Client, Intents } = require('discord.js');
const client = new Client({
     intents: [
        Intents.FLAGS.GUILDS,
        Intents.FLAGS.GUILD_MESSAGES,
        Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
     ]
});

There is a discord.js official guide that might help you. Intents Calculator

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!