A Discord bot with Rust backend that scrapes, manages and analyzes data, providing information to Discord servers through a REST API.
⚠️ The current main branch is not a full release yet but shows minimal core features⚠️
please stay tuned for release 3.0.0
Kohaku is an autonomous data pipeline combining a Rust backend with a Python Discord bot client. The backend handles the complete data lifecycle with scraping external sources, persistent storage, automatic updates and API delivery, while the Python client provides intuitive Discord-native interactions.
Designed as a personal hobby project, it emphasizes self-sustaining architecture, where users always receive current data without backend intervention. The dual-language approach leverages Rust's performance and reliability for heavy data operations alongside Python's rich Discord ecosystem for seamless bot functionality.
For the full crate & package list, please see Cargo.toml and requirements.txt respectively!
TODO:
Local Setup (Non-Docker):
Rust >= 1.90.0Python >= 3.12.0
Configuration:
- Kohaku's configuration is based on an
.envfile. Therefore before deploying Kohaku in any way, fill out.env.sampleand rename it to.env! - Default aspects:
- Database: PostgreSQL 17
- Prefix:
- - Logging Level (both) : INFO
The easiest way to deploy Kohaku is by using the provided docker-compose.yml while executing docker compose up. This will deploy server, client and database (by default a postgreSQL 17 database).
For development we recommend a local setup of server and client:
Cargo is the Rust packaging manager, resulting in no further installation needed, as all packages are listed in the Cargo.toml.
# Move to right directory
cd server
# Start Kohaku Backend
cargo runThe packages for the client are listed in requirements.txt.
# Move to right directory
cd client
# Install required packages
pip install -r requirements.txt
# Start Kohaku Client
python main.pyWhile the prior sections cover simple deployment installations, some tools could be helpful during further development:
- diesel cli - Database migrations (Backend), can be installed via
cargo install diesel_cli - Linter & Checker (Client) - Better code quality of client, pre-configured, can be installed via
pip install -r requirements-dev.txt
Additionally, Makefiles present shortcut executions for formatting and checking both server and client.
Makefile Usage
The root makefile harbors six commands:
make fmt # Formats server & client
make fmt-server # Formats only server
make fmt-client # Formats only client
make check # Checks server & client
make check-server # Checks only server
make check-client # Checks only clientThe makefiles in each directory (server/ and client/) feature delegation of these commands.
Thus, make fmt in server/ is equal to make fmt-server in server/ and make fmt-client is disabled. The same applies to the other commands and to client/s makefile.
After deployment, the backend runs autonomously, and run scheduled tasks to guarantee the freshness of stored data.
The client can be accessed via commands on any Discord server where it's present.
TODO: Include example screenshot
TODO: Provide explicit information of data flows and ideas deployed in this project
Distributed under the MIT License. See LICENSE for more information.