✨ Done!
This commit is contained in:
@@ -43,6 +43,7 @@ class _JoinGameData(BaseModel):
|
||||
username: str
|
||||
game_pin: str
|
||||
captcha: str | None
|
||||
custom_field: str | None
|
||||
|
||||
|
||||
@sio.event
|
||||
@@ -104,7 +105,11 @@ async def join_game(sid: str, data: dict):
|
||||
redis_res = GameSession.parse_raw(redis_res)
|
||||
await redis.set(f"game_session:{data.game_pin}:players:{data.username}", sid, ex=18000)
|
||||
await redis.sadd(f"game_session:{data.game_pin}:players", GamePlayer(username=data.username, sid=sid).json())
|
||||
print(GamePlayer(username=data.username, sid=sid).json())
|
||||
if data.custom_field == "":
|
||||
data.custom_field = None
|
||||
print(data.custom_field)
|
||||
if data.custom_field is not None:
|
||||
await redis.hset(f"game:{data.game_pin}:player:custom_fields", data.username, data.custom_field)
|
||||
# await redis.set(
|
||||
# f"game_session:{data.game_pin}",
|
||||
# GameSession(admin=redis_res.admin, game_id=redis_res.game_id, answers=[]).json(),
|
||||
|
||||
Reference in New Issue
Block a user