Replaced for loop with genexp
This commit is contained in:
parent
a55e958dac
commit
28d5ce3078
12
cogs/core.py
12
cogs/core.py
|
@ -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}!'
|
||||||
|
|
Loading…
Reference in a new issue