Don't persist timer, use events.on("send.stdout")

This commit is contained in:
jesopo 2018-09-01 19:07:50 +01:00 committed by Dan
parent efb5c369c0
commit cbb6c928a1

View file

@ -47,7 +47,7 @@ class Module(object):
wait = self.get_random_duck_time() wait = self.get_random_duck_time()
self.bot.log.info("Sending out a wave of ducks in %s seconds", self.bot.log.info("Sending out a wave of ducks in %s seconds",
[wait]) [wait])
self.bot.add_timer("show-duck", wait) self.bot.add_timer("show-duck", wait, persist=False)
def bootstrap(self, event): def bootstrap(self, event):
for server in self.bot.servers.values(): for server in self.bot.servers.values():
@ -210,12 +210,11 @@ class Module(object):
channel.set_setting("active-duck", False) channel.set_setting("active-duck", False)
def duck_decoy(self, event): def duck_decoy(self, event):
event["stdout"].write(random.choice(DUCK_LIST)) self.events.on("send").on("stdout").call(target=event["channel"],
module_name="Ducks", server=event["server"],
message=random.choice(DUCK_LIST))
def set_decoy(self, event): def set_decoy(self, event):
channel = event["target"]
next_decoy_time = self.get_random_duck_time() next_decoy_time = self.get_random_duck_time()
self.bot.add_timer("duck-decoy", next_decoy_time, persist=False,
self.bot.add_timer("duck-decoy", next_decoy_time, None, None, False, server=event["server"], channel=event["target"])
channel=channel)