GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Humblemonk/dicemaiden-rs: Dice bot for Discord - now in rust!

BranchesTags
Open more actions menu

Latest commit

 

History

548 Commits
548 Commits

Folders and files

NameName
Last commit message
Last commit date
.cargo
.cargo
 
 
.github
.github
 
 
doc
doc
 
 
src
src
 
 
tests
tests
 
 
tools
tools
 
 
.dockerignore
.dockerignore
 
 
.gitignore
.gitignore
 
 
AGENTS.md
AGENTS.md
 
 
CLAUDE.md
CLAUDE.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
Dockerfile
Dockerfile
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
docker-compose.yml
docker-compose.yml
 
 
env.example
env.example
 
 
roll_syntax.md
roll_syntax.md
 
 

Repository files navigation

Dice Maiden — Rust Edition

A Discord dice rolling bot for tabletop RPGs. Supports complex dice expressions, exploding dice, keep/drop, success counting, and built-in aliases for 30+ game systems.

A complete rewrite of the original DiceMaiden Ruby bot in Rust.

Dice Maiden

Add to Your Server

Click here to add Dice Maiden

The bot appears in your default public channel with permission to read, send, and manage messages.

Users need the "Use Application Commands" permission to use slash commands.

To restrict the bot to specific channels, go to Server Settings → Integrations → Dice Maiden.

Commands

Command Description
/roll <dice> Roll dice using RPG notation
/r <dice> Short alias for /roll
/help [topic] Help — topics: basic, alias, system, a5e, aliens, mothership, ol, ess, tdh, cpr, wfrp, tbe
/purge <count> Delete the last 2–100 messages in the channel (requires Manage Messages)
/roll donate Support information
/roll bot-info Version, server count and memory use (requires Administrator)

Rolling Dice

Example roll

/roll 2d6 + 3           # Basic roll with modifier
/roll 4d6 k3            # Keep the 3 highest
/roll 10d6 e6 k8 +4     # Explode 6s, keep 8 highest, add 4
/roll 4d10 t8 ie10 f1   # Success counting with botches
/roll 6 4d6             # Six sets of 4d6
/roll (Fireball) 8d6 ! AOE   # Labeled roll with a comment

Full syntax reference and game system aliases →

Self-Hosting

Requires Rust 1.95+ and a Discord bot token. SQLite is created automatically.

git clone https://github.com/Humblemonk/dicemaiden-rs.git
cd dicemaiden-rs
cp env.example .env      # add your DISCORD_TOKEN
cargo build --release
cargo run --release

Create your bot at the Discord Developer Portal and invite it with Send Messages, Use Slash Commands, Manage Messages, and Read Message History.

Environment Variables

See env.example for the full annotated list.

Variable Required Description
DISCORD_TOKEN ✓ Bot token from the Discord developer portal
DATABASE_URL SQLite URL (sqlite:path/to/main.db) — defaults to main.db in the working directory (the checkout root under cargo run), created if missing
GUILD_ID Register commands to one guild for instant testing
SHARD_COUNT Shards for this process — defaults to 1
USE_AUTOSHARDING true lets Discord pick the shard count
SHARD_START First shard ID (multi-process sharding)
TOTAL_SHARDS Total shards across all processes (multi-process sharding)
MAX_CONCURRENCY Hint only — Discord overrides with your bot's real limit
RUST_LOG Log level — defaults to info

A SHARD_COUNT, SHARD_START or TOTAL_SHARDS that is set but isn't a whole number stops startup with an error naming it, before any shard connects (with USE_AUTOSHARDING=true they're ignored and only warn). A .env line that can't be parsed is logged by its key: it and every line after it are not loaded.

Container

A production Dockerfile is included — build it directly rather than copying one out of these docs:

docker build -t dicemaiden-rs .
docker run --env-file .env -v dicemaiden-data:/app dicemaiden-rs

The image's working directory is /app, so the default database is /app/main.db; mount the volume there (as docker-compose.yml does) or the statistics are lost with the container. The compose file passes no environment of its own: put .env in /opt/dicemaiden-rs, which it mounts as /app, and the bot reads it from there at startup. The bot runs as uid 1000 inside the container, so give it that directory and the .env in it before the first run (sudo chown -R 1000:1000 /opt/dicemaiden-rs), or it cannot read its settings or create the database. Under rootless podman, run podman unshare chown -R 1000:1000 /opt/dicemaiden-rs instead.

Systemd service
[Unit]
Description=Dice Maiden
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=dicebot
Group=dicebot
WorkingDirectory=/opt/dicemaiden-rs
Environment=RUST_LOG=info
# ProtectSystem=strict leaves only ReadWritePaths writable, so the database must live there.
# Create the directory before starting: systemd refuses to start if it is missing.
Environment=DATABASE_URL=sqlite:/opt/dicemaiden-rs/data/main.db
EnvironmentFile=/opt/dicemaiden-rs/.env
ExecStart=/opt/dicemaiden-rs/target/release/dicemaiden-rs
Restart=always
RestartSec=10
TimeoutStartSec=300
TimeoutStopSec=120

# Security hardening
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/dicemaiden-rs/data
PrivateTmp=true

[Install]
WantedBy=multi-user.target
Multi-process sharding

Each process owns a contiguous shard range and shares one SQLite database.

SHARD_COUNT here is one less than the number of shards the process runs: Serenity 0.12's start_shard_range treats the end of the range as inclusive, so each process boots shards SHARD_START through SHARD_START + SHARD_COUNT.

# 3 processes handling 64 shards total
SHARD_COUNT=20 SHARD_START=0  TOTAL_SHARDS=64 ./dicemaiden-rs &   # shards 0-20
SHARD_COUNT=20 SHARD_START=21 TOTAL_SHARDS=64 ./dicemaiden-rs &   # shards 21-41
SHARD_COUNT=21 SHARD_START=42 TOTAL_SHARDS=64 ./dicemaiden-rs &   # shards 42-63

Contributing

Setup, code standards, testing patterns, and the process for adding a new game system are in CONTRIBUTING.md.

License

GPLv3

Support

  • Open an issue for bugs or feature requests
  • Join the Discord for help and discussion
  • roll_syntax.md for dice syntax questions

About

Dice bot for Discord - now in rust!

Topics

botd10d20d6dark-heresydeathwatchdicedice-botdicebotdiscorddnddnd5epathfinderrogue-traderroll-dicerusttrpgwodwrathandglory

Resources

Readme
GPL-3.0 license

Contributing

Contributing
Activity

Stars

24 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Sponsor this project

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.