Skip to content
Snippets Groups Projects
Commit d3d031f4 authored by Iori Ichinose's avatar Iori Ichinose :speech_balloon:
Browse files

update choosing songs

parent 48e30fc6
No related branches found
No related tags found
No related merge requests found
from data.ask import *
import re
import json
ARC_PATH = './data/arc_titles.json'
LUCK_LEN = (len(luck['rank']), len(luck['event']))
# jokes = ...
jokes = ['TODO']
poet_re = re.compile(r'\[CQ:at,qq=(\d+)\]')
with open(ARC_PATH, 'r') as f:
arc: dict[dict[str, str]] = json.load(f)
titles = sum((list(title.values()) for title in (title for title in arc.values())), [])
......@@ -23,10 +23,11 @@ class Type(Enum):
OR_NO1 = 8
OR_NO2 = 9
OR_NOT = 10
ARC = 11
tokens = {
re.compile(r'什么时候'): Type.TIME,
re.compile(r'什么歌'): Type.ARC,
re.compile(r'多少'): Type.R100,
re.compile(r''): Type.NAME,
re.compile(r'为什么'): Type.REASON,
......@@ -104,6 +105,9 @@ class Parser:
def choose_not(self, token: str) -> str:
return random.choice(['', '']) + token[0]
def arc(self, token: str) -> str:
return random.choice(titles)
def normal(self, token: str) -> str:
return token
......@@ -120,6 +124,7 @@ class Parser:
Type.OR_NO1: choose_no1,
Type.OR_NO2: choose_no2,
Type.OR_NOT: choose_not,
Type.ARC: arc,
Type.NORMAL: normal,
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment