What do you mean?
If you’re comfortable with it, I’d like to receive a copy of your code so I can test out some things on my own computer.
That works way faster than asking you to test something and letting you post it back here.
Sure. I’ll get it set up for you.
I need to re-make it because for some odd reason my index.js was deleted?
Is there a way to message you the bots coding?
Sure @demonwolffang, if you don’t want to share it publicly you can add me as a collaborator on your repository. Alternatively my mail address is publicly availible on my GitHub profile.
Thank you! I’ll get it sent.
Sadly I dont see the email. I’m still new here.
Ok I added you to it!!
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.
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!
Also, where should I put the .gitignore and should there be anything written in it?
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 .
Can you walk me trough it please? Sadly I dont know where to put the stuff being a noob that I am…
@demonwolffang you mean helping you with the .gitignore file? I already did, see here: https://github.com/DemonWolfFang/DiscordBot/pull/1/files .
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.
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.
The root of the repository?
Yes, that is right.
Which I have absolute no idea what it means.