modmail f-string + only react when startswith.

This commit is contained in:
Context 77
2024-08-02 23:32:10 +02:00
parent af44c49eb1
commit 1902a8342f

View File

@@ -12,10 +12,9 @@ class ModmailObserver(PrivMsgObserverPrototype):
return ".modmail <msg> - Sendet allen Moderatoren <msg> 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}")