diff --git a/bot.py b/bot.py index ed3c6caa4605c5aabfb365dcbed3bf253f0fc2fa..df73091fac1515ab79889499944e69944d9b05c8 100644 --- a/bot.py +++ b/bot.py @@ -240,27 +240,37 @@ bot = commands.Bot(command_prefix=':') async def on_ready(): print(f'{bot.user.name} has connected to Discord!') -@bot.command(name='roll', help='Roll dices. 2args : number of dices and number of sides') +@bot.command(name='roll', help='Roll dices. 2args : number of dice and number of sides') async def roll(ctx, number_of_dice: int, number_of_sides: int): + mention=ctx.message.author.mention + await ctx.message.delete() dice = [ str(random.choice(range(1, number_of_sides + 1))) for _ in range(number_of_dice) ] - await ctx.send(', '.join(dice)) + await ctx.send('{} {} {} '.format(number_of_dice,number_of_sides,dice[0])) + if (number_of_dice==1 and (dice[0]==1 or dice[0]==number_of_sides)): + await ctx.send("{1}\n*Critique !*\nRolling d{2} : {0}".format(dice[0]),mention,number_of_sides) + else: + await ctx.send('{} Rolling {}d{} : '.format(mention,number_of_dice,number_of_sides) + ', '.join(dice)) @bot.command(name='getmychars', help='Affiche la liste des personnages du joueur') async def getmychars(ctx): try: + mention=ctx.message.author.mention + await ctx.message.delete() author = '{}'.format(ctx.message.author) chars = getAllCharactersByOwner(author) chars = "\n-".join(char.name for char in chars) - await ctx.send("You possess the following characters :\n- {0}".format(chars)) + await ctx.send("{1} You possess the following characters :\n- {0}".format(chars,mention)) except Exception as e: await ctx.send('Exception : {}'.format(e)) @bot.command(name='getchar', help='Affiche les détails du personnage indiqué') async def getchar(ctx, name = None): + mention=ctx.message.author.mention author = '{}'.format(ctx.message.author) + await ctx.message.delete() try: if name is None: char= getMainCharactersByOwner(author) @@ -426,7 +436,9 @@ async def delsys(ctx, name): @bot.command(name='r', help='Simulates rolling dice for a character attribute / competence') async def r(ctx, what, characterName = None): + mention=ctx.message.author.mention author = '{}'.format(ctx.message.author) + await ctx.message.delete() try: if characterName is None: char= getMainCharactersByOwner(author) @@ -443,7 +455,7 @@ async def r(ctx, what, characterName = None): attrbonus = char.getAttribute(comp.attribute) maxdice = max(roll) res = maxdice + dicebonus + attrbonus - await ctx.send('Roll : {5}\nThe result for the {0} check is : {1} ({2} + {3} + {4})'.format(what, res,maxdice,dicebonus,attrbonus,roll)) + await ctx.send('{6} Roll : {5}\nThe result for the {0} check is : {1} ({2} + {3} + {4})'.format(what, res,maxdice,dicebonus,attrbonus,roll,mention)) return else: await ctx.send("Competences not implemented yet") @@ -455,11 +467,11 @@ async def r(ctx, what, characterName = None): custom = floor((int(attr.level)-10)/2) res = randompart - custom if randompart==1: - await ctx.send('*Réussite critique !*\nThe result for the {0} check is : {1} ({2} - {3})'.format(what, res,randompart,custom)) + await ctx.send('{4}\n*Réussite critique !*\nThe result for the {0} check is : {1} ({2} - {3})'.format(what, res,randompart,custom,mention)) elif randompart==20: - await ctx.send('*Échec critique !*\nThe result for the {0} check is : {1} ({2} - {3})'.format(what, res,randompart,custom)) + await ctx.send('{4}\n*Échec critique !*\nThe result for the {0} check is : {1} ({2} - {3})'.format(what, res,randompart,custom,mention)) else: - await ctx.send('The result for the {0} check is : {1} ({2} - {3})'.format(what, res,randompart,custom)) + await ctx.send('{4} The result for the {0} check is : {1} ({2} - {3})'.format(what, res,randompart,custom,mention)) return elif char.system=="LN": roll = [] @@ -469,7 +481,7 @@ async def r(ctx, what, characterName = None): dicebonus = attr.level - len(noduplicates) maxdice = max(roll) res = maxdice + dicebonus + attr.level - await ctx.send('Roll : {5}\nThe result for the {0} check is : {1} ({2} + {3} + {4})'.format(what, res,maxdice,dicebonus,attr.level,roll)) + await ctx.send('{6} Roll : {5}\nThe result for the {0} check is : {1} ({2} + {3} + {4})'.format(what, res,maxdice,dicebonus,attr.level,roll,mention)) return else: await ctx.send('Character system {} not supported yet'.format(char.system)) diff --git a/characters.pkl b/characters.pkl index de0e8434de88dab154f892c28823646b49e879e7..84f97f4d4463349240a3400af5e39a172cccb8ee 100644 Binary files a/characters.pkl and b/characters.pkl differ