Skip to content

About

Run campaigns and character-creation conversations that survive a Discord bot restart.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Persistent Discord RPG

Run campaigns and character-creation conversations that survive a Discord bot restart.

Try it

Python 3.11+. Run from this checkout:

python -m pip install -e .
python -m examples.offline_demo
python bot.py --check

Input: A synthetic campaign, invited player, accepted membership and character-name step.

Result: A reopened SQLite store recovers the campaign and the exact pending DM step. --check verifies bot startup wiring without reading a token or contacting Discord.

See the captured example for the observed output and reproduction command.

How it works

Multi-step interactions are durable records keyed by guild and user. Character fields retain their Discord message indexes, while campaigns retain membership and ruleset records.

Source: bot.py, modules/storage.py, modules/rules_engine.py.

Use it for your work

Set your own DISCORD_BOT_TOKEN and DISCORD_RPG_DB_PATH, then run python bot.py only when ready to connect. SPEC.md explains module boundaries; SECURITY.md covers deployment setup.

Scope

This is a playable-system prototype, with substantial storage/workflow code and early turn-order seams. The offline case proves persistence; it does not simulate Discord permissions, rate limits or a complete tabletop session.

Owned code is available under the MIT license.

What survives a restart

The synthetic case creates Lantern Workshop, changes one membership from invited to accepted, and saves a charcreate_character_name DM session. A new Storage instance reads the same campaign and pending payload from SQLite. The printed campaign ID joins that pending step to its campaign; the invented guild/user/channel IDs have no external destination.

Responsibility Implementation Present boundary
Command and DM routing bot.py Requires a Discord connection for real incoming events
Campaign, member, character and DM records storage.py Durable SQLite rows
Numeric character choices rules_engine.py Point-buy/array validation and modifiers
Turn/channel context state_manager.py In-memory placeholder; does not survive process restart

Persistence is demonstrated for the stored workflow records, not every part of gameplay. DM updates in this snapshot are upserts without the revision guards added in the standalone Persistent Interaction State. RPG Character Rules provides a separate platform-neutral sheet interface; the parent remains intact.

The public continuation now rejects missing ability keys and non-integer scores at the rules API boundary and handles malformed nested rules sections using its existing default-policy behavior. python bot.py --check checks startup wiring before reading a token; it does not prove permissions, connection, command registration or a successful play session. Read SPEC.md as module design alongside current source, not a claim that every planned gameplay seam is complete.

The origin record identifies the preserved snapshot. Completing durable turns, resolving simultaneous DM edits and exercising a real campaign are meaningful future work.

About

Run campaigns and character-creation conversations that survive a Discord bot restart.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages