Show default wallet for wallet types when you don't specify 2 args to
!defaultwallet
This commit is contained in:
parent
e614eb8e75
commit
dd99460390
1 changed files with 13 additions and 9 deletions
|
@ -269,21 +269,25 @@ class Module(ModuleManager.BaseModule):
|
|||
"to your default wallet" % (event["user"].nickname, wallet))
|
||||
|
||||
@utils.hook("received.command.defaultwallet", authenticated=True,
|
||||
min_args=2)
|
||||
min_args=1)
|
||||
def default_wallet(self, event):
|
||||
"""
|
||||
:help: Set a default wallet for a given wallet type
|
||||
:usage: <type> <wallet>
|
||||
"""
|
||||
type = event["args_split"][0]
|
||||
wallet = event["args_split"][1]
|
||||
if not self._user_has_wallet(event["user"], wallet):
|
||||
raise utils.EventError("%s: Unknown wallet" %
|
||||
event["user"].nickname)
|
||||
|
||||
self._set_default_wallet(event["user"], type, wallet)
|
||||
event["stdout"].write("%s: Set default wallet for '%s' to '%s'" %
|
||||
(event["user"].nickname, type, wallet))
|
||||
if len(event["args_split"]) > 1:
|
||||
wallet = event["args_split"][1]
|
||||
if not self._user_has_wallet(event["user"], wallet):
|
||||
raise utils.EventError("%s: Unknown wallet" %
|
||||
event["user"].nickname)
|
||||
self._set_default_wallet(event["user"], type, wallet)
|
||||
event["stdout"].write("%s: Set default wallet for '%s' to '%s'" %
|
||||
(event["user"].nickname, type, wallet))
|
||||
else:
|
||||
wallet = self._default_wallet_for(event["user"], type)
|
||||
event["stdout"].write("%s: Your default wallet for '%s' is '%s'" %
|
||||
(event["user"].nickname, type, wallet))
|
||||
|
||||
@utils.hook("received.command.resetcoins", min_args=1)
|
||||
def reset_coins(self, event):
|
||||
|
|
Loading…
Reference in a new issue