2026-01-02 21:47:28 +08:00
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
def readMatterList() -> dict:
|
2026-01-05 13:07:53 +08:00
|
|
|
with open("resources/matters/list.json", "r", encoding="utf8") as f:
|
2026-01-02 21:47:28 +08:00
|
|
|
text = f.read()
|
|
|
|
|
result = json.loads(text)
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
2026-01-20 08:45:50 +08:00
|
|
|
def readMatchList() -> dict:
|
|
|
|
|
with open("resources/reactions/match.json", "r", encoding="utf8") as f:
|
|
|
|
|
text = f.read()
|
|
|
|
|
result = json.loads(text)
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
2026-01-02 21:47:28 +08:00
|
|
|
def readMatter(id: str):
|
2026-01-05 13:07:53 +08:00
|
|
|
path = readMatterList().get(id, -1)
|
|
|
|
|
if (path == -1):
|
|
|
|
|
return {"message": f"No Matter {id}"}
|
|
|
|
|
with open(f"resources/matters/{path}.json", "r", encoding="utf8") as f:
|
|
|
|
|
text = f.read()
|
|
|
|
|
result = json.loads(text)
|
|
|
|
|
|
2026-01-20 08:45:50 +08:00
|
|
|
return {"message": "OK", "content": result}
|
|
|
|
|
|
|
|
|
|
def selectMatter(id: str):
|
|
|
|
|
matter_id = readMatchList().get(id, -1)
|
|
|
|
|
if (matter_id == -1):
|
|
|
|
|
return {"message": f"No Matter {id}"}
|
|
|
|
|
|
|
|
|
|
return readMatter(matter_id)
|