From b9515aa1fc47f41f0567ac938ae5d7f05fcdd1f7 Mon Sep 17 00:00:00 2001 From: ar-cyber Date: Sun, 18 Jan 2026 11:53:00 +1030 Subject: [PATCH 1/4] all betting all in gamble --- Cogs/Xp.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Cogs/Xp.py b/Cogs/Xp.py index d866d737..c836ad77 100644 --- a/Cogs/Xp.py +++ b/Cogs/Xp.py @@ -602,10 +602,7 @@ async def gamble(self, ctx, bet = None): # 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) - try: - bet = int(float(bet)) - except: - return await ctx.send(msg) + isAdmin = Utils.is_admin(ctx) checkAdmin = self.settings.getServerStat(ctx.guild, "AdminArray") @@ -622,7 +619,13 @@ async def gamble(self, ctx, bet = None): decrement = True # Check Bet - + if bet == "all": + bet = reserveXP + + try: + bet = int(float(bet)) + except: + return await ctx.send(msg) if not bet % 10 == 0: approve = False msg = 'Bets must be in multiples of *10!*' From 2f48dd5ca8eb8025b60e135cda13d728e005d6c3 Mon Sep 17 00:00:00 2001 From: ar-cyber Date: Sun, 18 Jan 2026 11:53:24 +1030 Subject: [PATCH 2/4] update gamble info string --- Cogs/Xp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cogs/Xp.py b/Cogs/Xp.py index c836ad77..e21da067 100644 --- a/Cogs/Xp.py +++ b/Cogs/Xp.py @@ -600,7 +600,7 @@ 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) From c0b6df53f2eda9eb6069471a6188501a4114d62a Mon Sep 17 00:00:00 2001 From: ar-cyber Date: Sun, 18 Jan 2026 15:12:51 +1030 Subject: [PATCH 3/4] round down if there's spare (corp pls review) --- Cogs/Xp.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Cogs/Xp.py b/Cogs/Xp.py index e21da067..27fb8067 100644 --- a/Cogs/Xp.py +++ b/Cogs/Xp.py @@ -616,20 +616,24 @@ 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 bet == "all": + betAll = True bet = reserveXP try: bet = int(float(bet)) except: return await ctx.send(msg) - if not bet % 10 == 0: + 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) @@ -712,11 +716,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) From 319f5b04c291762dc9b5aebe0535123c63e6e585 Mon Sep 17 00:00:00 2001 From: ar-cyber Date: Sun, 18 Jan 2026 18:17:38 +1030 Subject: [PATCH 4/4] force upper conversion of all --- Cogs/Xp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Cogs/Xp.py b/Cogs/Xp.py index 27fb8067..a8c65530 100644 --- a/Cogs/Xp.py +++ b/Cogs/Xp.py @@ -620,9 +620,10 @@ async def gamble(self, ctx, bet = None): betAll = False roundDown = False # Check Bet - if bet == "all": - betAll = True - bet = reserveXP + if type(bet) == str: + if bet.upper() == "all": + betAll = True + bet = reserveXP try: bet = int(float(bet))