Compare commits
No commits in common. "1e9f10d5492882cabd8ba7f3a4ce1fef63749494" and "5f4af12a2f829b25851a84557304b7101318edee" have entirely different histories.
1e9f10d549
...
5f4af12a2f
|
@ -149,7 +149,6 @@ class Bot(irc.client.SimpleIRCClient, Logger):
|
||||||
|
|
||||||
def say(self, target, message):
|
def say(self, target, message):
|
||||||
"""Send message to target after a slight delay."""
|
"""Send message to target after a slight delay."""
|
||||||
message = message.replace("\n", " ").replace("\r", " ")
|
|
||||||
time.sleep(self.config["speak_delay"])
|
time.sleep(self.config["speak_delay"])
|
||||||
self.log_d(f"Sending to {target}: {message}")
|
self.log_d(f"Sending to {target}: {message}")
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -19,21 +19,16 @@ class JourneeMondialePlugin(Plugin):
|
||||||
def on_pubmsg(self, event):
|
def on_pubmsg(self, event):
|
||||||
if not self.should_handle_command(event.arguments[0], no_content=True):
|
if not self.should_handle_command(event.arguments[0], no_content=True):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
response = http_get(self.config["url"])
|
response = http_get(self.config["url"])
|
||||||
if not response:
|
if not response:
|
||||||
self.signal_failure(event.target)
|
self.signal_failure(event.target)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
soup = BeautifulSoup(response, "html.parser")
|
soup = BeautifulSoup(response, "html.parser")
|
||||||
try:
|
try:
|
||||||
jm = soup.find("div", id="journeesDuJour").find("h2").string
|
jm = soup.find("div", id="journeesDuJour").find("h2").string
|
||||||
except (ValueError, KeyError):
|
except (ValueError, KeyError):
|
||||||
self.signal_failure(event.target)
|
self.signal_failure(event.target)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if jm:
|
if jm:
|
||||||
self.bot.say(event.target, jm)
|
self.bot.say(event.target, jm)
|
||||||
else:
|
|
||||||
self.signal_failure(event.target)
|
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -150,14 +150,6 @@ class MiscReactionsPlugin(Plugin):
|
||||||
if len(words) == 0:
|
if len(words) == 0:
|
||||||
return
|
return
|
||||||
biggest_word = sorted(words, key=lambda w: len(w))[-1]
|
biggest_word = sorted(words, key=lambda w: len(w))[-1]
|
||||||
num_repeats = 2
|
|
||||||
repeated = biggest_word[:num_repeats]
|
|
||||||
while (
|
|
||||||
(not any(letter in repeated for letter in "aeiouy"))
|
|
||||||
and len(repeated) < len(biggest_word)
|
|
||||||
):
|
|
||||||
num_repeats += 1
|
|
||||||
repeated = biggest_word[:num_repeats]
|
|
||||||
word = biggest_word[:2] + biggest_word
|
word = biggest_word[:2] + biggest_word
|
||||||
question_mark = self.config["question_mark"]
|
question_mark = self.config["question_mark"]
|
||||||
reply = f"{word}{question_mark}"
|
reply = f"{word}{question_mark}"
|
||||||
|
|
Loading…
Reference in a new issue