vip 支持 彩云、deepl 翻译

This commit is contained in:
xtaodada 2022-02-14 00:01:51 +08:00
parent e4e975f7c1
commit 60681470e6
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 38 additions and 3 deletions

View File

@ -322,13 +322,13 @@
}, },
{ {
"name": "vip", "name": "vip",
"version": "0.714", "version": "0.72",
"section": "chat", "section": "chat",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "11.6 kb", "size": "14.4 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_nan tts_nv tts_tw tts_ne tts_en。与 weather 插件冲突" "des": "命令天气weather weather_pic weather_he\nPixivpixiv \n百度baidu Duckduckgoduckduckgo\n彩云翻译caiyun Deepl 翻译deepl\n相似动漫whatanime\n文本转语音tts_nan tts_nv tts_tw tts_ne tts_en。与 weather 插件冲突"
}, },
{ {
"name": "calculator", "name": "calculator",

35
vip.py
View File

@ -58,6 +58,41 @@ async def baidu(context):
await context.edit(baidu_text) await context.edit(baidu_text)
@listener(is_plugin=True, outgoing=True, command=alias_command("caiyun"),
description="彩云翻译",
parameters="<query>")
async def caiyun_translate(context):
await context.edit("获取中 . . .")
try:
message = await obtain_message(context)
except ValueError:
return await context.edit("出错了呜呜呜 ~ 无效的参数。")
async with bot.conversation('PagerMaid_Modify_bot') as conversation:
await conversation.send_message('/translate ' + message)
chat_response = await conversation.get_response()
await bot.send_read_acknowledge(conversation.chat_id)
caiyun_text = chat_response.text
await context.edit(caiyun_text)
@listener(is_plugin=True, outgoing=True, command=alias_command("deepl"),
description="Deepl 翻译",
parameters="<query>")
async def deepl_translate(context):
await context.edit("获取中 . . .")
try:
message = await obtain_message(context)
except ValueError:
await context.edit("出错了呜呜呜 ~ 无效的参数。")
return
async with bot.conversation('PagerMaid_Modify_bot') as conversation:
await conversation.send_message('/deepl ' + message)
chat_response = await conversation.get_response()
await bot.send_read_acknowledge(conversation.chat_id)
deepl_text = chat_response.text
await context.edit(deepl_text)
@listener(is_plugin=True, outgoing=True, command=alias_command("weather"), @listener(is_plugin=True, outgoing=True, command=alias_command("weather"),
description="使用彩云天气 api 查询国内实时天气。", description="使用彩云天气 api 查询国内实时天气。",
parameters="<位置>") parameters="<位置>")