improve pfouah with flumzo (????????)

This commit is contained in:
Adrien Abraham 2023-11-26 16:47:36 +01:00
parent 9f8ed09a5c
commit e206c4809a
2 changed files with 24 additions and 7 deletions

View file

@ -122,7 +122,8 @@
"pfouah_sentence": "Folks, I think I'm {word}!", "pfouah_sentence": "Folks, I think I'm {word}!",
"pfouah1": ["doo", "da"], "pfouah1": ["doo", "da"],
"pfouah2": ["lo", "di"], "pfouah2": ["lo", "di"],
"pfouah3": ["zzeld", "ddled"] "pfouah3": ["zzel", "ddle"]
"pfouah_suffix": "d"]
}, },
"mood": { "mood": {
"commands": ["calm down"], "commands": ["calm down"],

View file

@ -1,4 +1,5 @@
import random import random
from typing import Optional
from irc.client import NickMask from irc.client import NickMask
@ -32,6 +33,7 @@ class MiscReactionsPlugin(Plugin):
"repeat_letters", "repeat_letters",
"nudge", "nudge",
"pfouah", "pfouah",
"flumzo",
] ]
) )
@ -181,20 +183,34 @@ class MiscReactionsPlugin(Plugin):
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): def _generate_flumzo(self) -> Optional[str]:
"""Sigh and say you're feeling like a made-up word.""" """I'm gonna stop writing docstrings for this shit."""
if any( if any(
k not in self.config k not in self.config
for k in ("pfouah_sentence", "pfouah1", "pfouah2", "pfouah3") for k in ("pfouah_sentence", "pfouah1", "pfouah2", "pfouah3")
): ):
return return None
length = random.choice((2, 3)) length = random.choice((2, 3))
word = random.choice(self.config["pfouah1"]) word = random.choice(self.config["pfouah1"])
if length == 3: if length == 3:
word += random.choice(self.config["pfouah2"]) word += random.choice(self.config["pfouah2"])
word += random.choice(self.config["pfouah3"]) word += random.choice(self.config["pfouah3"])
return word
text = self.config["pfouah_sentence"].format(word=word) def react_with_pfouah(self, event):
"""Sigh and say you're feeling like a made-up word."""
suffix = self.config.get("pfouah_suffix")
if suffix is None:
return
flumzo = self._generate_flumzo()
if flumzo is None:
return
flumzo += suffix
text = self.config["pfouah_sentence"].format(word=flumzo)
self.bot.say(event.target, text) self.bot.say(event.target, text)
return True
def react_with_flumzo(self, event):
"""Same as "pfouah" but the word is said on its own."""
flumzo = self._generate_flumzo()
if flumzo is not None:
self.bot.say(event.target, flumzo)