From ac6cf7b671ec6e7c998a13c5ff867487bb6b6974 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Tue, 14 Dec 2021 13:11:21 +0800 Subject: [PATCH] =?UTF-8?q?vip=20=E5=88=86=E7=A6=BB=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E9=9F=B3=E8=89=B2=E5=88=B0=E4=B8=8D=E5=90=8C=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.json | 4 ++-- vip.py | 42 ++++++++++++++++++++++++++++++++++++------ 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/list.json b/list.json index 568d82e..747a49a 100644 --- a/list.json +++ b/list.json @@ -322,13 +322,13 @@ }, { "name": "vip", - "version": "0.7", + "version": "0.71", "section": "chat", "maintainer": "xtaodada", "size": "11.6 kb", "supported": true, "des-short": "vip 捐赠用户功能", - "des": "命令:天气:weather weather_pic weather_he\nPixiv:pixiv \n百度:baidu Duckduckgo:duckduckgo\n相似动漫:whatanime\n文本转语音:tts_。与 weather 插件冲突" + "des": "命令:天气:weather weather_pic weather_he\nPixiv:pixiv \n百度:baidu Duckduckgo:duckduckgo\n相似动漫:whatanime\n文本转语音:tts_nan tts_nv tts_tw tts_ne tts_en。与 weather 插件冲突" }, { "name": "calculator", diff --git a/vip.py b/vip.py index 6275879..302aa87 100644 --- a/vip.py +++ b/vip.py @@ -269,12 +269,42 @@ async def whatanime(context): await context.delete() -@listener(is_plugin=True, outgoing=True, command=alias_command("tts_"), - description="通过 Azure 文本到语音 基于字符串生成语音消息。\n\n" - "字符串末尾为 en 时,使用英文发音\n字符串末尾为 tw 时,使用台湾发音\n" - "字符串末尾为 ne 时,使用中文新闻发音\n字符串末尾为 nv 时,使用中文女音", +@listener(is_plugin=True, outgoing=True, command=alias_command("tts_nan"), + description="通过 Azure 文本到语音 基于字符串生成 简体男声 语音消息。", parameters="<字符串>") -async def az_tts(context): +async def az_tts_nan(context): + await az_tts(context, "") + + +@listener(is_plugin=True, outgoing=True, command=alias_command("tts_nv"), + description="通过 Azure 文本到语音 基于字符串生成 简体女声 语音消息。", + parameters="<字符串>") +async def az_tts_nv(context): + await az_tts(context, "nv") + + +@listener(is_plugin=True, outgoing=True, command=alias_command("tts_tw"), + description="通过 Azure 文本到语音 基于字符串生成 繁体男声 语音消息。", + parameters="<字符串>") +async def az_tts_tw(context): + await az_tts(context, "tw") + + +@listener(is_plugin=True, outgoing=True, command=alias_command("tts_ne"), + description="通过 Azure 文本到语音 基于字符串生成 简体新闻男声 语音消息。", + parameters="<字符串>") +async def az_tts_ne(context): + await az_tts(context, "ne") + + +@listener(is_plugin=True, outgoing=True, command=alias_command("tts_en"), + description="通过 Azure 文本到语音 基于字符串生成 英文男声 语音消息。", + parameters="<字符串>") +async def az_tts_en(context): + await az_tts(context, "en") + + +async def az_tts(context, mode): await context.edit("获取中 . . .") reply = await context.get_reply_message() try: @@ -283,7 +313,7 @@ async def az_tts(context): await context.edit("出错了呜呜呜 ~ 无效的参数。") return async with bot.conversation('PagerMaid_Modify_bot') as conversation: - await conversation.send_message('/tts ' + message) + await conversation.send_message('/tts ' + message + mode) chat_response = await conversation.get_response() await bot.send_read_acknowledge(conversation.chat_id) if reply: