From bb8751ed7fffdff435aad0bfe82d769ad0910805 Mon Sep 17 00:00:00 2001 From: Context 77 <126421199+ctx77@users.noreply.github.com> Date: Sat, 3 Aug 2024 01:18:42 +0200 Subject: [PATCH] .cookie f-string + startswith --- FaustBot/Modules/GiveCookieObserver.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/FaustBot/Modules/GiveCookieObserver.py b/FaustBot/Modules/GiveCookieObserver.py index 93933aa..08694a0 100644 --- a/FaustBot/Modules/GiveCookieObserver.py +++ b/FaustBot/Modules/GiveCookieObserver.py @@ -15,6 +15,7 @@ class GiveCookieObserver(PrivMsgObserverPrototype): return ".cookie - verteilt Kekse; oder auch nicht" def update_on_priv_msg(self, data: dict, connection: Connection): - if data['message'].find('.cookie') == -1: - return - connection.send_back('\001ACTION schenkt ' + data['nick'] + ' ' + random.choice(kekse) + '.\001', data) + if data["message"].startswith(".cookie"): + connection.send_back( + f"\001ACTION schenkt {data['nick']} {random.choice(kekse)}.\001", data + )