Prerequisites - TimmyRB/SydneyBot GitHub Wiki

Before you can start coding we need to get a few things out of the way

Notice

It is recommended to not run commands you're not developing as they may be server specific and could crash your bot when testing outside of the Sheridan SDNE Discord.

NodeJS & NPM

I recommend NodeJS v12.18.3 but any version after that from the NodeJS Website will work as well. Make sure to restart and command prompts you have open so that you can use node & npm from the command line.

You can check which NodeJS & npm version you have installed by running

node --version && npm --version

Git & Project Setup

  1. Download and install git onto your system
  2. Open a command prompt and navigate to your desired directory
  3. Run git clone https://github.com/TimmyRB/SydneyBot.git && cd SydneyBot
  4. Next, run npm i in the new directory to download all required packages
  5. Copy example.env to .env by running copy example.env .env

Discord Application

  1. Create a new Application on the Discord Developer Portal
  2. Under where it says Client ID, click the Copy button
  3. On the left-hand side, click Bot and then Add Bot
    1. While not necessary, I recommend turning off the Public Bot option
  4. Make sure to turn on the Presence Intent and Server Members Intent options
  5. Open a new tab with this link and replace YOUR_CLIENT_ID with the Client ID you copied a few steps ago
    1. https://discord.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&scope=bot
  6. Once the bot is added to your server, go back to the Discord Developer Portal and copy your bot token
  7. Got into the .env we created and paste the bot token next to BOT_TOKEN=
  8. In Discord, open your User settings, go to Appearance then turn on Developer Mode & close your Settings
  9. Right-click the server you added your bot to into the server list, and click Copy ID
  10. Paste the ID you just copied into your .env next to BOT_GUILD=

CockroachDB

  1. Create an Account or Login on CockroachCloud
  2. Click Create Cluster and choose the Free Tier
  3. Once the Connection info popup appears, download your cc-ca.crt and save it to SydneyBot/certs/cc-ca.crt
  4. Next, copy the information under the Your tool tab and put it into your .env
DB_HOST=host
DB_PORT=port
DB_DATABASE=database
DB_USERNAME=username
DB_PASSWORD=password

Congrats! You're now ready to start developing! You can run the bot by running npm run start in your command line.

Additional Tools

If you're looking for a way to manage your cluster and verify that everything is writing to the Database correctly, I recommend using Beekeeper Studio.

For Visual Studio Code users, I recommend using the following Extensions for ease of developing