cron events no longer have timers

This commit is contained in:
jesopo 2019-12-13 16:26:51 +00:00
parent e82f0854cc
commit 8a963b5288

View file

@ -436,7 +436,7 @@ class Module(ModuleManager.BaseModule):
@utils.hook("cron") @utils.hook("cron")
@utils.kwarg("schedule", "0 *") @utils.kwarg("schedule", "0 *")
def _interest(self, timer): def _interest(self, event):
for server in self.bot.servers.values(): for server in self.bot.servers.values():
if not server.get_setting("coin-interest", False): if not server.get_setting("coin-interest", False):
continue continue
@ -451,7 +451,6 @@ class Module(ModuleManager.BaseModule):
interest = round(coins*interest_rate, 2) interest = round(coins*interest_rate, 2)
server.set_user_setting(nickname, "coins", server.set_user_setting(nickname, "coins",
self._coin_str(coins+interest)) self._coin_str(coins+interest))
timer.redo()
@utils.hook("received.command.lotterybuy", authenticated=True) @utils.hook("received.command.lotterybuy", authenticated=True)
def lottery_buy(self, event): def lottery_buy(self, event):
@ -536,7 +535,7 @@ class Module(ModuleManager.BaseModule):
@utils.hook("cron") @utils.hook("cron")
@utils.kwarg("schedule", "0 */6") @utils.kwarg("schedule", "0 */6")
def _lottery(self, timer): def _lottery(self, event):
for server in self.bot.servers.values(): for server in self.bot.servers.values():
lottery = server.get_setting("lottery", {}) lottery = server.get_setting("lottery", {})
if lottery: if lottery:
@ -557,4 +556,3 @@ class Module(ModuleManager.BaseModule):
server.set_setting("lottery-winner", user.nickname) server.set_setting("lottery-winner", user.nickname)
user.send_notice("You won %s in the lottery! you now have %s coins" user.send_notice("You won %s in the lottery! you now have %s coins"
% (self._coin_str(winnings), self._coin_str(new_coins))) % (self._coin_str(winnings), self._coin_str(new_coins)))
timer.redo()