diff --git a/edmond/plugin.py b/edmond/plugin.py index 4ab5a20..3f9e94a 100644 --- a/edmond/plugin.py +++ b/edmond/plugin.py @@ -93,6 +93,10 @@ class Plugin: content = " ".join(words[2:-1]) return Command(ident, content) + def signal_failure(self, target): + """Signal a plugin failure to target.""" + self.bot.say(target, self.bot.config["error_message"]) + @dataclass class Question: diff --git a/edmond/plugins/journee_mondiale.py b/edmond/plugins/journee_mondiale.py index 6872dfa..3618946 100644 --- a/edmond/plugins/journee_mondiale.py +++ b/edmond/plugins/journee_mondiale.py @@ -21,13 +21,13 @@ class JourneeMondialePlugin(Plugin): return False response = http_get(self.config["url"]) if not response: - self.signal_failure() + self.signal_failure(event.target) return True soup = BeautifulSoup(response, "html.parser") try: jm = soup.find("div", id="journeesDuJour").find("h2").string except (ValueError, KeyError): - self.signal_failure() + self.signal_failure(event.target) return True self.bot.say(event.target, jm) return True