mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-12-16 13:40:53 +08:00
✨ 优化Wiki
命令
This commit is contained in:
parent
8cb2ba77c2
commit
3a1233488f
@ -78,7 +78,7 @@ async def _(event: Union[GroupMessageEvent, PrivateMessageEvent], lang=CommandLa
|
|||||||
await get_voice.finish(MessageBuild.Record(voice.voice_url) if voice else MessageBuild.Text(f'没有{msg}号原神语音'))
|
await get_voice.finish(MessageBuild.Record(voice.voice_url) if voice else MessageBuild.Text(f'没有{msg}号原神语音'))
|
||||||
else:
|
else:
|
||||||
if chara := get_match_alias(msg, ['角色'], True):
|
if chara := get_match_alias(msg, ['角色'], True):
|
||||||
chara = list(chara.keys())[0]
|
chara = chara[0]
|
||||||
else:
|
else:
|
||||||
await get_voice.finish(MessageBuild.Text(f'没有叫{chara}的角色'))
|
await get_voice.finish(MessageBuild.Text(f'没有叫{chara}的角色'))
|
||||||
voices = await GenshinVoice.filter(character=chara, language=lang).all()
|
voices = await GenshinVoice.filter(character=chara, language=lang).all()
|
||||||
|
@ -262,11 +262,21 @@ async def _(event: MessageEvent, state: T_State, type: str = Arg('type'), name:
|
|||||||
elif type.startswith('七圣召唤'):
|
elif type.startswith('七圣召唤'):
|
||||||
matches = await get_match_card(name)
|
matches = await get_match_card(name)
|
||||||
else:
|
else:
|
||||||
|
if alias := await PlayerAlias.get_or_none(user_id=str(event.user_id), alias=name):
|
||||||
|
final_name = alias.character
|
||||||
|
if type in {'材料', '攻略', '图鉴'}:
|
||||||
|
type = f'角色{type}'
|
||||||
|
try:
|
||||||
|
await total_wiki.finish(
|
||||||
|
MessageSegment.image(API[type].format(proxy=config.github_proxy, name=final_name)))
|
||||||
|
except ActionFailed:
|
||||||
|
await total_wiki.finish(
|
||||||
|
MessageBuild.Text(f'{final_name}的{type}发送失败,可能是网络问题或者不存在该资源'))
|
||||||
matches = get_match_alias(name, ['角色', '武器', '原魔', '圣遗物'])
|
matches = get_match_alias(name, ['角色', '武器', '原魔', '圣遗物'])
|
||||||
if m := await get_match_card(name):
|
if m := await get_match_card(name):
|
||||||
matches['七圣召唤'] = m
|
matches['七圣召唤'] = m
|
||||||
if not matches:
|
if not matches:
|
||||||
await total_wiki.finish()
|
await total_wiki.finish(MessageBuild.Text(f'没有名为{name}的{type}哦,是不是打错了~'), at_sender=True)
|
||||||
elif len(matches) == 1 and len(list(matches.values())[0]) == 1:
|
elif len(matches) == 1 and len(list(matches.values())[0]) == 1:
|
||||||
final_name = list(matches.values())[0][0]
|
final_name = list(matches.values())[0][0]
|
||||||
temp_type = list(matches.keys())[0]
|
temp_type = list(matches.keys())[0]
|
||||||
|
@ -211,7 +211,7 @@ def CommandCharacter(limit: int = 3) -> List[str]:
|
|||||||
msg.replace(character_name, '')
|
msg.replace(character_name, '')
|
||||||
# 如果有匹配别名
|
# 如果有匹配别名
|
||||||
elif character_match := get_match_alias(character_name, ['角色'], True):
|
elif character_match := get_match_alias(character_name, ['角色'], True):
|
||||||
character_list.append(list(character_match.keys())[0])
|
character_list.append(character_match[0])
|
||||||
msg.replace(character_name, '')
|
msg.replace(character_name, '')
|
||||||
# 没有匹配到角色时,结束事件
|
# 没有匹配到角色时,结束事件
|
||||||
if not character_list:
|
if not character_list:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user