Merge pull request #216 from meatjam/Bot_feat_AIVoice

feat(Genshin_AIVoice): 为要说的文本增加匹配常用标点等符号
This commit is contained in:
惜月 2022-08-31 16:26:27 +08:00 committed by GitHub
commit 93e6097de5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,16 +16,17 @@ __plugin_meta__ = PluginMetadata(
} }
) )
voice_cmd = on_regex(r'(?P<chara>\w*)说(?P<text>\w+)', priority=20, block=True, state={ voice_cmd = on_regex(r'(?P<chara>\w*)说(?P<text>[\w,。!?、:;“”‘’〔()〕——!\?,\.`\'"\(\)\[\]{}~\s]+)', priority=20, block=True, state={
'pm_name': '原神语音合成', 'pm_name': '原神语音合成',
'pm_description': 'AI语音合成让原神角色说任何话', 'pm_description': 'AI语音合成让原神角色说任何话',
'pm_usage': '<角色名>说<话>', 'pm_usage': '<角色名>说<话>',
'pm_priority': 10 'pm_priority': 10
}) })
@voice_cmd.handle(parameterless=[Cooldown(cooldown=6, isolate_level=CooldownIsolateLevel.GROUP, prompt='冷却中...')]) @voice_cmd.handle(parameterless=[Cooldown(cooldown=6, isolate_level=CooldownIsolateLevel.GROUP, prompt='冷却中...')])
async def _(event: Union[GroupMessageEvent, PrivateMessageEvent], regex_dict: dict = RegexDict()): async def _(event: Union[GroupMessageEvent, PrivateMessageEvent], regex_dict: dict = RegexDict()):
regex_dict['text'] = regex_dict['text'].replace('\r', '').replace('\n', '')
if not regex_dict['chara']: if not regex_dict['chara']:
regex_dict['chara'] = '派蒙' regex_dict['chara'] = '派蒙'
elif regex_dict['chara'] not in ['派蒙', '凯亚', '安柏', '丽莎', '', '香菱', '枫原万叶', '迪卢克', '温迪', '可莉', '早柚', '托马', '芭芭拉', elif regex_dict['chara'] not in ['派蒙', '凯亚', '安柏', '丽莎', '', '香菱', '枫原万叶', '迪卢克', '温迪', '可莉', '早柚', '托马', '芭芭拉',