le caca coule au cucu

This commit is contained in:
2024-03-25 16:11:07 +01:00
committed by AdrienLSH
parent 602d4f300f
commit a6c27fc87a
7 changed files with 20 additions and 11 deletions

View File

@ -39,9 +39,9 @@ class MatchMaking(WebsocketConsumer):
self.disconnect(1000)
return
if (self.mode < 2 or self.mode > 4):
if (self.gamemode not in ["tictactoe", "pong"]):
data: dict = {
"detail": "The mode must be > 1 and < 4.",
"detail": "The gamemode must 'pong' or 'tictactoe'.",
}
self.send(json.dumps(data))
self.disconnect(1000)
@ -49,8 +49,8 @@ class MatchMaking(WebsocketConsumer):
waiting_room.broadcast(f"{len(waiting_room)} / {waiting_room.mode}")
if (len(waiting_room) == waiting_room.mode):
game_id: int = GameModel().create(waiting_room.get_users_id())
waiting_room.broadcast("game_found", {"game_id": game_id})
game_id: int = GameModel().create(self.gamemode, waiting_room.get_users_id())
waiting_room.broadcast("game_found", {"game_id": game_id, "gamemode": self.gamemode})
waiting_room.clear()
def disconnect(self, close_code):