Only allow users to send coins to users that have had coins before

This commit is contained in:
jesopo 2018-08-28 12:45:42 +01:00
parent d8466ecf6d
commit 5aa73cd64b

View file

@ -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))