Problem with intents

Hello there. So, I just downloaded the new version of Discord.js, and I am surprised at how quickly I came across some errors. The first problem I came across was Intents.FLAGS being replaced. No problem there though, I quickly fixed that by replacing Intents.FLAGS with GatewayIntentBits. What is my problem? After doing that, it ended up giving me a RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined. error. Here are my intents:
const client = new DiscordJS.Client({
intents: [
GatewayIntentBits.GUILDS,
GatewayIntentBits.GUILD_MESSAGES,
GatewayIntentBits.GUILD_MEMBERS,
GatewayIntentBits.GUILD_BANS,
GatewayIntentBits.GUILD_EMOJIS_AND_STICKERS,
GatewayIntentBits.GUILD_INTEGRATIONS,
GatewayIntentBits.GUILD_WEBHOOKS,
GatewayIntentBits.GUILD_INVITES,
GatewayIntentBits.GUILD_VOICE_STATES,
GatewayIntentBits.GUILD_PRESENCES,
GatewayIntentBits.GUILD_MESSAGES,
GatewayIntentBits.GUILD_MESSAGE_REACTIONS,
GatewayIntentBits.GUILD_MESSAGE_TYPING,
GatewayIntentBits.DIRECT_MESSAGES,
GatewayIntentBits.DIRECT_MESSAGE_REACTIONS,
GatewayIntentBits.DIRECT_MESSAGE_TYPING,
GatewayIntentBits.GUILD_SCHEDULED_EVENTS
],
partials: [
"GUILD_MEMBER",
"MESSAGE",
"CHANNEL",
"GUILD_SCHEDULED_EVENT",
"REACTION",
"USER"
]
})
const client = new DiscordJS.Client({
intents: [
GatewayIntentBits.GUILDS,
GatewayIntentBits.GUILD_MESSAGES,
GatewayIntentBits.GUILD_MEMBERS,
GatewayIntentBits.GUILD_BANS,
GatewayIntentBits.GUILD_EMOJIS_AND_STICKERS,
GatewayIntentBits.GUILD_INTEGRATIONS,
GatewayIntentBits.GUILD_WEBHOOKS,
GatewayIntentBits.GUILD_INVITES,
GatewayIntentBits.GUILD_VOICE_STATES,
GatewayIntentBits.GUILD_PRESENCES,
GatewayIntentBits.GUILD_MESSAGES,
GatewayIntentBits.GUILD_MESSAGE_REACTIONS,
GatewayIntentBits.GUILD_MESSAGE_TYPING,
GatewayIntentBits.DIRECT_MESSAGES,
GatewayIntentBits.DIRECT_MESSAGE_REACTIONS,
GatewayIntentBits.DIRECT_MESSAGE_TYPING,
GatewayIntentBits.GUILD_SCHEDULED_EVENTS
],
partials: [
"GUILD_MEMBER",
"MESSAGE",
"CHANNEL",
"GUILD_SCHEDULED_EVENT",
"REACTION",
"USER"
]
})
If someone could help me, that would be awesome. Thank you for your time and help, it is truly appreciated. Full error stack:
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.
at Function.resolve (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:168:11)
at C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:163:54
at Array.map (<anonymous>)
at Function.resolve (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:163:40)
at new BitField (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:33:38)
at new IntentsBitField (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\IntentsBitField.js:9:1)
at Client._validateOptions (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\client\Client.js:482:25)
at new Client (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\client\Client.js:78:10)
at Object.<anonymous> (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\bot.js:24:16)
at Module._compile (node:internal/modules/cjs/loader:1105:14) {
code: 'BitFieldInvalid'
}
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.
at Function.resolve (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:168:11)
at C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:163:54
at Array.map (<anonymous>)
at Function.resolve (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:163:40)
at new BitField (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\BitField.js:33:38)
at new IntentsBitField (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\util\IntentsBitField.js:9:1)
at Client._validateOptions (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\client\Client.js:482:25)
at new Client (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\node_modules\discord.js\src\client\Client.js:78:10)
at Object.<anonymous> (C:\Users\Batman212369\Desktop\Discord Bots\Pin-Bot\bot.js:24:16)
at Module._compile (node:internal/modules/cjs/loader:1105:14) {
code: 'BitFieldInvalid'
}
Discord.js Version: 14.6.0 Node Version: 8.1.4
5 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs3y ago
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined • All SCREAMING_SNAKE_CASE enums have been changed to PascalCase • Intents: Intents.FLAGS.GUILD_MESSAGES -> GatewayIntentBits.GuildMessages • Permissions: Permissions.FLAGS.SEND_MESSAGES -> PermissionFlagsBits.SendMessages
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Batimius
BatimiusOP3y ago
Worked like a charm. Thank you!
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server