Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Solution
Commander Lvl 3
Message 31 of 42

Re: I need help with bot making on Discord.

Mail addresses of people who chose to make them public are availible below their profile picture on their profile page (e.g. https://github.com/mpboom).

 

I've checked your code and made a pull request where the bot is fixed up until the point it works. I'll highlight the problems below:

 

  • The token you checked into source control * was invalid. I tested it with a token from a bot on my account and it did work.
  • You had a file called index.js that runs the entire app. You can then start the app by running node index.js. If you'd also like to be able to start your app by running npm start, you need to modify the package.json a bit. I did that for you in the pull request so you can see what I actually changed.
  • You need to install external packages like discord.js manually trough NPM. You can define them in your package.json first, which you already did, and then install them using npm install. It'll create a big directory called node_modules that you should put in a file called .gitignore. That way, it won't be checked into source control (= it won't be uploaded to GitHub). I already did the last part (ignoring the node_modules folder), but since I can't access your computer you'll have to run npm install manually yourself.

 

As I explained in the PR, you should now be able to run your bot using node index.js or npm start after reviewing my changes.

 

If you have any more questions about learning Node - or a different language! - we are here to help!

 

* Please never check tokens into source control! Instead, store them in a seperate - not checked in - file and retrieve them from there in your application. That way you POINT to the token instead of actually uploading it to GitHub.


- Mark
Copilot Lvl 3
Message 32 of 42

Re: I need help with bot making on Discord.

I did forget to add the folder for the bot_modules which I did have installed using 'npm init' I believe. But thank you so much!! Hopefully I can learn more coding. So thank you so much!

Highlighted
Copilot Lvl 3
Message 33 of 42

Re: I need help with bot making on Discord.

Also, where should I put the .gitignore and should there be anything written in it?

Commander Lvl 3
Message 34 of 42

Re: I need help with bot making on Discord.

As you can see in my pull request on your repository, the .gitignore file should be created as a file in the root directory of your repository.

 

Each line in the file represents a pattern of either a directory or file(s) that it can match. These directories and files will be ignored by Git and thus not checked in and uploaded.

 

The node_modules folder should be ignored, so you'll need to put that in the file. You can see an example here: https://github.com/DemonWolfFang/DiscordBot/pull/1/files#diff-a084b794bc0759e7a6b77810e01874f2 .


- Mark
Copilot Lvl 3
Message 35 of 42

Re: I need help with bot making on Discord.

Can you walk me trough it please? Sadly I dont know where to put the stuff being a noob that I am... 

Commander Lvl 3
Message 36 of 42

Re: I need help with bot making on Discord.

@DemonWolfFang you mean helping you with the .gitignore file? I already did, see here: https://github.com/DemonWolfFang/DiscordBot/pull/1/files .


- Mark
Copilot Lvl 3
Message 37 of 42

Re: I need help with bot making on Discord.

Yes, but due to me being new (and I'm stupid with coding and learning how to do it) I don't know where to put it or if the file needs a specific path or where to put it. 

Commander Lvl 3
Message 38 of 42

Re: I need help with bot making on Discord.

See the link I posted in my last post. The filenames and paths are on top of the file in a grey bar. In the case of the .gitignore file that filename is just .gitignore and it's path is the root. So putting a .gitignore file in the root of your repository should work fine.


- Mark
Copilot Lvl 3
Message 39 of 42

Re: I need help with bot making on Discord.

The root of the repository? 

Commander Lvl 3
Message 40 of 42

Re: I need help with bot making on Discord.

Yes, that is right.


- Mark