Prerequisites
Before you begin developing Faculty Bot, ensure you have the following tools installed:Required Tools
Install Rust Toolchain
Faculty Bot requires the Rust programming language (stable channel):Choose the
stable toolchain during installation.Install PostgreSQL
The bot uses PostgreSQL 13+ as its database:
- macOS:
brew install postgresql@13 - Ubuntu/Debian:
sudo apt install postgresql-13 - Windows: Download from postgresql.org
Project Setup
Building the Project
Development Build
For faster compilation during development:target/debug/faculty_manager.
Release Build
For production deployment with optimizations:target/release/faculty_manager.
Running Locally
Standard Run
With Logging
Enable detailed logging for debugging:Watch Mode (Auto-rebuild)
Install cargo-watch for automatic rebuilds on file changes:Discord Bot Setup
Create a Discord Application
- Go to Discord Developer Portal
- Click “New Application”
- Give it a name and create
Create a Bot User
- Navigate to the “Bot” tab
- Click “Add Bot”
- Copy the token and add it to your
.envfile asDISCORD_TOKEN
Configure Bot Permissions
Enable the following in the “Bot” tab:
- Presence Intent
- Server Members Intent
- Message Content Intent
Invite Bot to Server
- Go to “OAuth2” > “URL Generator”
- Select scopes:
bot,applications.commands - Select permissions:
- Manage Roles
- Manage Channels
- Send Messages
- Manage Messages
- Embed Links
- Attach Files
- Read Message History
- Add Reactions
- Use Slash Commands
- Copy the generated URL and open it in your browser
Registering Slash Commands
Once the bot is running, register slash commands globally:Development Tools
Rust Analyzer
Install the Rust Analyzer extension for your IDE:- VS Code:
rust-lang.rust-analyzer - IntelliJ: Rust plugin
Database Tools
pgAdmin or DBeaver for PostgreSQL management:Useful Cargo Commands
Docker Development (Alternative)
For containerized development:Troubleshooting
Build Errors
Error:failed to run custom build command for rosetta-build
Solution: Ensure all translation files exist in i18n/ directory (en.json, de.json, ja.json).
Database Connection Issues
Error:error connecting to database
Solution: Verify PostgreSQL is running and credentials in .env are correct:
Discord Token Issues
Error:Expected DISCORD_TOKEN in the environment
Solution: Ensure .env file exists and contains a valid DISCORD_TOKEN.
Next Steps
- Learn about the Architecture
- Understand the Database Schema
- Start Adding Commands