vip 支持百度搜索 (#168)

* vip 支持百度搜索
This commit is contained in:
Xtao_dada 2021-06-05 00:08:57 +08:00 committed by GitHub
parent f40273d964
commit db21ca4e37
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions

View File

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

19
vip.py
View File

@ -4,6 +4,25 @@ from pagermaid import bot
from pagermaid.listener import listener
from pagermaid.utils import obtain_message
@listener(is_plugin=True, outgoing=True, command="baidu",
description="百度搜索",
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('/baidu ' + message)
chat_response = await conversation.get_response()
await bot.send_read_acknowledge(conversation.chat_id)
baidu_text = chat_response.text
await context.edit(baidu_text)
@listener(is_plugin=True, outgoing=True, command="weather",
description="使用彩云天气 api 查询国内实时天气。",
parameters="<城市>")