原魔增加一些别名,优化匹配方法,没有匹配到时不再提示

This commit is contained in:
CMHopeSunshine 2023-01-02 12:57:10 +08:00
parent b3ad465758
commit c4fc11b82f
3 changed files with 43 additions and 22 deletions

View File

@ -1284,7 +1284,8 @@
],
"纯水精灵": [
"纯水精灵",
"洛蒂亚"
"洛蒂亚",
"纯水"
],
"水飘浮灵": [
"水飘浮灵"
@ -1309,7 +1310,8 @@
],
"雷音权现": [
"雷音权现",
"雷鸟"
"雷鸟",
"雷音"
],
"丘丘人": [
"丘丘人"
@ -1461,16 +1463,21 @@
"流血狗王"
],
"黯色空壳·旗令": [
"黯色空壳·旗令"
"黯色空壳·旗令",
"火空壳"
],
"黯色空壳·破阵": [
"黯色空壳·破阵"
"黯色空壳·破阵",
"水空壳"
],
"黯色空壳·近卫": [
"黯色空壳·近卫"
"黯色空壳·近卫",
"冰空壳"
],
"黑蛇骑士·斩风之剑": [
"黑蛇骑士·斩风之剑"
"黑蛇骑士·斩风之剑",
"黑蛇骑士",
"风空壳"
],
"愚人众先遣队·冰铳重卫士": [
"愚人众先遣队·冰铳重卫士",
@ -1505,8 +1512,7 @@
],
"愚人众·雷萤术士": [
"愚人众·雷萤术士",
"雷萤术士",
"砂糖"
"雷萤术士"
],
"愚人众·冰萤术士": [
"愚人众·冰萤术士",
@ -1546,13 +1552,16 @@
"无相铁"
],
"遗迹龙兽·空巡": [
"遗迹龙兽·空巡"
"遗迹龙兽·空巡",
"飞天龙兽"
],
"遗迹龙兽·地巡": [
"遗迹龙兽·地巡"
"遗迹龙兽·地巡",
"地面龙兽"
],
"兆载永劫龙兽": [
"兆载永劫龙兽"
"兆载永劫龙兽",
"龙兽boss"
],
"元能构装体·力场发生器": [
"元能构装体·力场发生器"
@ -1801,42 +1810,49 @@
"裂空的魔龙": [
"裂空的魔龙",
"风魔龙",
"特瓦林"
"特瓦林",
"周本boss"
],
"北风的王狼,奔狼的领主": [
"北风的王狼,奔狼的领主",
"北风狼",
"狼王",
"安德留斯"
"安德留斯",
"周本boss"
],
"「公子」": [
"「公子」",
"公子",
"达达利亚",
"达达鸭"
"达达鸭",
"周本boss"
],
"若陀龙王": [
"若陀龙王",
"若陀",
"喵喵陀"
"喵喵陀",
"周本boss"
],
"「女士」": [
"「女士」",
"女士",
"罗莎琳"
"罗莎琳",
"周本boss"
],
"祸津御建鸣神命": [
"祸津御建鸣神命",
"雷神",
"雷电将军",
"煮饭婆",
"将军人偶"
"将军人偶",
"周本boss"
],
"「正机之神」": [
"「正机之神」",
"散兵",
"正机之神",
"试作雷神"
"试作雷神",
"周本boss"
]
}
}

View File

@ -187,6 +187,8 @@ async def _(state: T_State, regex_dict: dict = RegexDict()):
type = f'角色{type[2:]}'
elif type.startswith('武器'):
type = '武器图鉴'
elif type.startswith('圣遗物'):
type = '圣遗物图鉴'
elif type.startswith(('材料', '特产')) and type != '材料':
type = '特产图鉴'
elif type.startswith(('原魔', '怪物')):
@ -295,7 +297,8 @@ async def _(bot: Bot, event: MessageEvent, state: T_State, type: str = Arg('type
if s := await get_match_specialty(name):
matches['特产'] = s
if not matches:
await total_wiki.finish(MessageBuild.Text(f'没有名为{name}{type}哦,是不是打错了~'), at_sender=True)
# await total_wiki.finish(MessageBuild.Text(f'没有名为{name}的{type}哦,是不是打错了~'), at_sender=True)
await total_wiki.finish()
elif len(matches) == 1 and len(list(matches.values())[0]) == 1:
final_name = list(matches.values())[0][0]
temp_type = list(matches.keys())[0]

View File

@ -97,7 +97,7 @@ def get_match_alias(name: str, types: Union[List[ALIAS_TYPE], ALIAS_TYPE] = None
break
if get_close_matches(name, alias, cutoff=0.6, n=3):
matches[type].append(alias[0])
elif type in {'武器', '圣遗物', '原魔'}:
elif type in {'武器', '圣遗物'}:
for raw_name, alias in alias_list.items():
if name in alias:
matches[type].append(raw_name)
@ -105,8 +105,10 @@ def get_match_alias(name: str, types: Union[List[ALIAS_TYPE], ALIAS_TYPE] = None
else:
if get_close_matches(name, alias, cutoff=0.6, n=3):
matches[type].append(raw_name)
# elif type == '原魔':
# matches[type] = get_close_matches(name, alias_list, cutoff=0.4, n=5)
elif type == '原魔':
for raw_name, alias in alias_list.items():
if get_close_matches(name, alias, cutoff=0.4, n=5):
matches[type].append(raw_name)
if not matches[type]:
del matches[type]
if one_to_list and len(matches) == 1: