From b22c98f6fc8c85db7ad0f0296092f1c3ac26f341 Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Sat, 31 Dec 2022 12:44:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D`Wiki`?= =?UTF-8?q?=E7=89=B9=E4=BA=A7=E5=9B=BE=E9=89=B4=E6=97=A0=E5=8C=B9=E9=85=8D?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LittlePaimon/plugins/Paimon_Wiki/Atlas/api.py | 2 +- LittlePaimon/plugins/Paimon_Wiki/__init__.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/LittlePaimon/plugins/Paimon_Wiki/Atlas/api.py b/LittlePaimon/plugins/Paimon_Wiki/Atlas/api.py index 43f389a..737060b 100644 --- a/LittlePaimon/plugins/Paimon_Wiki/Atlas/api.py +++ b/LittlePaimon/plugins/Paimon_Wiki/Atlas/api.py @@ -43,7 +43,7 @@ async def get_match_specialty(name: str) -> Optional[list]: resp = await aiorequests.get(SPECIALTY_RESOURCES_API.format(proxy=config.github_proxy)) data = resp.json()['specialty'] return ( - difflib.get_close_matches(name, data, cutoff=0.6, n=10) + difflib.get_close_matches(name, list(data.keys()), cutoff=0.6, n=10) if name != '全部' else list(data.keys()) ) diff --git a/LittlePaimon/plugins/Paimon_Wiki/__init__.py b/LittlePaimon/plugins/Paimon_Wiki/__init__.py index d9ca8ab..788ec34 100644 --- a/LittlePaimon/plugins/Paimon_Wiki/__init__.py +++ b/LittlePaimon/plugins/Paimon_Wiki/__init__.py @@ -269,10 +269,10 @@ async def _(bot: Bot, event: MessageEvent, state: T_State, type: str = Arg('type elif type.startswith('七圣召唤'): if name == '全部': matches = await get_match_card(name) - else: - matches = {'七圣召唤': await get_match_card(name)} - elif type == '特产图鉴': - matches = {'特产': await get_match_specialty(name)} + elif c := await get_match_card(name): + matches = {'七圣召唤': c} + elif type == '特产图鉴' and (s := await get_match_specialty(name)): + matches = {'特产': s} else: if re.match('^[火水冰雷风岩草](元素|属性|系)?$', name): matches = {'角色': type_file['角色']['元素类型'][name[0]]} @@ -374,7 +374,7 @@ async def _(state: T_State, matches: dict = Arg('matches'), choice: str = ArgPla except ActionFailed: await total_wiki.finish(f'{final_name}的{type}发送失败,可能是网络问题或者不存在该资源') elif state['times'] == 2: - await total_wiki.finish(f'旅行者似乎不太能理解,下次再问我吧{MessageSegment.face(146)}') + await total_wiki.finish('旅行者似乎不太能理解,下次再问我吧' + MessageSegment.face(146)) else: state['times'] = state['times'] + 1 await total_wiki.reject(f'请旅行者从上面的{type}中选一个问{NICKNAME}或回答\"取消\"可以取消查询', at_sender=True)