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.
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",
- (For scheduled tasks) Download and set up a local Redis server, or use a cloud-based Redis service, like (RedisLabs)[https://redislabs.com/].
- (Optional) (For running docker image) Download and set up Docker if you want to dockerize the application Discord bot application.
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.
Please refer to the internal documentation for the bot invite link.
npm install
npm run dev
npm run build:backend
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);
- Sapphire Framework Doc
- Sapphire Scheduled Tasks Doc (Cron Job)
- Discord Developer Portal
- Discord.js Doc
- Discord Embed Builder
We use circleci as the cicd pipeline tool.
testing