diff options
| author | 2018-08-28 12:45:42 +0100 | |
|---|---|---|
| committer | 2018-08-28 12:45:42 +0100 | |
| commit | 5aa73cd64bbaf031d526682b000f26eaff619e1f (patch) | |
| tree | d5edda005533e5ec2cd5f637ed04485b3cd53b4f /modules | |
| parent | Require authentication to use or potentially lose coins (diff) | |
| signature | ||
Only allow users to send coins to users that have had coins before
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/coins.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/coins.py b/modules/coins.py index 954c0c33..e0c100d1 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -183,8 +183,13 @@ class Module(object): " you below %s coins" % "{0:.2f}".format(redeem_amount)) return target_user = event["server"].get_user(event["args_split"][0]) - target_user_coins = decimal.Decimal(target_user.get_setting( - "coins", "0.0")) + target_user_coins = target_user.get_setting("coins", None) + if target_user_coins == None: + 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)) target_user.set_setting("coins", str(target_user_coins+send_amount)) |
