I am facing an error when I attempt to launch my Discord bot. The error message is as follows:
throw new DiscordjsRangeError(ErrorCodes.BitFieldInvalid, bit);
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.
Here is the relevant portion of my code:
const Discord = require('discord.js');
const { Client, GatewayIntentBits } = require('discord.js');
const ytdl = require('ytdl-core');
const ffmpeg = require('fluent-ffmpeg');
const botClient = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.VoiceStates,
],
});
It seems that the inclusion of GatewayIntentBits.VoiceStates
is causing this issue, but I can’t figure out why it is occurring. Does anyone have insights or solutions? My goal is to create a music bot with warning capabilities.