vip 支持 duckduckgo 搜索

This commit is contained in:
xtaodada 2021-06-30 15:50:10 +08:00
parent a0d3678f6e
commit 86e3ef72fa
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 24 additions and 6 deletions

View File

@ -342,13 +342,13 @@
},
{
"name": "vip",
"version": "0.23",
"version": "0.3",
"section": "chat",
"maintainer": "xtaodada",
"size": "4.0 kb",
"supported": true,
"des-short": "vip 捐赠用户功能",
"des": "命令天气weather Pixivpixiv 百度baidu。与 weather 插件冲突"
"des": "命令天气weather Pixivpixiv 百度baidu Duckduckgoduckduckgo。与 weather 插件冲突"
},
{
"name": "calculator",

26
vip.py
View File

@ -2,10 +2,28 @@ from requests import get
from os import remove
from pagermaid import bot
from pagermaid.listener import listener
from pagermaid.utils import obtain_message
from pagermaid.utils import obtain_message, alias_command
@listener(is_plugin=True, outgoing=True, command="baidu",
@listener(is_plugin=True, outgoing=True, command=alias_command("duckduckgo"),
description="Duckduckgo 搜索",
parameters="<query>")
async def baidu(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('/duckduckgo ' + message)
chat_response = await conversation.get_response()
await bot.send_read_acknowledge(conversation.chat_id)
duckduckgo_text = chat_response.text
await context.edit(duckduckgo_text)
@listener(is_plugin=True, outgoing=True, command=alias_command("baidu"),
description="百度搜索",
parameters="<query>")
async def baidu(context):
@ -23,7 +41,7 @@ async def baidu(context):
await context.edit(baidu_text)
@listener(is_plugin=True, outgoing=True, command="weather",
@listener(is_plugin=True, outgoing=True, command=alias_command("weather"),
description="使用彩云天气 api 查询国内实时天气。",
parameters="<城市>")
async def weather(context):
@ -41,7 +59,7 @@ async def weather(context):
await context.edit(weather_text)
@listener(is_plugin=True, outgoing=True, command="pixiv",
@listener(is_plugin=True, outgoing=True, command=alias_command("pixiv"),
description="查询插画信息 (或者回复一条消息)",
parameters="[<图片链接>] <图片序号>")
async def pixiv(context):