63 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!i want to start the bot
You showed
src/index.js
, but started index.js
.
You seem to have two, this likely is a mistake.
Try node src/index.js
(and deleting the top level index.js
after confirming you don't want anything from there)Also, you tagged this post v14 but thats v13
Nor will that code work since you miss the MessageContent intent
The top one?
It has this In it
???
You need the MessageContent intent to access message.content
also why do you have 2 index files
Idk
Cuz the tutorial
I deleted the bottom one
Is that good?
I dont know where your code is so i dont know
The code for starting it is in the top one
then run that one
.
So?
Update it
Oh okay
And then it should work?
If you add the MessageContent yes
And also enable it in the dev portal
Where do I add that
Oh k
In your constructor
…
What is that
Do you have any experience with js?
Like a little bit
Djs requires a strong js understanding
How do I update it?
Btw I’m sorry for my annoying lack of iq
Idk
Do I need to read that?
if you want your code to work, yes
…
It’s a code from YouTube tutorial
follow the guide
YouTube tutorial outdate almost instantly
Yeah
Can you please just send me the code that activates it?
#rules 5
just replace intents.flags with GatewayIntentBits
That’s it?
yes
Can’t read properties of undefined (reading flags)
show your code
I’m either stupid or blind
Its PascalCase
And reset your token
And you're missing the MessageContent intent
Pascal what?
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
So I need the perms and that’s it?
the intents*
And reset your token
It was on
Bruh
I forgot to give the bot permissions
My iq if under the floor
Bruh still doesn’t work
define doesnt work
The flags errror
did you save your code
Bruh
I didn’t
Now it’s saying code:BitFieldValid
show your code
but I suspect its this
yep, read the tag again
also your ready event emits a client parameter
Wut
This?
yes
OMG IM SO SMART
BitFieldInvalid
What’s wrong now?
I saved it
show your code
Bruh why do I look black
still didnt fix it
GUILDS -> Guilds, GUILD_MESSAGES -> GuildMessages
Its PascalCase, not SCREAMING_SNAKE
Done
HWBDHSBA
ITS WORKING
TYSM
TYSM!
Wooo!
So do I type the scripts for the bot under it?
yes
the guide explains how to create a command and event handler
I have a warning system ready
he isnt talking to me
?
@ryllix A friendly tip. Before you get into any discord bot creation, get familiar with computer science, programming. Just the basics. Learn about logic, etc.
Then, learn JavaScript. After you have good fundamental knowledge of JS, go on to using different libraries such as discord.js.
I know it sounds harsh, but if you can’t get the most basic thing done, you won’t be able to make anything else. You will only make yourself more frustrated, and demotivated to learn further.
Its not always so
I think it’s pretty good advice.
My time on this discord server doesn’t correlate to my knowledge and experience.
I’m pretty sure even the official guide for discord js says to get familiar with JS first