def roll(ctx, *args):
name = ctx.message.author.name
args = args[0].lower().split('d')
die = args[1]
mod = args[0]
results = []
if mod:
if die in ['4', '6', '8', '10', '12', '20', '100']:
if int(mod) > 1 and int(mod) < 7:
for x in range(0, int(mod)):
this_roll = random.randrange(1, int(die) + 1)
results.append(this_roll)
results_string = ', '.join(str(x) for x in results)
return await yeebot.say("{} rolled a d{} {} times and got `{}`!".format(name, die, mod, results_string))
elif int(mod) == 1:
result = str(random.randrange(1, int(die) + 1))
return await yeebot.say("{} rolled a d{} and got `{}`!".format(name, die, result))
else:
return await yeebot.say("Please use the format: `!roll <1-6>d<4, 6, 8, 10, 12, 20, 100>` eg: `!roll 2d20`")
else:
return await yeebot.say("Please use the format: `!roll <1-6>d<4, 6, 8, 10, 12, 20, 100>` eg: `!roll 2d20`")
else:
return await yeebot.say("Please use the format: `!roll <1-6>d<4, 6, 8, 10, 12, 20, 100>` eg: `!roll 2d20`")
评论列表
文章目录