misc_reactions: add pfouah generator

master
Adrien Abraham 5 months ago
parent 7a01e67934
commit 48233e5ed3

@ -108,7 +108,7 @@
"miscreactions": {
"reactions": [
"stop", "king", "mmm", "ooo", "detector", "question_marks",
"repeat_letters", "nudge"
"repeat_letters", "nudge", "pfouah"
],
"rate": 0,
"stop_message": "This was your last {subject}...",
@ -118,7 +118,11 @@
"detector_process": "...",
"detector_pos": "OK go on...",
"detector_neg": "Halt!",
"nudging": "/me nudges {target}"
"nudging": "/me nudges {target}",
"pfouah_sentence": "Folks, I think I'm {word}!",
"pfouah1": ["doo", "da"],
"pfouah2": ["lo", "di"],
"pfouah3": ["zzeld", "ddled"]
},
"mood": {
"commands": ["calm down"],

@ -31,6 +31,7 @@ class MiscReactionsPlugin(Plugin):
"detector",
"repeat_letters",
"nudge",
"pfouah",
]
)
@ -160,13 +161,14 @@ class MiscReactionsPlugin(Plugin):
return
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):
repeated_prefix = biggest_word[:num_repeats]
while (
(not any(letter in repeated_prefix for letter in "aeiouy"))
and len(repeated_prefix) < len(biggest_word)
):
num_repeats += 1
repeated = biggest_word[:num_repeats]
word = biggest_word[:2] + biggest_word
repeated_prefix = biggest_word[:num_repeats]
word = repeated_prefix + biggest_word
question_mark = self.config["question_mark"]
reply = f"{word}{question_mark}"
self.bot.say(event.target, reply)
@ -178,3 +180,21 @@ class MiscReactionsPlugin(Plugin):
if reply is None:
return
self.bot.say(event.target, reply.format(target=nick))
def react_with_pfouah(self, event):
"""Sigh and say you're feeling like a made-up word."""
if any(
k not in self.config
for k in ("pfouah_sentence", "pfouah1", "pfouah2", "pfouah3")
):
return
length = random.choice((2, 3))
word = random.choice(self.config["pfouah1"])
if length == 3:
word += random.choice(self.config["pfouah2"])
word += random.choice(self.config["pfouah3"])
text = self.config["pfouah_sentence"].format(word=word)
self.bot.say(event.target, text)
return True

Loading…
Cancel
Save