diff options
| author | 2018-09-05 12:58:30 +0100 | |
|---|---|---|
| committer | 2018-09-05 12:58:30 +0100 | |
| commit | 12143af562c021d83a96470e65275abf70576702 (patch) | |
| tree | f2e6f52c3e9b885534b6be0fc31b9dd4ab191fda /modules | |
| parent | Don't use IRCUser.id ever, use IRCUser.get_id() (diff) | |
| signature | ||
Add another control to prevent coin duplication if someone manages to send coins
to themselves
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/coins.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/coins.py b/modules/coins.py index 735d404d..efb60edd 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -188,9 +188,13 @@ class Module(object): event["stderr"].write("You can only send coins to users that " "have had coins before") return - target_user_coins = decimal.Decimal(target_user_coins) event["user"].set_setting("coins", str(new_user_coins)) + # get target_user_coins again, just in case *somehow* someone's + # sending coins to themselves. + target_user_coins = target_user.get_setting("coins", None) + target_user_coins = decimal.Decimal(target_user_coins) + target_user.set_setting("coins", str(target_user_coins+send_amount)) event["stdout"].write("%s sent %s coins to %s" % ( |
