vip 分离不同音色到不同命令

This commit is contained in:
xtaodada 2021-12-14 13:11:21 +08:00
parent 3fc248e351
commit ac6cf7b671
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 38 additions and 8 deletions

View File

@ -322,13 +322,13 @@
}, },
{ {
"name": "vip", "name": "vip",
"version": "0.7", "version": "0.71",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "11.6 kb", "size": "11.6 kb",
"supported": true, "supported": true,
"des-short": "vip 捐赠用户功能", "des-short": "vip 捐赠用户功能",
"des": "命令天气weather weather_pic weather_he\nPixivpixiv \n百度baidu Duckduckgoduckduckgo\n相似动漫whatanime\n文本转语音tts_。与 weather 插件冲突" "des": "命令天气weather weather_pic weather_he\nPixivpixiv \n百度baidu Duckduckgoduckduckgo\n相似动漫whatanime\n文本转语音tts_nan tts_nv tts_tw tts_ne tts_en。与 weather 插件冲突"
}, },
{ {
"name": "calculator", "name": "calculator",

42
vip.py
View File

@ -269,12 +269,42 @@ async def whatanime(context):
await context.delete() await context.delete()
@listener(is_plugin=True, outgoing=True, command=alias_command("tts_"), @listener(is_plugin=True, outgoing=True, command=alias_command("tts_nan"),
description="通过 Azure 文本到语音 基于字符串生成语音消息。\n\n" description="通过 Azure 文本到语音 基于字符串生成 简体男声 语音消息。",
"字符串末尾为 en 时,使用英文发音\n字符串末尾为 tw 时,使用台湾发音\n"
"字符串末尾为 ne 时,使用中文新闻发音\n字符串末尾为 nv 时,使用中文女音",
parameters="<字符串>") 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("获取中 . . .") await context.edit("获取中 . . .")
reply = await context.get_reply_message() reply = await context.get_reply_message()
try: try:
@ -283,7 +313,7 @@ async def az_tts(context):
await context.edit("出错了呜呜呜 ~ 无效的参数。") await context.edit("出错了呜呜呜 ~ 无效的参数。")
return return
async with bot.conversation('PagerMaid_Modify_bot') as conversation: 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() chat_response = await conversation.get_response()
await bot.send_read_acknowledge(conversation.chat_id) await bot.send_read_acknowledge(conversation.chat_id)
if reply: if reply: