A Discord Bot written in Typescript that manages Queues in text channels deployed on Heroku
- Node.js
- Heroku Account
- Discord Account
- A text editor that integrates Typescript; VSCode recommended.
You can get the latest code via cloning the repository:
git clone https://github.com/bojinyao/discord-queue-bot.git
or, you can use the download one of the Releases
- After you have downloaded the code,
cd
into the directory in your terminal. - Run:
npm install
this will install all the dependencies.
To uninstall, simply delete the entire directory.
This is a great article on how to create a Discord bot and deploy Nodejs Discord Bot project to Heroku.
Here is another Guide on hosting on Heroku.
To sync up to Google's Calendar API, you will need to create a new Google API project, and very importantly, create a Service Account for the Bot itself, and don't worry about Consent Screen that the API console keeps bugging you to create.
This Medium Article on Google Calendar API is an excellent step-by-step guide on the process.
These are some official documentation that might be useful:
In order to run the bot locally, you need to create a .env
file at the root of the project directory. The file will be used to keep secrets of the application.
These values must be kept secrete!
There are four required secretes to make the bot work correctly:
BOT_TOKEN
: This is the token to your Discord botSERVICE_ACCOUNT_PRIVATE_KEY_ID
: This is theprivate_key_id
property from your Google API Service Account's JSON file.SERVICE_ACCOUNT_PRIVATE_KEY
: This is theprivate_key
property from your Google API Service Account's JSON file.SERVICE_ACCOUNT_CLIENT_EMAIL
: This theclient_email
property from your Google API Service Account's JSON file.
You will also need to upload these four values to your Heroku project as Config Vars
. DO NOT Upload them to any public repository!
The file bot-config.ts
contains (actual deployed) examples of configuration. You can find out more info about each property by checking out types.d.ts file that contains definitions of each property.
Don't worry too much about formatting, your editor should provide warnings if you did anything wrong, or the ts compiler will certainly let you know 🙂
If you need to configure the Typescript Compiler (tsc), you can do it by editing tsconfig.json
.
Once you've uploaded these secretes to Heroku, the Bot should start running. If you're hosting a local instance, run:
npm run dev # will spawn a ts-node instance and run ts files directly
If you'd like to compile the project to javascript and run these js instead, do:
% npm run build # transpile to javascript inside ./build
% npm start # run index.js in ./build/src