1
0
Fork 0
mirror of synced 2024-06-18 02:24:32 +12:00

Replaced for loop with genexp

This commit is contained in:
Phxntxm 2016-07-14 10:15:13 -05:00
parent a55e958dac
commit 28d5ce3078

View file

@ -103,18 +103,18 @@ class Core:
except ValueError: except ValueError:
await self.bot.say("Please provide the die notation in #d#!") await self.bot.say("Please provide the die notation in #d#!")
return return
if dice == '': dice = dice or '1'
dice = '1'
if dice > 10: if dice > 10:
await self.bot.say("I'm not rolling more than 10 dice, I have tiny hands") await self.bot.say("I'm not rolling more than 10 dice, I have tiny hands")
return return
if num > 100: if num > 100:
await self.bot.say("What die has more than 100 sides? Please, calm down") await self.bot.say("What die has more than 100 sides? Please, calm down")
return return
valueStr = str(random.randint(1, num)) #valueStr = str(random.randint(1, num))
for i in range(1, int(dice)): valueStr += ", ".join("{}".format(random.randint(1, num)) for i in range(1, int(dice)))
value = random.randint(1, num) #for i in range(1, int(dice)):
valueStr += ", {}".format(value) #value = random.randint(1, num)
#valueStr += ", {}".format(value)
if int(dice) == 1: if int(dice) == 1:
fmt = '{0.message.author.name} has rolled a {2} sided die and got the number {3}!' fmt = '{0.message.author.name} has rolled a {2} sided die and got the number {3}!'