This is the latest and greatest generation of Code Network's Discord Bot. This aims to provide some features to enhance our online community, and is open to contributions from our wider community.
If you would like to add some features to the bot, please create a branch first and then commit your code to your new branch.
After you have finished working on the branch and if you would like your code reviewed, please create a pull request to merge the code from your branch into the main
branch.
- First, clone this repository to your computer.
- Run
npm install
to get the latest dependencies
If you wish to test the bot, you will need to create one under your own Discord account and install it on your own server. You will not be able to install it on the official Code Network server for security reasons.
- Log on to the Discord developer portal
- Click New Application and enter a useful name (e.g. Code Network Bot)
- Click on Bot in the left-hand column, and then click on Reset Token. After accepting the dialog box that appears, copy the token and then paste into the
.env
file next toDISCORD_TOKEN
. - Click on General Information, and then click Copy under Application ID. Paste this in the
.env
file next toCLIENT_ID
- If you haven't already, enable Developer Mode in your Discord (by going to User Settings --> Advanced --> Developer Mode, click on it to make it green)
- Next, right click on your server name near the top-right of your screen, then left-click on Copy Server ID and paste this next to
GUILD_ID
- Be sure to enable MESSAGE CONTENT INTENT
To add the bot to your own server:
- Click on OAuth2 on the left menu.
- In the OAuth2 URL Generator section, select the bot and applications.commands options.
- Then, click the Copy button next to the generated URL, and paste that into your browser.
- Select the server you are trying to add the bot too, and then click Authorise.
Note: you will need to create your own server or have a server you manage to add the bot to it. If you do not already have a Discord server, create one by scrolling down in the left menu to the + button, click Create a server, give it a name, and then you're good to do the above steps.
To run the bot, you will need to run these two commands in order, every time:
node deploy-commands.js
node index.js
When you are done with the server, terminate it (Ctrl+C).