From f091f91f5449c9466402448ecc88938e45964a39 Mon Sep 17 00:00:00 2001 From: Someone Date: Mon, 10 Jan 2022 18:13:06 +0100 Subject: [PATCH] modules/CommandDrink.py --- modules/CommandDrink.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/CommandDrink.py b/modules/CommandDrink.py index 9f88c7c..540daf9 100644 --- a/modules/CommandDrink.py +++ b/modules/CommandDrink.py @@ -28,7 +28,7 @@ class CommandDrink(AbstractCommand): def on_POST(self, request, data, rerun=True): try: - apirequest = dict() + apirequest = {} apirequest["act"] = "create_token_secret" handle = MCAPI.API("KEYBOARD", self.drink_terminal_user, self.drink_terminal_pass) token_secret = handle.api_request(apirequest) @@ -36,8 +36,8 @@ class CommandDrink(AbstractCommand): MCAPI.API.token_secret = token_secret["token_secret"] account_data = handle.get_account_info() msg = ":arrow_right: Available credits:``"+str(account_data["account_info"]["balance"])+"``" - except MCAPI.APIException as e: - if e.message == "CERR_AUTH_FAIL_INVALID_token": + except MCAPI.APIException as exc: + if exc.message == "CERR_AUTH_FAIL_INVALID_token": request.respond_cmd_temp(cleandoc(""" :stop_sign: Mattermost account seems to not be bound to any drink-terminal account. :( Use ``/drink-bind-account `` to bind this Mattermost account to your drink-terminal account. @@ -93,11 +93,11 @@ class CommandDrink(AbstractCommand): "\n:white_check_mark: Sucessfully paid **``"+str(int(shortcut["amount"])*count)+"``** TO **``"+str(shortcut["target"])+"``** FOR **``"+str(shortcut["reason"])+"``** :beers:" ) - except MCAPI.APIException as e: - if e.message == "CERR_AUTH_FAIL_ACCTOK": + except MCAPI.APIException as exc: + if exc.message == "CERR_AUTH_FAIL_ACCTOK": msg += "\n:stop_sign: Mattermost account seems to not be bound to any drink-terminal account. :(" - elif e.message == "CERR_FAILED_TO_SEND": + elif exc.message == "CERR_FAILED_TO_SEND": msg += "\n:stop_sign: Failed to send drink-credits. Balance exceeded? Sending too much? :(\nTried to send **``"+str(int(shortcut["amount"])*count)+"``** TO **``"+str(shortcut["target"])+"``** FOR **``"+str(shortcut["reason"])+"``**" request.respond_cmd_err(msg) -- 2.43.0