Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

310
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda