feat: 实现按物质匹配反应

This commit is contained in:
2026-01-20 08:45:50 +08:00
parent ca33fd0578
commit dc695030d6
9 changed files with 29 additions and 8 deletions
+18
View File
@@ -0,0 +1,18 @@
import json
def readReactionList() -> dict:
with open("resources/reactions/list.json", "r", encoding="utf8") as f:
text = f.read()
result = json.loads(text)
return result
def readReaction(id: str):
path = readReactionList().get(id, -1)
if (path == -1):
return {"message": f"No Reaction {id}"}
with open(f"resources/reactions/{path}.json", "r", encoding="utf8") as f:
text = f.read()
result = json.loads(text)
return {"message": "OK", "content": result}