From ddcd99405a9be7122c22cb4312e91b5d71214652 Mon Sep 17 00:00:00 2001 From: jesopo Date: Mon, 22 Oct 2018 13:59:25 +0100 Subject: [PATCH] Add !movecoins in modules/coins.py --- modules/coins.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/coins.py b/modules/coins.py index fb96ea23..00c3974c 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -429,6 +429,25 @@ class Module(ModuleManager.BaseModule): ) ) + @utils.hook("received.command.movecoins", authenticated=True, min_args=3) + def move_coins(self, event): + """ + :help: Move coins between your wallets + :usage: + """ + wallet_1 = event["args_split"][0] + wallet_2 = event["args_split"][1] + amount = self._parse_coins(send_amount, DECIMAL_ZERO) + for wallet in [wallet_1, wallet_2]: + if not self._user_has_wallet(event["user"], wallet): + raise utils.EventError("%s: Unknown wallet '%s'" % + (event["user"].nickname, wallet)) + + self._move(event["user"], event["user"], amount, wallet_1, wallet_2) + event["stdout"].write("%s: Moved %s coins from wallet '%s' to " + "wallet '%s'" % (event["user"].nickname, self._coin_str(amount), + wallet_1, wallet_2)) + @utils.hook("received.command.sendcoins", min_args=2, authenticated=True) def send(self, event): """