From 55e09acff31850a04656295de9f3655b1c7889bc Mon Sep 17 00:00:00 2001 From: Context 77 <126421199+ctx77@users.noreply.github.com> Date: Sat, 3 Aug 2024 01:16:25 +0200 Subject: [PATCH] =?UTF-8?q?.hug=20f-string=20and=20hug-variations=20(added?= =?UTF-8?q?=20umarmt=20und=20dr=C3=BCckt)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FaustBot/Modules/FreeHugsObserver.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/FaustBot/Modules/FreeHugsObserver.py b/FaustBot/Modules/FreeHugsObserver.py index 78f4787..67bf96e 100644 --- a/FaustBot/Modules/FreeHugsObserver.py +++ b/FaustBot/Modules/FreeHugsObserver.py @@ -1,3 +1,5 @@ +import random + from FaustBot.Communication import Connection from FaustBot.Modules.PrivMsgObserverPrototype import PrivMsgObserverPrototype @@ -12,6 +14,6 @@ class FreeHugsObserver(PrivMsgObserverPrototype): return ".hug - verteilt Umarmungen" def update_on_priv_msg(self, data: dict, connection: Connection): - if data['message'].find('.hug') == -1: - return - connection.send_back('\001ACTION knuddelt ' + data['nick'] + '.\001', data) + if data["message"].startswith(".hug"): + hug_word = random.choice(["umarmt", "knuddelt", "drückt"]) + connection.send_back(f"\001ACTION {hug_word} {data['nick']}.\001", data)