misc_reactions: add pfouah generator
This commit is contained in:
parent
7a01e67934
commit
48233e5ed3
|
@ -108,7 +108,7 @@
|
||||||
"miscreactions": {
|
"miscreactions": {
|
||||||
"reactions": [
|
"reactions": [
|
||||||
"stop", "king", "mmm", "ooo", "detector", "question_marks",
|
"stop", "king", "mmm", "ooo", "detector", "question_marks",
|
||||||
"repeat_letters", "nudge"
|
"repeat_letters", "nudge", "pfouah"
|
||||||
],
|
],
|
||||||
"rate": 0,
|
"rate": 0,
|
||||||
"stop_message": "This was your last {subject}...",
|
"stop_message": "This was your last {subject}...",
|
||||||
|
@ -118,7 +118,11 @@
|
||||||
"detector_process": "...",
|
"detector_process": "...",
|
||||||
"detector_pos": "OK go on...",
|
"detector_pos": "OK go on...",
|
||||||
"detector_neg": "Halt!",
|
"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": {
|
"mood": {
|
||||||
"commands": ["calm down"],
|
"commands": ["calm down"],
|
||||||
|
|
|
@ -31,6 +31,7 @@ class MiscReactionsPlugin(Plugin):
|
||||||
"detector",
|
"detector",
|
||||||
"repeat_letters",
|
"repeat_letters",
|
||||||
"nudge",
|
"nudge",
|
||||||
|
"pfouah",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -160,13 +161,14 @@ class MiscReactionsPlugin(Plugin):
|
||||||
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
|
num_repeats = 2
|
||||||
repeated = biggest_word[:num_repeats]
|
repeated_prefix = biggest_word[:num_repeats]
|
||||||
while (not any(letter in repeated for letter in "aeiouy")) and len(
|
while (
|
||||||
repeated
|
(not any(letter in repeated_prefix for letter in "aeiouy"))
|
||||||
) < len(biggest_word):
|
and len(repeated_prefix) < len(biggest_word)
|
||||||
|
):
|
||||||
num_repeats += 1
|
num_repeats += 1
|
||||||
repeated = biggest_word[:num_repeats]
|
repeated_prefix = biggest_word[:num_repeats]
|
||||||
word = biggest_word[:2] + biggest_word
|
word = repeated_prefix + biggest_word
|
||||||
question_mark = self.config["question_mark"]
|
question_mark = self.config["question_mark"]
|
||||||
reply = f"{word}{question_mark}"
|
reply = f"{word}{question_mark}"
|
||||||
self.bot.say(event.target, reply)
|
self.bot.say(event.target, reply)
|
||||||
|
@ -178,3 +180,21 @@ class MiscReactionsPlugin(Plugin):
|
||||||
if reply is None:
|
if reply is None:
|
||||||
return
|
return
|
||||||
self.bot.say(event.target, reply.format(target=nick))
|
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…
Reference in a new issue