Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,53 @@
# sidekick
dicebot

This bot rolls dice and evaluates simple math expressions in Discord messages

You interact with it by sending messages in a channel the bot can see

Requires you to update .env with a private DISCORD_TOKEN if you want to host your own

## Commands
- Short form:
- `/r <expression>`
- `.r <expression>`
- `!r <expression>`
- Long form:
- `/roll <expression>`
- `.roll <expression>`
- `!roll <expression>`

## Expression Syntax

Supported pieces of an expression:

- **Dice**
- `NdM` → roll N, M-sided dice (e.g. `3d6`)
- `dM` → shorthand for `1dM` (e.g. `d20`)
- **Integers**
- Whole numbers (e.g. `5`, `-2`)
- **Operators** (integer arithmetic)
- `+` addition
- `-` subtraction
- `*` multiplication
- `/` division (truncating, **DICE DON'T ROLL DECIMALS!**)
- `^` exponent (non-negative, limited size)
- **Parentheses**
- `(` and `)` to control order of operations

Operator precedence: `^` > `*` `/` > `+` `-`.

## Exploding Dice (Unbound DRNs)

You can make dice “explode” – when a die meets a condition, it rolls again and adds to that die’s total.

- Add `!` after a dice term:

- `NdM!` → explode on **max** (e.g. `d6!` explodes on 6)
- `NdM!<X` – explode if a roll is **less than X** (e.g. `d6!<3` explodes on 1–2)
- `NdM!=X` – explode if a roll is **equal to X** (e.g. `d10!=1` explodes on 1)

Each die may roll multiple times; all rolls for that die are **summed**, and only the final total per die is shown.
- There is a hard cap on explosion chains of 512 rerolls to avoid infinite loops.


Loading