From 196cb5d8b8132591bcf093f7f0816e2d818689c5 Mon Sep 17 00:00:00 2001 From: p3zq <67747740+p3zq@users.noreply.github.com> Date: Sun, 10 Sep 2023 20:22:35 +0100 Subject: [PATCH] Fix Websockets/Chat: Prefixing Username to Messages Interferes with Server Commands (#634) Co-authored-by: p3zq <> --- websockets/chat/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/websockets/chat/client.py b/websockets/chat/client.py index a2aead24..eb1998d2 100755 --- a/websockets/chat/client.py +++ b/websockets/chat/client.py @@ -41,7 +41,10 @@ async def start_client(url: str) -> None: # Exit with Ctrl+D while line := await asyncio.to_thread(sys.stdin.readline): - await ws.send_str(name + ": " + line) + if line.startswith("/"): + await ws.send_str(line) + else: + await ws.send_str(name + ": " + line) dispatch_task.cancel() with suppress(asyncio.CancelledError):