diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40b878d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +node_modules/ \ No newline at end of file diff --git a/README.md b/README.md index dff8d83..8d79221 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,72 @@ -# CodingThrone Courses - -## Attention Devs -@FOUNDERS feel free to go about the main branch as you wish. -For now, meaing until further directions are explicitely given, -create a new branch named after your github username and create a folder for each course named accordingly. - -Incase of confusion, copy structure of branch **rbrtbrnschn** - -## Finished & published courses: - -| Author | Name | State (%) | Github | Blog | -|- |- |- |- |- | -| rbrtbrnschn | web-deploy-201 | 100 | [URL](https://github.com/codingthrone/courses/tree/rbrtbrnschn/web-deploy-201/src) | [URL](http://64.225.103.55/deployment/web-deployment-201/) | -| Minazak1 | How to make a discord bot | 0 | | | -| | | | | | -| | | | | | -| | | | | | -| | | | | | -| | | | | | -| | | | | | +# Discord.js Basics +> A quick easy and guide to making a simple bot that goes over most features of Discord.js + +# 🔨Set Up + +## Node.js Set Up +Firstly you will want to head over to [node.js](https://nodejs.org/en/) and download the shown **LTS** by following the installation steps. +After doing so you will need to head over to your node.js console which can be found by searching for it on your devices search bar. +After locating the node.js console you will need to create a new folder for your botin your desired location. then you will need to locate your folder in you node.js console and run the following commands. +- Follow this if your folder is in documents +``` +cd documents +// Then +cd (folder name) +``` +> - if you weren't already in your users folder whne the console opened then follow the steps bellow +``` +cd Users + +cd (user name) + +cd documents + +cd (folder name) +``` +**REMINDER** *make sure your in the Node.js Command Prompt* + +You will then need to run the following command once your in the folder. +```npm init``` +Wait for everything to compile and you will be promted with some questions such has name, verison of the project. You can skip all of them unless you want to change some things. **Keep the entry point** ```index.js```. + +- We have now done the Node.js Set up + +## Discord.js Installation / Bot set-up +Now that we have Node.js installed we will now need to install [Discord.js](https://discord.js.org/#/), you can do this by running +``` +npm install discord.js +``` +in your Node.js command prompt or you can run this command in your **Vs Code** terminal while having your bot folder open. + +You will now need to go register your bot on the [Discord Developer Bot Dashboard](https://discord.com/developers/applications). Log in and follow the steps below. +> - Click on **New Application** on the top right of applications page and give your bot a name. +> - Now after making the bot you will need to select it if not done already +> - Click on the ***Bot*** Tab on the left side of the screen +> - Click **Add Bot** +> You have now made your bot +**Disclaimer**: ***Dont share your BOT TOKEN this will be used to log into your bot*** +To invite your bot to your server you will need to go back to your **General Information Tab** and copy your ***Client ID***. +Then head over to [Permissions Calculator](https://discordapi.com/permissions.html) and select the permissons you want your bot to have. +Paste your client id on the bottom of the page and click on the link to invite your bot. + +**YOUR ALL SET** + +## Getting started +Now that we are all set lets set up a basic command. + +> Lets first start by setting up some ```const``` variables that we will be needing. +``` +const Discord = require('discord.js'); +//makes sure we are using discord.js + +const client = new Discord.Client(); +//makes a new discord client + +const prefix = '`'; +//the prefix for your bot that will be used before each command + +const fs = require('fs'); +//command handler +``` +After doing so go ahead and make a ```commands``` folder in your bot folder. +This is where all the command files will be stored. diff --git a/assets/index.js b/assets/index.js new file mode 100644 index 0000000..3735c87 --- /dev/null +++ b/assets/index.js @@ -0,0 +1,7 @@ +const Discord = require('discord.js'); + +const client = new Discord.Client(); + +const prefix = '`'; + +const fs = require('fs'); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..6afddfa --- /dev/null +++ b/package-lock.json @@ -0,0 +1,107 @@ +{ + "name": "coursebot", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@discordjs/collection": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz", + "integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==" + }, + "@discordjs/form-data": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz", + "integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "requires": { + "event-target-shim": "^5.0.0" + } + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" + }, + "discord.js": { + "version": "12.5.1", + "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.5.1.tgz", + "integrity": "sha512-VwZkVaUAIOB9mKdca0I5MefPMTQJTNg0qdgi1huF3iwsFwJ0L5s/Y69AQe+iPmjuV6j9rtKoG0Ta0n9vgEIL6w==", + "requires": { + "@discordjs/collection": "^0.1.6", + "@discordjs/form-data": "^3.0.1", + "abort-controller": "^3.0.0", + "node-fetch": "^2.6.1", + "prism-media": "^1.2.2", + "setimmediate": "^1.0.5", + "tweetnacl": "^1.0.3", + "ws": "^7.3.1" + } + }, + "event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" + }, + "mime-db": { + "version": "1.45.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.45.0.tgz", + "integrity": "sha512-CkqLUxUk15hofLoLyljJSrukZi8mAtgd+yE5uO4tqRZsdsAJKv0O+rFMhVDRJgozy+yG6md5KwuXhD4ocIoP+w==" + }, + "mime-types": { + "version": "2.1.28", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.28.tgz", + "integrity": "sha512-0TO2yJ5YHYr7M2zzT7gDU1tbwHxEUWBCLt0lscSNpcdAfFyJOVEpRYNS7EXVcTLNj/25QO8gulHC5JtTzSE2UQ==", + "requires": { + "mime-db": "1.45.0" + } + }, + "node-fetch": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz", + "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==" + }, + "prism-media": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.7.tgz", + "integrity": "sha512-thS1z3L6BDmf724sqLC73bHGjSYArFTYHa7cqInyS3EdDNTHKgDCXy7l+IhRvlnX7aFNiUb8jJcC+R8ezxwgMA==" + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" + }, + "tweetnacl": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", + "integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==" + }, + "ws": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.3.tgz", + "integrity": "sha512-hr6vCR76GsossIRsr8OLR9acVVm1jyfEWvhbNjtgPOrfvAlKzvyeg/P6r8RuDjRyrcQoPQT7K0DGEPc7Ae6jzA==" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..5a47a1c --- /dev/null +++ b/package.json @@ -0,0 +1,22 @@ +{ + "name": "coursebot", + "version": "1.0.0", + "description": "A Discord.js Course Bot", + "main": "index.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/codingthrone/courses.git" + }, + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/codingthrone/courses/issues" + }, + "homepage": "https://github.com/codingthrone/courses#readme", + "dependencies": { + "discord.js": "^12.5.1" + } +}