plugin: add forgotten signal_failure method
This commit is contained in:
parent
5ed9d2f3ce
commit
74343e2a24
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue