Skip to content

Moriko1/sidekick

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

dicebot

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%