Skip to content

sidan-lab/sidan-gov-discord-bot

Repository files navigation

SIDAN Lab Governance Discord Bot

This is the discord bot for SIDAN Lab Governance, used to interact with the users in the discord server, as well as updating database & forum posts with scheduled tasks.

Pre-requisites

Important Notes

The following line in package.json defines the entry point of the bot, it registers all the commands/events/scheduled tasks when the bot loads. Therefore, super important to make sure the path is correct, especially if repository structure is altered, otherwise none of the discord logic will register.

  "main": "dist/src/index.js",

Tools

  1. (For scheduled tasks) Download and set up a local Redis server, or use a cloud-based Redis service, like (RedisLabs)[https://redislabs.com/].
  2. (Optional) (For running docker image) Download and set up Docker if you want to dockerize the application Discord bot application.

Environment Variables

Create a .env file in the workspace repository and set the environment variables according to .env.example

For how to obtain some of the environment variables (DISCORD_BOT_TOKEN), please refer to our internal documentation.

Adding the bot to your server

Please refer to the internal documentation for the bot invite link.

Getting Started

Installation

npm install

Running the bot

npm run dev

Building the bot

npm run build:backend

If you want to delete a command

You can use the following code to delete a command from the server. The command Id can be obtained from the discord server setting

client.application?.commands
  .fetch("id") // id of your command
  .then((command) => {
    console.log(`Fetched command ${command.name}`);
    command.delete();
    console.log(`Deleted command ${command.name}`);
  })
  .catch(console.error);

Resources

Pipeline

We use circleci as the cicd pipeline tool.

testing

About

The discord bot in SIDAN Lab governance project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •