#discord.js Guide

1 messages · Page 1 of 1 (latest)

gilded storm
#

does it help if you've just started learning computer science

pallid rivet
#

what you mean the guide ?

gilded storm
#

yes

pallid rivet
#

you need also a understanding of javascript

gilded storm
#

I'm going through it right now

#

Looks well explained

pallid rivet
#

but i think if you started with djs recently the guide is a good way yes!

#

i mean they have examples and stuff

gilded storm
#

what do I do in this situation

gilded storm
pallid rivet
#

did you created an bot file where you want to run your code / bot

gilded storm
#

I did

pallid rivet
#

because the error says that you dont have an file called "index.js"

#

in your folder you are trying to run the code

gilded storm
#

it's called trial.js but it's still not running

gilded storm
pallid rivet
# gilded storm I did but where should I save the file

okay in the folder where you have the js file , your bot file called in your case like "trial.js" where you want to use your bot and login and stuff right? in that file try to start the bot with node yourfile.js <-- replace the yourfile.js with the name of the file you want to start

#

in your case should that be "node trial.js"

gilded storm
#

its here

#

it's here.

pallid rivet
#

you put your file in the "node_modules" folder but trying to start in the the folder "Yamz"

#

you can move the file to the "Yamz" folder or move with the powershell / cmd to the "node_modules" folder

gilded storm
#

let me try

pallid rivet
#

you have to create an file named "config.json"

#

or maybe its the same thing like last time

#

wrong folder

gilded storm
#

and place it where

#

I put it in which directory or folder

pallid rivet
#

if you are trying to start a js file with "node bla.js" it have to be in the folder you are trying to execute the command

C:/Users/MyCoolName: > node myfile.js = it works because in that folder is my file
C:/Users/MyCoolName/MyCoolFolder: > node myfile.js = dont work wrong folder ( file is not present )

same thing with imports in your file like config.json

const { token } = require("./config.json") = works because in THAT folder is my file named config.json with my Discord Token
const { token } = require("../config.json") = Dont work because my config.json is not in that folder

thats also Javascript basics so i would recommend to learn first the basic js things and then try to start coding a bot with the guide like you did