From 43a1025da07820f771d205c1a9d5988901e22dde Mon Sep 17 00:00:00 2001 From: Phxntxm Date: Sun, 24 Jul 2016 10:34:04 -0500 Subject: [PATCH] Fixed issue with not providing a die notation for roll command --- cogs/core.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cogs/core.py b/cogs/core.py index cf9eba4..ebc2b14 100644 --- a/cogs/core.py +++ b/cogs/core.py @@ -87,11 +87,11 @@ class Core: @commands.command(pass_context=True) @checks.customPermsOrRole("send_messages") - async def roll(self, ctx, notation: str="d6"): + async def roll(self, ctx, notation: str="1d6"): """Rolls a die based on the notation given Format should be #d#""" try: - dice = int(re.search("(\d*)d(\d*)", notation).group(1)) + dice = re.search("(\d*)d(\d*)", notation).group(1) num = int(re.search("(\d*)d(\d*)", notation).group(2)) # This error will be hit if the notation is completely different than #d# except AttributeError: @@ -103,7 +103,8 @@ class Core: await self.bot.say("Please provide the die notation in #d#!") return # Dice will be None if d# was provided, assume this means 1d# - dice = dice or '1' + dice = dice or 1 + dice = int(dice) if dice > 10: await self.bot.say("I'm not rolling more than 10 dice, I have tiny hands") return @@ -113,7 +114,7 @@ class Core: valueStr = ", ".join(str(random.randint(1, num)) for i in range(0, int(dice))) - if int(dice) == 1: + if dice == 1: fmt = '{0.message.author.name} has rolled a {2} sided die and got the number {3}!' else: fmt = '{0.message.author.name} has rolled {1}, {2} sided dice and got the numbers {3}!'