#Intents error

61 messages · Page 1 of 1 (latest)

marble stratus
#

Hey whats the intents for discord.js

#

I mean right now i have it set as intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]

marble stratus
# snow portal whats the error
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES]
                      ^

TypeError: Cannot read properties of undefined (reading 'FLAGS')
    at Object.<anonymous> (C:\Users\thoma\Desktop\jsbot\index.js:5:23)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47```
marble stratus
#

ill put it in a browser editor

snow portal
marble stratus
#

Wait woops wrong

#

one

#

sorry

snow portal
marble stratus
#

But am very %100 sure that i do have them enabled

snow portal
#

that wont do anything

marble stratus
#

I dont know

#

Do you know how to fix it?

snow portal
#

i dunno because everything looks correct

steel hare
#

Did you save and restart the bot?

#

Intents error

marble stratus
#

Yes i did indeed

steel hare
#

And you're still getting that error?

marble stratus
#

Correct

#

It was working like 2 hours ago

steel hare
#

That's not how that works, variables defined in code can't just suddenly decide that they have better places to be and just stop working

#

Are you sure you're running correct code?

marble stratus
#

Am using version v16.15.1

#

So maybe its changed

steel hare
#

That's node version

#

Not d.js

#

And that has no rights to cause you this issue either

#

Your error is about a variable being undefined

#

Different d.js version won't change anything here

marble stratus
#

Is it npm list discord.js to find the version of discord.js

steel hare
#

I just said that it doesn't matter in the slightest, but yes

marble stratus
#

"discord.js": "^14.0.0-dev.1655942976-7279f9c",

steel hare
#

Again, code claims that the variable is undefined.

tulip pine
#

It is in v14 isnt it? Moved to IntentsBitfield?

#

But if not, yeah its just not imported

marble stratus
#

nvm i guess its been updated

#

intents: [GatewayIntentBits.Guilds, GatewayIntentBits.Guilds_MESSAGES, GatewayIntentBits.Guilds_MEMBERS]

#

I want my bot to have intent to send messages

marble stratus
#

Hello

tulip pine
#

There no intent for sending messages, intents determine what you receive

marble stratus
#

Please someone help me with this intent

#

Error

#
RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.
    at Function.resolve (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\util\BitField.js:168:11)
    at C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\util\BitField.js:163:54
    at Array.map (<anonymous>)
    at Function.resolve (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\util\BitField.js:163:40)
    at Client._validateOptions (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\client\Client.js:481:41)
    at new Client (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\client\Client.js:78:10)
    at Object.<anonymous> (C:\Users\thoma\Desktop\jsbot\index.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  [Symbol(code)]: 11
}```
keen osprey
marble stratus
#

I did that now but still same error

keen osprey
#

wait are u in dev or v13

marble stratus
#

"discord.js": "^14.0.0-dev.1655942976-7279f9c",

keen osprey
#

so dev

#

now everything is PascalCase, like GuildMessages

marble stratus
#

RangeError [BitFieldInvalid]: Invalid bitfield flag or number: undefined.
    at Function.resolve (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\util\BitField.js:168:11)
    at C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\util\BitField.js:163:54
    at Array.map (<anonymous>)
    at Function.resolve (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\util\BitField.js:163:40)
    at Client._validateOptions (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\client\Client.js:481:41)
    at new Client (C:\Users\thoma\Desktop\jsbot\node_modules\discord.js\src\client\Client.js:78:10)
    at Object.<anonymous> (C:\Users\thoma\Desktop\jsbot\index.js:3:16)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32) {
  [Symbol(code)]: 11
}```
#
const fs = require('fs')
const client = new Client({
    partials: ["MESSAGE", "CHANNEL", "REACTION"],
    intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GUILDMESSAGES, GatewayIntentBits.GUILDMEMBERS]
});```
keen osprey
#

GuildMessages and GuildMembers