A feature-rich Discord bot with ticket system, moderation tools, announcements, and clustering capability for high availability.
- Clustering: Multiple bot instances with automatic leader election
- Ticket System: Create and manage support tickets
- Moderation: Kick, ban, and manage members
- Announcements: Send server-wide announcements
- Logging: Comprehensive logging for various events
- Configuration: Flexible per-guild configuration
- Stats: Stat tracking with configurable stats
- Countdown: Countdowns with configurable endings
- Tumblr: Uploads random image from specified tumblr blog (nsfw channels only)
- Clone this repository
- Ensure you have the nightly Rust toolchain installed (the project uses nightly compiler flags for optimization).
- (Optional) Create a
cluster.tomlfile to manually define your instance ID and priority. If skipped, the bot will auto-generate a random instance ID on startup. Theconfig.tomlfile will be created automatically. - Set up the required environment variables. You can export these or pass them as CLI arguments:
DISCORD_TOKEN(or run with--dauth <token>)COORDINATION_CHANNEL_ID(or run with--coordination <id>)TUMBLR_API_KEY(Optional: required only for the/tumblrcommand)
- Run with
cargo run
-
Download the pre-compiled release binary.
-
(Optional) Create your
cluster.tomlin the same directory to manually configure the instance's clustering identity. -
Provide the necessary variables in your startup script (e.g.,
run.sh):#!/bin/bash export DISCORD_TOKEN="your_discord_bot_token" export COORDINATION_CHANNEL_ID="your_channel_id" export TUMBLR_API_KEY="your_api_key" # Optional ./archbot
To keep ArchBot running in the background, you can create a systemd service.
Create a file at /etc/systemd/system/archbot.service:
[Unit]
Description=ArchBot Discord Daemon
After=network.target
[Service]
Type=simple
User=archbot
WorkingDirectory=/opt/archbot
ExecStart=/opt/archbot/archbot --dauth YOUR_TOKEN --coordination YOUR_CHANNEL_ID
Restart=always
RestartSec=5
# Optional: Load environment variables from a file
# EnvironmentFile=/opt/archbot/.env
[Install]
WantedBy=multi-user.targetEnable and start the bot with:
sudo systemctl enable --now archbot
[cluster]
# Unique identifier for this instance
instance_id = "unique-instance-name"
# Leadership priority (lower = more likely to be leader)
priority = 1The bot automatically creates an empty config.toml file if it doesn't exist. Example structure:
[guild_id]
announcement_channel = 1234567890
custom_stats = [
"one",
"two",
"three",
]
logging_channel = 1234567890 # Default logging channel
member_log_channel = 1234567890 # Member join/leave logs
ticket_category = 1234567890 # Category for ticket channels
ticket_log_channel = 1234567890 # Ticket activity logs
mod_log_channel = 1234567890 # Moderation action logs
boot_quit_channel = 1234567890 # Bot startup/shutdown notifications
ticket_roles = [1234567890] # Roles with ticket access
ticket_exempt_role = 1234567890 # Role exempt from seeing ticket message
[guild_id.countdown_endings]
asdf = "the asdf is now foobar"
guacamole = "the avocado may now be mashed"Running the /help config command will show all available subcommands for configuration.
help [command]- Shows help menuvote <choice>- Vote for somethinggetvotes [choice]- Show vote countsstat [stat_name] <amount>- Show vote countsviewstat [stat_name] [user]- Show vote countsdiceroll [dice]- Roll dice in XdY format with optional math (e.g., 2d6+5)countdown [start] [difficulty] [ending]- Start a probalistic countdownstat <stat_name> [amount]- Add to a personal tracked statviewstat [stat_name] [user]- View personal or server-wide user statstumblr <blog>- Fetch a random photo from a specific Tumblr blog (NSFW channels only)
ticket [issue]- Create a new support ticketcloseticket [reason]- Close the current ticket (admin-only)
kick <user> [reason]- Kick a user (admin-only)ban <user> [reason] [delete_message_days]- Ban a user (admin-only)announce <message>- Make an announcement (admin-only)
config- Show configuration commandsview- Show current configuration- Types: default, boot, member, ticket, mod, message, announcement
set_logging_channel [type] [channel]- Sets logs of a certain type to a specific channelticket_category <category>- Set ticket categoryadd_ticket_role <role>- Add role to ticket accessremove_ticket_role <role>- Remove role from ticket accessticket_message <text_file>- Set ticket message template (upload .txt file)ticket_exempt_role <role>- Set role exempt from ticket messageremove_ticket_exempt_role- Remove ticket exempt role
quit- Shutdown all bot instancesquit [instance id]Shutdown specific bot instancewriteconfig- Force save config to disk (owner-only)register- Force command registration sync
Multiple instances with automatic leader election:
- Instances communicate via a dedicated Discord channel
- Heartbeats are sent every 10 seconds
- Leader timeout is 60 seconds
- Highest priority instance becomes leader (with oldest instance as tiebreaker)
- Only the leader executes commands
Events are logged to configured channels:
- Bot startup/shutdown
- Member joins/leaves
- Ticket creation/closing
- Moderation actions (kicks/bans)
- Announcements
- Message edits and deletions
- Customizable ticket message templates
- Role-based access control
- Exempt roles that don't see the ticket message
- Automatic channel creation with proper permissions
- Rust 1.70+
- Discord bot token with these intents:
- Guilds
- Guild Members
- Guild Messages
- Message Content