Discord bot for the FINKI Hub Discord server, powered by discord.js 14. Requires Node.js 24+.
If you would like to just run the bot:
- Download
compose.prod.yaml - Run
docker compose -f compose.prod.yaml up -d
This Docker image is available as ghcr.io/finki-hub/discord-bot.
- Clone the repository:
git clone https://github.com/finki-hub/discord-bot.git - Install dependencies:
npm i - Prepare env. variables by copying
.env.sampleto.env- minimum setup requiresTOKENandAPPLICATION_ID - Build the project in Docker:
docker compose build - Run it:
docker compose up -d
There is also a dev container available. To use it, just clone the repository, define the env. variables and open the container. Your development environment will be prepared automatically.
- Clone the repository:
git clone https://github.com/finki-hub/discord-bot.git - Install dependencies:
npm i - Prepare env. variables by copying
.env.sampleto.env- minimum setup requiresTOKENandAPPLICATION_ID - Build the project:
npm run build - Run it:
npm run start:envornpm run dev(for hot reloading)
The env. variables are stored in .env.sample. The following variables are available:
| Variable | Required | Description |
|---|---|---|
TOKEN |
Yes | Discord bot token |
APPLICATION_ID |
Yes | Discord application ID |
CHATBOT_URL |
No | URL of the finki-hub/chat-bot instance |
API_KEY |
No | API key for authenticated chat bot endpoints (e.g. embeddings) |
DATA_STORAGE_URL |
No | Base URL for data storage (without trailing slash) |
TZ |
No | Timezone (e.g. Europe/Berlin) |
If DATA_STORAGE_URL is not set, data loading features will be disabled. If CHATBOT_URL is not set, FAQ, links, and chat features will be disabled.
The bot configuration is stored in config/bot.json. This file uses a multi-guild structure where each guild ID maps to its own configuration:
{
"GUILD_ID_1": {
"channels": { ... },
"crossposting": { ... },
"errorWebhook": "https://...",
"models": { ... },
"roles": { ... },
"ticketing": { ... }
},
"GUILD_ID_2": { ... }
}When the bot joins a new guild, it automatically initializes a default configuration for that guild. You can use the /config commands to view and modify the configuration. The /config data subcommand allows you to manually trigger a reload of all data from the data storage.
See config/bot.json.example for an example configuration structure.
The data for the informational commands is loaded from data storage (if DATA_STORAGE_URL is configured). The bot automatically fetches and periodically reloads the following files from the data storage base URL:
courses.json- a consolidated array of all courses with their information, participants, prerequisites, and staffrooms.json- an array of all the classroomssessions.json- an object mapping session names to filenamesstaff.json- an array of the staffanto.json- an array of strings containing Anto quotes
If DATA_STORAGE_URL is not configured, these features will be disabled and the bot will run without data loading functionality. You can manually trigger a data reload using the /config data command.
All the session schedule files should be placed in the sessions folder in your data storage bucket. The names of the files should match the respective names in sessions.json. When users request a session via the /session command, the bot will provide a direct link to the file in the data storage bucket.
This project features integration with finki-hub/chat-bot for enabling FAQ, links, and LLM chat functionality. The Discord bot communicates with the chat bot using REST endpoints. If they are deployed in Docker, they should be on the same network to be able to communicate.
Set the CHATBOT_URL env. variable to the URL of the chat bot, and optionally API_KEY for authenticated endpoints (such as filling embeddings).
- How do I create a Discord bot?
- "Error: Used disallowed intents"
- You must enable all intents in the Discord Developer Portal
- "Error [TokenInvalid]: An invalid token was provided."
- Your bot token is invalid.
This project is licensed under the terms of the MIT license.