@bot.command(pass_context=True)
async def roll(ctx, *args):
rolls = []
modifier = 0
try:
if '+' or '-' in args[1]:
modifier = int(args[1])
except:
pass
if 'd' in args[0]:
number_of_dice = int(args[0][:args[0].find('d')])
size_of_dice = int(args[0][args[0].find('d')+1:])
if number_of_dice > 1000:
roll = random.randint(number_of_dice, (size_of_dice*number_of_dice)) + modifier
output = "Total roll: "+str(roll + modifier)
await bot.say(output)
return 0
while (number_of_dice > 0):
rolls.append(random.randint(1, size_of_dice) + modifier)
number_of_dice -= 1
output = ("dice rolled: "+str(rolls)+"\n Total roll: "+str(sum(rolls)))
if len(output) <= 2000:
await bot.say(output)
elif len(str(sum(rolls))) <= 2000:
await bot.say("Roll: "+str(sum(rolls)))
else:
await bot.say("Sorry, I can't support numbers more than 2000 characters high yet.")
else:
roll = random.randint(1, int(args[0]))
await bot.say("Dice roll: "+str(roll))