.hug multi-variant edition

This commit is contained in:
Context 77
2024-08-03 19:56:28 +02:00
parent e1f5ed4aaa
commit f0b498d7dd

View File

@@ -5,6 +5,18 @@ from FaustBot.Modules.PrivMsgObserverPrototype import PrivMsgObserverPrototype
class FreeHugsObserver(PrivMsgObserverPrototype):
hug_variants = [
"nimmt {{nick}}{hug_adjective} in die Arme",
"{hug_word} {{nick}}{hug_adjective}",
]
possible_hugs = {
variant.format(hug_word=word, hug_adjective=adjective)
for variant in hug_variants
for word in ["umarmt", "knuddelt", "drückt", "herzt"]
for adjective in [" fest", " herzlichst", " sanft", ""]
}
possible_hugs = list(possible_hugs)
@staticmethod
def cmd():
return [".hug"]
@@ -15,5 +27,5 @@ class FreeHugsObserver(PrivMsgObserverPrototype):
def update_on_priv_msg(self, data: dict, connection: Connection):
if data["message"].startswith(".hug"):
hug_word = random.choice(["umarmt", "knuddelt", "drückt", "herzt"])
connection.send_back(f"\001ACTION {hug_word} {data['nick']}.\001", data)
hug_response = (random.choice(self.possible_hugs)).format(nick=data["nick"])
connection.send_back(f"\001ACTION {hug_response}.\001", data)