diff --git a/Cogs/Xp.py b/Cogs/Xp.py index d866d737..a8c65530 100644 --- a/Cogs/Xp.py +++ b/Cogs/Xp.py @@ -600,12 +600,9 @@ async def gamble(self, ctx, bet = None): channel = ctx.message.channel # bet must be a multiple of 10, member must have enough xpreserve to bet - msg = 'Usage: `{}gamble [xp reserve bet] (must be multiple of 10)`'.format(ctx.prefix) + msg = 'Usage: `{}gamble [xp reserve bet/all] (must be multiple of 10)`'.format(ctx.prefix) + - try: - bet = int(float(bet)) - except: - return await ctx.send(msg) isAdmin = Utils.is_admin(ctx) checkAdmin = self.settings.getServerStat(ctx.guild, "AdminArray") @@ -619,14 +616,25 @@ async def gamble(self, ctx, bet = None): xpblock = self.settings.getServerStat(server, "XpBlockArray") approve = True - decrement = True - + decrement = True + betAll = False + roundDown = False # Check Bet - - if not bet % 10 == 0: + if type(bet) == str: + if bet.upper() == "all": + betAll = True + bet = reserveXP + + try: + bet = int(float(bet)) + except: + return await ctx.send(msg) + if not bet % 10 == 0 and not betAll: approve = False msg = 'Bets must be in multiples of *10!*' - + elif not bet % 10 == 0 and betAll: + roundDown = True + bet = (bet // 10) * 10 if bet > int(reserveXP): approve = False msg = 'You can\'t bet *{:,}*, you only have *{:,}* xp reserve!'.format(bet, reserveXP) @@ -709,11 +717,11 @@ async def gamble(self, ctx, bet = None): if randnum == 1: # YOU WON!! self.settings.incrementStat(author, server, "XP", int(payout)) - msg = '*{}* bet *{:,}* and ***WON*** *{:,} xp!*'.format(DisplayName.name(author), bet, int(payout)) + msg = '*{}* bet *{:,}* and ***WON*** *{:,} xp!* **{}**'.format(DisplayName.name(author), bet, int(payout), f"Note that you betted all but it was not a multiple of 10, so you were rounded to the nearest 10. You did not lose the spare." if betAll and roundDown else "") # Now we check for promotions await CheckRoles.checkroles(author, channel, self.settings, self.bot) else: - msg = '*{}* bet *{:,}* and.... *didn\'t* win. Better luck next time!'.format(DisplayName.name(author), bet) + msg = '*{}* bet *{:,}* and.... *didn\'t* win. Better luck next time! **{}**'.format(DisplayName.name(author), bet, f"Note that you betted all but it was not a multiple of 10, so you were rounded to the nearest 10. You did not lose the spare." if betAll and roundDown else "") await ctx.send(msg)