I'm new to discord.js and I'd like to learn about the .env file
I've been watching videos on YouTube to get a grasp on what I need to do initially. I've already set up my
package.json
and my package-lock.json
. I'm working on my script.js
, but what I really want to figure out is how to use the .env file. I've noticed in several videos that YouTubers use multiple files for each command, including a .env
file.
And I would also like to understand why my script.js
slash command does not appear.
npm list discord.js
- └── (empty)
node -v
- v20.11.1
7 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!discord.js
- npm install discord.js
package.json
- npm init
:I didn't understand. If I do this can I create several files and run them all in a
.env
file? Like this: https://i.imgur.com/gDYxANM.pngYes, I think I did that.
But is it used to run codes?
I'm not saying that the codes will be inside
.env
, but the command files like:
In each of the commands will I have to put something like client.login(/.env)
(example)?
Ohhh
Understood.
So, files like kick.js
, ban.js
, clear.js
, help.js
... Would I have to get them all to run?
I read. But I didn't find where that part was.Oh, so my
script.js
is where the Client
will be?
Is it necessary to use config.json
?
I'm going to delete everything and start from the beginning. The first thing I'm going to do is package.json
.
Yes.
In the .env
file, does the Token need to be enclosed in quotation marks?
I'm going to use config.json
.
Nice. It's working.