mirror of
https://github.com/TeamPGM/PagerMaid_Plugins.git
synced 2024-11-22 00:35:36 +00:00
vip 支持 duckduckgo 搜索
This commit is contained in:
parent
a0d3678f6e
commit
86e3ef72fa
@ -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 Pixiv:pixiv 百度:baidu。与 weather 插件冲突"
|
||||
"des": "命令:天气:weather Pixiv:pixiv 百度:baidu Duckduckgo:duckduckgo。与 weather 插件冲突"
|
||||
},
|
||||
{
|
||||
"name": "calculator",
|
||||
|
26
vip.py
26
vip.py
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user