Update client.py

This commit is contained in:
2026-02-17 10:54:03 +01:00
parent d1b4d9f80a
commit 7f8e8a4baf

View File

@@ -14,7 +14,7 @@ groen = "\x1b[92m"
rood = "\x1b[91m"
reset = "\x1b[0m"
commands = ["/add", "/quit", "/break", "/users"]
commands = ["/add", "/quit", "/break", "/users", "/rm"]
chat_users = []
chat_messages = []
lock = threading.Lock()
@@ -185,6 +185,18 @@ def chat_session(chatkeuze):
if bericht.lower() == "/quit":
exit()
elif bericht.lower().startswith("/rm "):
# verwacht: /rm 3 → verwijdert bericht index 3
try:
index = int(bericht.split(" ", 1)[1])
s.sendall(json.dumps({
"action": "remove_message",
"chat_name": chatkeuze,
"index": index,
"by": current_user
}).encode("utf-8"))
except:
print("Ongeldige index")
elif bericht.lower() == "/break":
break
elif bericht.lower() == "/users":