From 1902a8342f91a8c77cfd9d22057edf4aa932de6b Mon Sep 17 00:00:00 2001 From: Context 77 <126421199+ctx77@users.noreply.github.com> Date: Fri, 2 Aug 2024 23:32:10 +0200 Subject: [PATCH] modmail f-string + only react when startswith. --- .../Modules/CustomUserModules/ModmailObserver.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/FaustBot/Modules/CustomUserModules/ModmailObserver.py b/FaustBot/Modules/CustomUserModules/ModmailObserver.py index c38aabb..060ea9b 100644 --- a/FaustBot/Modules/CustomUserModules/ModmailObserver.py +++ b/FaustBot/Modules/CustomUserModules/ModmailObserver.py @@ -12,10 +12,9 @@ class ModmailObserver(PrivMsgObserverPrototype): return ".modmail - Sendet allen Moderatoren per PN" def update_on_priv_msg(self, data, connection: Connection): - if data['message'].find('.modmail') == -1: - return - mods = connection.details.get_mods() - print(mods) - message = data['message'].split('.modmail ')[1] - for mod in mods: - connection.send_to_user(mod, data['nick'] + ' meldet: ' + message) + if data["message"].startswith(".modmail"): + mods = connection.details.get_mods() + print(mods) + message = data["message"].split(".modmail ")[1] + for mod in mods: + connection.send_to_user(mod, f"{data['nick']} meldet: {message}")