From 9ae4bf7dc534f7c4b367cb3309724d3df41748c7 Mon Sep 17 00:00:00 2001 From: aikaterna <20862007+aikaterna@users.noreply.github.com> Date: Sun, 28 Jun 2020 17:59:31 -0400 Subject: [PATCH] [Snacktime] Fix for no pb on max balance --- snacktime/phrases.py | 2 +- snacktime/snacktime.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/snacktime/phrases.py b/snacktime/phrases.py index 43aa5f5..f1a827d 100644 --- a/snacktime/phrases.py +++ b/snacktime/phrases.py @@ -5,7 +5,7 @@ FRIENDS = { "Satin": "▼・ᴥ・▼ <", "Thunky": "ᘛ⁐̤ᕐᐷ <", "Jingle": "꒰∗´꒳`꒱ <", - "FluffButt": "/ᐠ。ꞈ。ᐟ\ <", + "FluffButt": r"/ᐠ。ꞈ。ᐟ\ <", "Staplefoot": "( ̄(エ) ̄) <", } diff --git a/snacktime/snacktime.py b/snacktime/snacktime.py index d099db6..62892b8 100644 --- a/snacktime/snacktime.py +++ b/snacktime/snacktime.py @@ -5,6 +5,7 @@ from random import randint from random import choice as randchoice from redbot.core import bank, checks, commands, Config +from redbot.core.errors import BalanceTooHigh from redbot.core.utils.chat_formatting import box, humanize_list, pagify from .phrases import FRIENDS, SNACKBURR_PHRASES @@ -225,7 +226,7 @@ class Snacktime(commands.Cog): return else: phrases = [ - "Don't look at me. I donno where snackburr's at ¯\_(ツ)_/¯", + r"Don't look at me. I donno where snackburr's at ¯\_(ツ)_/¯", "I hear snackburr likes parties. *wink wink", "I hear snackburr is attracted to channels with active conversations", "If you party, snackburr will come! 〈( ^o^)ノ", @@ -439,10 +440,13 @@ class Snacktime(commands.Cog): resp = await self.get_response(message, "LAST_SECOND") resp = resp.format(message.author.name, snackAmt) await message.channel.send(resp) - await bank.deposit_credits(message.author, snackAmt) - except: + try: + await bank.deposit_credits(message.author, snackAmt) + except BalanceTooHigh as b: + await bank.set_balance(message.author, b.max_balance) + except Exception as e: log.info( - f"Snacktime: Failed to send pb message. {message.author.name} didn't get pb" + f"Failed to send pb message. {message.author.name} didn't get pb\n", exc_info=True ) else: