From 729c581682d9ee2c49967a7a63eb48e0bd78744e Mon Sep 17 00:00:00 2001 From: gbtami Date: Wed, 25 Dec 2024 17:27:37 +0100 Subject: [PATCH] Add test chat message on aouto pairing submit/cancel --- server/wsl.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/server/wsl.py b/server/wsl.py index 3a58c80b2..5b0ce62ec 100644 --- a/server/wsl.py +++ b/server/wsl.py @@ -1,6 +1,7 @@ from __future__ import annotations import asyncio import logging +from time import time import aiohttp_session from aiohttp import web @@ -25,6 +26,7 @@ from misc import server_state from newid import new_id from const import TYPE_CHECKING +from settings import DEV if TYPE_CHECKING: from pychess_global_app_state import PychessGlobalAppState @@ -365,12 +367,27 @@ async def handle_cancel_auto_pairing(app_state, ws, user, data): for user_ws in user.lobby_sockets: await ws_send_json(user_ws, {"type": "auto_pairing_off"}) + if DEV: + msg = "Auto pairing cancelled." + await app_state.lobby.lobby_chat("server", "%s: %s" % (user.username, msg), int(time())) + async def handle_create_auto_pairing(app_state, ws, user, data): no = await send_game_in_progress_if_any(app_state, user, ws) if no: return + if DEV: + variants = ",".join((v[0] + ("960" if v[1] else "") for v in data["variants"])) + msg = "%s: %s %s %s %s" % ( + user.username, + variants, + data["tcs"], + data["rrmin"], + data["rrmax"], + ) + await app_state.lobby.lobby_chat("server", msg, int(time())) + auto_variant_tc, matching_user, matching_seek = add_to_auto_pairings(app_state, user, data) auto_paired = False