Nyhilo / Duck-Disciple-Bot

A bot for adding helpful tools to the Infinite Nomic discord
http://nomic.gay
MIT License
3 stars 2 forks source link

Dice rolling #133

Open Nyhilo opened 1 year ago

Nyhilo commented 1 year ago

It's finally time

Add a dice roller with the following features. The bot should reply to the message that triggered it

&roll NdK - rolls N K-sided dice. Returns results in the dice-maiden way, i.e.:

&roll 5d6 Request: [5d6] Roll: [2, 5, 1, 6, 4] Result: 18

Support single, basic mathematical operations on the sum: +, -, *, and /. Dividing rounds up

&roll 5d6 Request: [5d6] Roll: [2, 5, 1, 6, 4] Result: 18

&roll 5d6 + 4 Request: [5d6 + 4] Roll: [2, 5, 1, 6, 4] Result: 22

All of these return the same result

&roll 5d6 +4 &roll 5d6+ 4 &roll 5d6+4 &roll 5d6 + 4

Division looks like

&roll 5d6 / 4 Request: [5d6 / 4] Roll: [2, 5, 1, 6, 4] Result: 5 (sums to 18, then divides by 4 and rounds 4.5 up)