Only allow users to send coins to users that have had coins before
This commit is contained in:
parent
d8466ecf6d
commit
5aa73cd64b
1 changed files with 7 additions and 2 deletions
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in a new issue