add Kaleidx Scope Support

This commit is contained in:
SoulGateKey
2025-04-02 09:42:08 +08:00
parent d77d02c2dd
commit 3d84e32892
3 changed files with 67 additions and 3 deletions

View File

@@ -4,6 +4,8 @@ from core.config import CoreConfig
from titles.mai2.buddiesplus import Mai2BuddiesPlus
from titles.mai2.const import Mai2Constants
from titles.mai2.config import Mai2Config
from titles.mai2.schema.score import kaleidx_scope
class Mai2Prism(Mai2BuddiesPlus):
def __init__(self, cfg: CoreConfig, game_cfg: Mai2Config) -> None:
@@ -48,10 +50,18 @@ class Mai2Prism(Mai2BuddiesPlus):
}
async def handle_get_user_kaleidx_scope_api_request(self, data: Dict) -> Dict:
user_id = data["userId"]
kaleidx_scope = await self.data.score.get_user_kaleidx_scope_list(data["userId"])
if kaleidx_scope is None:
return {"userId": data["userId"], "userKaleidxScopeList":[]}
kaleidx_scope_list = []
for kaleidx_scope_data in kaleidx_scope:
tmp = kaleidx_scope_data._asdict()
tmp.pop("user")
tmp.pop("id")
kaleidx_scope_list.append(tmp)
return {
"userId": user_id,
"userKaleidxScopeList": []
"userId": data["userId"],
"userKaleidxScopeList": kaleidx_scope_list
}