diff options
| author | 2018-10-13 16:57:18 +0100 | |
|---|---|---|
| committer | 2018-10-13 16:57:18 +0100 | |
| commit | c6f87547167c41bd56fa215bfdc364446eae19a6 (patch) | |
| tree | 5a8751c80f67f5165418252e68310550da631352 | |
| parent | Add !totalcoins in modules/coins.py, to check what the total coins in (diff) | |
| signature | ||
Move functionality of finding total in-circulation coins out to it's own
function
| -rw-r--r-- | modules/coins.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/coins.py b/modules/coins.py index 3da26851..18e725ca 100644 --- a/modules/coins.py +++ b/modules/coins.py @@ -64,17 +64,18 @@ class Module(ModuleManager.BaseModule): event["stdout"].write("The Bank has %s coins" % "{0:.2f}".format(self._get_pool(event["server"]))) - @utils.hook("received.command.totalcoins") - def total_coins(self, event): - all_coins = event["server"].get_all_user_settings("coins", []) + def _total_coins(self, server: + all_coins = server.get_all_user_settings("coins", []) all_coins = list(filter(lambda coin: decimal.Decimal(coin[1]), all_coins)) all_coins = [decimal.Decimal(coin[1]) for coin in all_coins] all_coins = sum(all_coins) - pool = self._get_pool(event["server"]) + pool = self._get_pool(server) + @utils.hook("received.command.totalcoins") + def total_coins(self, event): event["stdout"].write("Total coins: %s" % "{0:.2f}".format( - pool+all_coins)) + self._total_coins(event["server"]))) @utils.hook("received.command.coins") def coins(self, event): |
