feat: 实现按物质匹配反应
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
import json
|
||||
|
||||
def readCardList() -> dict:
|
||||
with open("resources/cards/list.json", "r", encoding="utf8") as f:
|
||||
text = f.read()
|
||||
result = json.loads(text)
|
||||
|
||||
return result
|
||||
|
||||
def readCard(id: str):
|
||||
path = readCardList().get(id, -1)
|
||||
if (path == -1):
|
||||
return {"message": f"No Card {id}"}
|
||||
with open(f"resources/cards/{path}.json", "r", encoding="utf8") as f:
|
||||
text = f.read()
|
||||
result = json.loads(text)
|
||||
|
||||
return {"message": "OK", "content": result}
|
||||
@@ -0,0 +1,32 @@
|
||||
import json
|
||||
|
||||
def readMatterList() -> dict:
|
||||
with open("resources/matters/list.json", "r", encoding="utf8") as f:
|
||||
text = f.read()
|
||||
result = json.loads(text)
|
||||
|
||||
return result
|
||||
|
||||
def readMatchList() -> dict:
|
||||
with open("resources/reactions/match.json", "r", encoding="utf8") as f:
|
||||
text = f.read()
|
||||
result = json.loads(text)
|
||||
|
||||
return result
|
||||
|
||||
def readMatter(id: str):
|
||||
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)
|
||||
|
||||
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)
|
||||
@@ -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}
|
||||
Reference in New Issue
Block a user