A feature-rich IRC bot written, using AI slop generation, in Rust with SSL/TLS support, SQLite database integration, and permission-based command access.
- ✅ SSL/TLS encrypted IRC connections
- ✅ SQLite database for persistent user data and permissions
- ✅ Permission-based command access (3-tier system)
- ✅ User data storage (key-value pairs)
- ✅ Dynamic channel joining/leaving
- ✅ Clean modular architecture
- Rust 1.70+ (install from rustup.rs)
- SQLite3
chmod +x install.sh ./install.sh
This script will:
- Initialize the SQLite database
- Ask for your IRC username
- Grant you admin permissions
Edit src/main.rs and update:
server: IRC server address (e.g.,irc.libera.chat)nickname: Bot's nicknamechannels: Initial channels to join (e.g.,vec!["#channel1", "#channel2"])
cargo build --release cargo run --release
If you plan to use the !weather command, you'll need an OpenWeatherMap API key:
-
Get a free API key from openweathermap.org
-
Copy the example config file:
cp config.yaml.example config.yaml
- Edit
config.yamland add your API key:
openweather_api_key: "your_actual_api_key_here"
- Load the API key into the database:
cargo run --bin set_api_key
Note: config.yaml is in .gitignore to keep your API keys private and out of version control.
!ping- Responds with "pong!"!hello- Greets you!echo <message>- Echoes back your message!weather [location]- Get weather for a location (stores location for future use)!help- Shows available commands
!join <#channel>- Bot joins a channel!leave [#channel]- Bot leaves a channel (current if not specified)!set <key> <value>- Store personal data!get <key>- Retrieve stored data!del <key>- Delete stored data!list- List all your stored data
!grant <username> <level>- Grant permissions to a user!revoke <username>- Remove user permissions!perms- List all users with permissions
- Level 0 (default): No access, can only use public commands
- Level 1-9: Restricted commands access (channel management, data storage)
- Level 10+: Admin access (user permission management)
!grant alice 5 # Give alice restricted access
!grant bob 10 # Make bob an admin
!revoke charlie # Remove charlie's permissions
src/
├── main.rs - Entry point and event loop
├── message.rs - Message parsing logic
├── database.rs - SQLite database operations
└── commands.rs - Command handlers
bot_data.db - SQLite database (created on first run)
Edit src/main.rs to customize:
let config = Config { nickname: Some("rusty".to_string()), server: Some("irc.libera.chat".to_string()), port: Some(6697), use_tls: Some(true), channels: vec!["#test".to_string()], ..Default::default() };
Development build:
cargo build
Optimized release build:
cargo build --release
View permissions:
sqlite3 bot_data.db "SELECT * FROM permissions;"View user data:
sqlite3 bot_data.db "SELECT * FROM users_data;"Reset admin for a user:
sqlite3 bot_data.db "UPDATE permissions SET permission_level = 10 WHERE username = 'alice';"Bot doesn't connect:
- Check server address and port are correct
- Ensure port 6697 (or your configured port) is not blocked
- Verify TLS is enabled for secure connections
Database errors:
- Delete
bot_data.dband run./install.shagain - Ensure you have write permissions in the project directory
Permission denied:
- Use
!perms(if admin) to check your permission level - Ask another admin to grant you permissions
Feel free to extend the bot with new commands by adding functions to src/commands.rs and wiring them in the handle_command() function.
MIT