core: fix: matchmaking and game

This commit is contained in:
2024-04-22 11:37:08 +02:00
parent d31d3e053e
commit e125eb16c7
16 changed files with 135 additions and 134 deletions

View File

@ -1,14 +1,16 @@
from channels.generic.websocket import WebsocketConsumer
from django.contrib.auth.models import User
import json
class AbstractRoomMember:
def __init__(self, user_id: int, socket: WebsocketConsumer):
self.user_id: int = user_id
def __init__(self, user: User, socket: WebsocketConsumer):
self.user: User = user
self.socket: WebsocketConsumer = socket
def send(self, detail: str, data: dict = {}):
def send(self, detail: str, data: dict = {}) -> None:
raw_data: dict = {"detail": detail}
raw_data.update(data)
self.socket.send(text_data=json.dumps(raw_data))