vip 新增 weather_pic 以图片的方式显示天气。

This commit is contained in:
xtaodada 2021-07-22 17:24:00 +08:00
parent 99e06a27de
commit a968bfb0cc
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 26 additions and 4 deletions

View File

@ -342,13 +342,13 @@
},
{
"name": "vip",
"version": "0.51",
"version": "0.6",
"section": "chat",
"maintainer": "xtaodada",
"size": "4.0 kb",
"size": "9.8 kb",
"supported": true,
"des-short": "vip 捐赠用户功能",
"des": "命令天气weather Pixivpixiv \n百度baidu Duckduckgoduckduckgo\n相似动漫whatanime。与 weather 插件冲突"
"des": "命令天气weather weather_pic \nPixivpixiv \n百度baidu Duckduckgoduckduckgo\n相似动漫whatanime。与 weather 插件冲突"
},
{
"name": "calculator",

24
vip.py
View File

@ -59,7 +59,7 @@ async def baidu(context):
@listener(is_plugin=True, outgoing=True, command=alias_command("weather"),
description="使用彩云天气 api 查询国内实时天气。",
parameters="<城市>")
parameters="<位置>")
async def weather(context):
await context.edit("获取中 . . .")
try:
@ -75,6 +75,28 @@ async def weather(context):
await context.edit(weather_text)
@listener(is_plugin=True, outgoing=True, command=alias_command("weather_pic"),
description="使用彩云天气 api 查询国内实时天气。",
parameters="<位置>")
async def weather(context):
await context.edit("获取中 . . .")
reply = await context.get_reply_message()
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('/weather ' + message)
chat_response = await conversation.get_response()
await bot.send_read_acknowledge(conversation.chat_id)
if reply:
await context.respond(chat_response, reply_to=reply)
else:
await context.respond(chat_response)
await context.delete()
@listener(is_plugin=True, outgoing=True, command=alias_command("pixiv"),
description="查询插画信息 (或者回复一条消息)。使用 set [num] 更改镜像源,序号 2 为官方源, 3 为凯露自建源。异步下载需要依赖库 "
"aiohttp[speedups] 、 aiofiles",