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

master
Adrien Abraham 5 months ago
parent 9f8ed09a5c
commit e206c4809a

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

@ -1,4 +1,5 @@
import random
from typing import Optional
from irc.client import NickMask
@ -32,6 +33,7 @@ class MiscReactionsPlugin(Plugin):
"repeat_letters",
"nudge",
"pfouah",
"flumzo",
]
)
@ -181,20 +183,34 @@ class MiscReactionsPlugin(Plugin):
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."""
def _generate_flumzo(self) -> Optional[str]:
"""I'm gonna stop writing docstrings for this shit."""
if any(
k not in self.config
for k in ("pfouah_sentence", "pfouah1", "pfouah2", "pfouah3")
):
return
return None
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"])
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)
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)

Loading…
Cancel
Save