Skip to content

Commit

Permalink
add more noti
Browse files Browse the repository at this point in the history
  • Loading branch information
tu-hm committed Dec 31, 2023
1 parent edb0051 commit a4b7f05
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,11 @@ async def puzzle_duel(sid, msg):
puzzle_solved_by_user[game_id][user_id] = set()
await sio.emit("puzzle-duel", json.dumps(response))
response = {
"status": "noti",
"status": "join_noti",
"message": {
"content": f"User {user_id} joined"
"content": f"User {user_id} joined game {game_id}",
"game_id": game_id,
"user_id": user_id
}
}
await sio.emit("puzzle-duel", json.dumps(response))
Expand All @@ -418,9 +420,12 @@ async def puzzle_duel(sid, msg):
solved = msg["message"]["solved"]
if not solved:
response = {
"status": "noti",
"status": "submit_noti",
"message": {
"content": f"User {user_id} failed puzzle {puzzle_id}"
"content": f"User {user_id} failed puzzle {puzzle_id}",
"game_id": game_id,
"user_id": user_id,
"solved": solved
}
}
await sio.emit("puzzle-duel", json.dumps(response))
Expand Down Expand Up @@ -459,9 +464,12 @@ async def puzzle_duel(sid, msg):
}
await sio.emit("puzzle-duel", json.dumps(response))
response = {
"status": "noti",
"status": "submit_noti",
"message": {
"content": f"User {user_id} solved puzzle {puzzle_id}"
"content": f"User {user_id} solved puzzle {puzzle_id}",
"game_id": game_id,
"user_id": user_id,
"solved": solved
}
}
await sio.emit("puzzle-duel", json.dumps(response))
Expand Down

0 comments on commit a4b7f05

Please sign in to comment.