aboutsummaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorGravatar jesopo2018-10-11 14:13:37 +0100
committerGravatar jesopo2018-10-11 14:13:37 +0100
commit3d2acc2f61f2d44bae2f825dd5ff9ec79ee1a4ce (patch)
treec35ba5e833a0f8fdddbb9908b2ed26d17c7c3e5f /modules
parentAdd !py as an alias of !python in modules/eval_python.py (diff)
signature
Don't calculate `user_coins(+/-)coin_bet` twice
Diffstat (limited to 'modules')
-rw-r--r--modules/coins.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/coins.py b/modules/coins.py
index 43c1e653..63f4a77a 100644
--- a/modules/coins.py
+++ b/modules/coins.py
@@ -167,21 +167,21 @@ class Module(object):
win = side_name == chosen_side
if win:
- event["user"].set_setting("coins", str(user_coins+coin_bet))
+ new_coins = str(user_coins+coin_bet)
+ event["user"].set_setting("coins", new_coins)
event["stdout"].write(
"%s flips %s and wins %s coin%s! (new total: %s)" % (
event["user"].nickname, side_name, coin_bet_str,
- "" if coin_bet == 1 else "s",
- user_coins+coin_bet
+ "" if coin_bet == 1 else "s", new_coins
)
)
else:
- event["user"].set_setting("coins", str(user_coins-coin_bet))
+ new_coins = str(user_coins-coin_bet)
+ event["user"].set_setting("coins", new_coins)
event["stdout"].write(
"%s flips %s and loses %s coin%s! (new total: %s)" % (
event["user"].nickname, side_name, coin_bet_str,
- "" if coin_bet == 1 else "s",
- user_coins-coin_bet
+ "" if coin_bet == 1 else "s", new_coins
)
)