Uncaught TypeError TypeError: Cannot read properties of undefined (reading 'Guilds')
Help with code from GPT, im a noob and trying to bite off more than i can chew i think. The error im getting is on line 78" GatewayIntentBits.FLAGS.Guilds,".
Any help would be greatly appreciated.
Thanks,
16 Replies
- 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 staffTo share long code snippets, use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks or files.
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
yeah that code isnt v14
what is the best reference to v.14 code?
Ok this is what i was looking at hence my confusion because:
that is indeed the correct way
i tried it both ways
wait
im stupid. let me try this..
DiscordjsError Error [TokenInvalid]: An invalid token was provided.
Im assuming this meaning the discord bot token
yes
you did not provide a token
but your entire code is outdated
fixing just that isnt gonna fix everything
its in the .env
you do not use env in the code you showed
at least in the part that is visible
the guide covers that
where did you get that code from?
i cobbled it together from youtube/forumns/chatgpt trying to learn as i went through.
yeah dont
use the guide
and defintely do not use ai
yeah i see thats not the move.