When deleting a wallet, shift funds to default 'in' wallet instead of assuming a

user has a 'default' named wallet
This commit is contained in:
jesopo 2018-10-22 16:49:20 +01:00
parent e4be2cf339
commit 046e8935df

View file

@ -266,10 +266,11 @@ class Module(ModuleManager.BaseModule):
(event["user"].nickname, wallet, default_type))
coins = self._get_user_coins(event["user"], wallet)
self._give(event["server"], event["user"], coins, WALLET_DEFAULT_NAME)
in_wallet = self._default_wallet(event["user"], "in")
self._give(event["server"], event["user"], coins, in_wallet)
self._remove_user_wallet(event["user"], wallet)
event["stdout"].write("%s: removed wallet '%s' and shifted any funds "
"to your default wallet" % (event["user"].nickname, wallet))
"to your default 'in' wallet" % (event["user"].nickname, wallet))
@utils.hook("received.command.defaultwallet", authenticated=True,
min_args=1)