Initial commit

This commit is contained in:
SolidLiquid
2025-06-05 20:15:38 +12:00
commit fa1cc5035e
16 changed files with 581 additions and 0 deletions

20
util/room/data.py Normal file
View File

@@ -0,0 +1,20 @@
from dataclasses import dataclass, field
from typing import List, Dict
from datetime import datetime
@dataclass
class Room:
code: str
created_at: datetime = field(default_factory=datetime.utcnow)
messages: List[Dict] = field(default_factory=list) # Could include sender, timestamp, etc.
password: str = None # Optional
def add_message(self, sender: str, text: str):
self.messages.append({
"sender": sender,
"text": text,
"timestamp": datetime.now().isoformat()
})
def check_password(self, attempt: str) -> bool:
return self.password is None or self.password == attempt