misc_reactions: improve stutter reaction

This commit is contained in:
dece 2021-12-02 11:31:30 +01:00
parent 5f4af12a2f
commit 56656dca98

View file

@ -150,6 +150,14 @@ class MiscReactionsPlugin(Plugin):
if len(words) == 0:
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)
):
num_repeats += 1
repeated = biggest_word[:num_repeats]
word = biggest_word[:2] + biggest_word
question_mark = self.config["question_mark"]
reply = f"{word}{question_mark}"