Skip to content

Commit 2d91a15

Browse files
committed
added modified roll
1 parent 50b5363 commit 2d91a15

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

main.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ async def roll(ctx, dice: int, sides: int):
4646
await ctx.send(result)
4747

4848

49+
@bot.command(name='modroll', help='Roll XdY + Z', pass_context=True)
50+
async def modroll(ctx, dice: int, sides: int, bonus: int):
51+
dice_result = [
52+
random.choice(range(1, int(sides) +1))
53+
for _ in range(int(dice))
54+
]
55+
total = sum(dice_result) + bonus
56+
result = f"Rolled {dice}d{sides} + {bonus} for {ctx.message.author.mention}: " + os.linesep + f"{dice_result} total: {total}"
57+
await ctx.send(result)
58+
59+
4960
@roll.error
5061
async def roll_error(ctx, error):
5162
"""

0 commit comments

Comments
 (0)