TypeError: Discord.intents is not a constructor

Hi, i am doing my first discord bot, but when i try to run it, it sends the next message:
“C:\Users\ruben\Desktop\bot_RueRue\index.js:2
const intents = new Discord.intents(32767)
^
TypeError: Discord.intents is not a constructor”

The code is the next:

const Discord = require(“discord.js”)

const intents = new Discord.intents(32767)

const client = new Discord.Client({ intents })

client.login("")

Remove Discord.intents, it does not exist, or is not needed.

Use this format for the client.

const client = new Discord.Client({ intents: ["INTENT"] });

This works for me but if there is also something I’m missing, then I’m not sure how else to help.

omg it just made it bigger, idk haha, this is what i got in cmd

throw new RangeError(‘BITFIELD_INVALID’, bit);
^

RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: INTENT.
at Function.resolve (C:\Users\ruben\Desktop\bot_RueRue\node_modules\discord.js\src\util\BitField.js:152:11)
at C:\Users\ruben\Desktop\bot_RueRue\node_modules\discord.js\src\util\BitField.js:147:54
at Array.map ()
at Function.resolve (C:\Users\ruben\Desktop\bot_RueRue\node_modules\discord.js\src\util\BitField.js:147:40)
at Client._validateOptions (C:\Users\ruben\Desktop\bot_RueRue\node_modules\discord.js\src\client\Client.js:550:33)
at new Client (C:\Users\ruben\Desktop\bot_RueRue\node_modules\discord.js\src\client\Client.js:76:10)
at Object. (C:\Users\ruben\Desktop\bot_RueRue\index.js:3:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1155:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
[Symbol(code)]: ‘BITFIELD_INVALID’

Never mind, I guess you can’t use an array for the permissions, this might have been in the latest Discord.js update but mine still works with that type. I was wrong. I think it has something to do with the way you called the function, so try looking on StackOverflow and you may find it. (I’m not an expert on this kinda stuff)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.