Dice bot for MvK ruleset...
The bot understands these commands. Each can be invoked three ways: with a
text prefix (?mvkroll 1d20 2d10, plus aliases like ?r, ?roll, ?p), by
mentioning the bot (@MvkDiceBot roll 1d20 2d10), or as a slash command
(/mvkroll dice:1d20 2d10).
Each server has its own text prefixes. Servers the bot was already in keep the
classic ? and / (so ?r 1d20 and /r 1d20 both work); a server the bot
joins fresh starts with no text prefixes (only @-mention and slash commands). A
member with the Manage Server permission changes them with /setprefixes —
e.g. /setprefixes ?/!, or /setprefixes none for only @-mention and slash
commands; run it with no argument to see the current set. The bot always responds
to @-mentions and to its slash commands regardless.
mvkroll— rolls a dice pool and applies the MvK rules math (action total, impact, advantage/disadvantage, fumbles, and critical success). It also understands several keywords:overwhelmed/staggered(stress — reduces your largest die one size before rolling, or scratches it if both apply);vs N(orcounter N) to compare your action total against a counter;+N/-Nto adjust the action total andimpact +Nto adjust impact;boost dN/reduce dNto step a die up/down a size before rolling;burnoutto total your highest three dice; and the named effectsunstable(−1 action total) andburst(+2 impact, rolled with disadvantage). Also available as the slash command/r(Discord has no slash-command aliases, so/ris a second command that does the same thing).plainroll— just rolls dice and adds up+N/-Nmodifiers. For a single d20 it also calls out 13th Age-flavored results (crit, fumble, even/odd, possible two-weapon hit) and, when this channel's escalation die is set, shows it and an escalation-adjusted total. Also available as the slash command/p.anyroll— likeplainrollbut with no die-size restriction, sod100,3d3,d7,d2, etc. all work. Rolls the pool, applies+N/-Nmodifiers, and gives a total — no MvK/13th Age rules or crit/even/odd callouts. Aliasesa,rollany; also the slash command/a.average— totals the average result of a standard dice pool (d20–d4) plus+N/-Nmodifiers, instead of rolling. Each die averages to half its max + 0.5 (d4 → 2.5, d20 → 10.5). 13th Age uses this for damage and recovery rolls (never attack or skill checks). Aliasesmean,m; also the slash command/m.escalation— tracks the 13th Age escalation die (0–6) for the current channel.?escalation//escalation(text aliases?esc/?e, plus the/escslash command) shows it;+1/nextadvances a round,-1/backsteps down,resetstarts a new battle, and a number0–6sets it. A channel's value resets to 0 after 12 hours of inactivity.nextround— shorthand for advancing the escalation die a round (same asescalation next). Available as?nextround//nextround(text aliases?next/?n, plus the/nslash command).help— auto-generated command list and usage. Available as?help,@MvkDiceBot help, or/help(optionally pass a command name, e.g./help command:mvkroll).setprefixes— shows or sets this server's text command prefixes (passnoneto use only @-mention and slash commands). Available as?setprefixes,@MvkDiceBot setprefixes, or/setprefixes, restricted to the server owner, administrators, or members with Manage Server (and only shown in?helpto them).
Editing a text/mention roll message updates the bot's existing reply and
re-rolls only the dice you added (existing dice are kept). Each prior Dice:
line is shown above the new result, struck through as small text, so others can
see what changed. Slash commands can't be edited, so this applies to the
?/mention forms only.
Slash commands are registered with Discord automatically on startup. If you set
primary_guilds (a list of guild/server IDs) in mvkdicebot.ini, they are
synced to those servers instantly. Otherwise they are synced globally, which can
take up to ~1 hour to appear in Discord's / menu the first time after a new
deploy. The text and mention forms always work immediately.
- Install python:
yum install python3.11 python3.11-devel python3.11-pip python3.11-pip-wheel python3.11-wheel - Make a venv:
python3.11 -m venv --symlinks --system-site-packages .venv - Install requirements into venv:
./.venv/bin/pip install -r requirements.txt - Create a bot account: https://discord.com/developers/applications/
- On the application's "OAuth2" page, generate an invite URL:
- Scopes: bot, applications.commands
- Bot Permissions: Read Messages/View Channels, Send Messages, Send Messages in Threads
- Copy and save the generated url at the end of the page.
- On the application's "Bot" configuration page, turn on "Message Content Intent".
- Still on the "Bot" page, click the "Reset Token" button and copy the new token value.
- This is the app's authorization token. Never check it in to source control.
- Copy
mvkdicebot.example.initomvkdicebot.ini - Edit the
mvkdicebot.inifile- add the authorization token
- add the OAuth2 URL in a comment, in case you need it later.
- Use the OAuth2 URL to authorize the bot to talk to your server.
You should be able to run the bot with ./run.sh
You can test the dice parsing and rolling code with python test.py