Im building a verify bot and i keep getting the same error

When i put node bot.js to run it, it just gives me the same error over and over again and copilot ( the ai i went for help first ) says its something to do with intents.flags but i dont understand it at all
4 Replies
d.js toolkit
d.js toolkit10mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Powliner
PowlinerOP10mo ago
My Discord Is 14.14.1 And My Node Is 20.11.1 D:\DiscodBOT\bot.js.js:8 Intents.FLAGS.GUILDS, ^ TypeError: Cannot read properties of undefined (reading 'FLAGS') at Object.<anonymous> (D:\DiscodBOT\bot.js.js:8:17) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 Node.js v20.11.1 i downloaded v13 and got a new error ima see if i can fix nope the new error stumped me D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:152 throw new RangeError('BITFIELD_INVALID', bit); ^ RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined. at Intents.resolve (D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:152:11) at D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:147:54 at Array.map (<anonymous>) at Intents.resolve (D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:147:40) at Client._validateOptions (D:\DiscodBOT\node_modules\discord.js\src\client\Client.js:550:33) at new Client (D:\DiscodBOT\node_modules\discord.js\src\client\Client.js:76:10) at Object.<anonymous> (D:\DiscodBOT\bot.js.js:4:16) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) { [Symbol(code)]: 'BITFIELD_INVALID' } Node.js v20.11.1 const { Client, Intents } = require('discord.js'); const axios = require('axios'); const client = new Client({ intents: [ Intents.FLAGS.Guilds, Intents.FLAGS.GuildMessages ] }); client.once('ready', () => { console.log('Ready!'); }); client.on('messageCreate', message => { if (message.content === '!verify') { message.reply('Please reply to this message with your email and username separated by a space.'); const filter = m => m.author.id === message.author.id; message.channel.awaitMessages({ filter, max: 1, time: 60000, errors: ['time'] }) .then(collected => { const reply = collected.first().content.split(' '); const email = reply[0]; const username = reply[1]; // This is your webhook URL let webhookUrl = 'nuh uh'; let data = { username: username, email: email }; axios.post(webhookUrl, data) .then(response => console.log('Success:', response.data)) .catch((error) => console.error('Error:', error)); message.reply('Your information has been submitted. You will receive a code in your email.'); }) .catch(collected => { message.reply('Verification failed.'); }); } }); client.login('nuh uh'); i replaced my nuh uhs with the right stuff someone please help
Powliner
PowlinerOP10mo ago
My brother wrote the code and he told me to do that idk why okay so i download v13 and now im getting a new error D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:152 throw new RangeError('BITFIELD_INVALID', bit); ^ RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined. at Intents.resolve (D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:152:11) at Intents.add (D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:74:33) at Object.<anonymous> (D:\DiscodBOT\bot.js.js:5:11) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 { [Symbol(code)]: 'BITFIELD_INVALID' const { Client, Intents } = require('discord.js'); const axios = require('axios'); const client = new Client({ intents: [ Intents.FLAGS.Guilds, Intents.FLAGS.GuildMessages ] }); client.once('ready', () => { console.log('Ready!'); }); client.on('messageCreate', message => { if (message.content === '!verify') { message.reply('Please reply to this message with your email and username separated by a space.'); const filter = m => m.author.id === message.author.id; message.channel.awaitMessages({ filter, max: 1, time: 60000, errors: ['time'] }) .then(collected => { const reply = collected.first().content.split(' '); const email = reply[0]; const username = reply[1]; // This is your webhook URL let webhookUrl = ''; let data = { username: username, email: email }; axios.post(webhookUrl, data) .then(response => console.log('Success:', response.data)) .catch((error) => console.error('Error:', error)); message.reply('Your information has been submitted. You will receive a code in your email.'); }) .catch(collected => { message.reply('Verification failed.'); }); } }); client.login(''); would this work i do wait hold on it appears im still getting that one error, when i downloaded v13 with that code it just gave me this D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:152 throw new RangeError('BITFIELD_INVALID', bit); ^ RangeError [BITFIELD_INVALID]: Invalid bitfield flag or number: undefined. at Intents.resolve (D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:152:11) at D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:147:54 at Array.map (<anonymous>) at Intents.resolve (D:\DiscodBOT\node_modules\discord.js\src\util\BitField.js:147:40) at Client._validateOptions (D:\DiscodBOT\node_modules\discord.js\src\client\Client.js:550:33) at new Client (D:\DiscodBOT\node_modules\discord.js\src\client\Client.js:76:10) at Object.<anonymous> (D:\DiscodBOT\bot.js.js:4:16) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) { [Symbol(code)]: 'BITFIELD_INVALID' I have changed it I keep getting the same error its not my fault this code is autistic Sorry im just mad on why its not working ill try find a older version of the code Qjuh, im so sorry for being rude. Its working, Thank you so much for helping
Want results from more Discord servers?
Add your server