commit 91481ac886ada4fe1d6d9b1620060a067de7d479 Author: skins Date: Thu Aug 5 21:41:09 2021 +0100 created dice diff --git a/dice/__init__.py b/dice/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/dice/dice.py b/dice/dice.py new file mode 100644 index 0000000..76c1982 --- /dev/null +++ b/dice/dice.py @@ -0,0 +1,23 @@ +from redbot.core import commands +from pyroll20.pyroll20 import roll + +class Dice(commands.Cog): + """Roll dice using roll20-esque notation""" + + def __init__(self, bot): + self.bot = bot + + @commands.command() + async def roll(self, ctx, *args): + try: + await ctx.send(roll(''.join(args))) + except ValueError: + await ctx.send("""**'h'** # Highest Rolls - **5d20h3** returns the 3 highest rolls from the five d20 that were rolled. +**'l'** # Lowest Rolls - **5d20l3** returns the 3 lowest rolls from the five d20 that were rolled. +**'+'** # Adds to sum - **5d20+3** adds 3 to the sum of the five d20 that were rolled, always returns a single integer. +**'-'** # Subtracts from sum - **5d20-3** subtracts 3 from the sum of the five d20 that were rolled, always returns a single integer. +**'.-'** # Subtracts from each individual roll - **5d20.-3** subtracts 3 from each of the five d20 that were rolled. +**'.+'** # Adds to each individual roll - **5d20.+3** adds 3 to each of the five d20 that were rolled. +**'t'** # Sum of all rolls - **5d20t** returns the sum of the five d20 that were rolled. +**'e'** # "Exploding dice - **5d20e** if any of the five rolls goes critical, it gets re-rolled and added to the individual roll. +""")