.cookie f-string + startswith

This commit is contained in:
Context 77
2024-08-03 01:18:42 +02:00
parent 55e09acff3
commit bb8751ed7f

View File

@@ -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
)