From 47e24eebaac73a535a19f13ff92d047375f18a83 Mon Sep 17 00:00:00 2001 From: dece Date: Tue, 29 Jun 2021 17:09:53 +0200 Subject: [PATCH] capture: release thing on the next ping --- edmond/plugins/capture.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/edmond/plugins/capture.py b/edmond/plugins/capture.py index 87fe484..ebe7948 100644 --- a/edmond/plugins/capture.py +++ b/edmond/plugins/capture.py @@ -15,6 +15,7 @@ class CapturePlugin(Plugin): def __init__(self, bot): super().__init__(bot) self.priority = -8 + self.release_in_channel = "" self.current_thing = None def on_pubmsg(self, event): @@ -26,10 +27,14 @@ class CapturePlugin(Plugin): return False if proc(self.config["rate"]): - self.release_thing(event.target) - return True + self.release_in_channel = event.target return False + def on_ping(self, event): + if self.release_in_channel: + self.release_thing(self.release_in_channel) + self.release_in_channel = "" + def release_thing(self, target): self.current_thing = random.choice(self.config["things"]) self.bot.say(target, f"(>O_O)> ~~{self.current_thing}")