v0.1.3,使用UniMessage

This commit is contained in:
Asankilp 2024-07-11 13:18:12 +00:00
parent 8cab6ab944
commit ef22c1f744
2 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@ from typing import Optional
from .acgnapis import * from .acgnapis import *
from nonebot_plugin_htmlrender import template_to_pic from nonebot_plugin_htmlrender import template_to_pic
from nonebot_plugin_alconna import on_alconna from nonebot_plugin_alconna import on_alconna
from nonebot_plugin_alconna.uniseg import UniMessage
from arclet.alconna import Alconna, Args from arclet.alconna import Alconna, Args
from .config import RES_PATH, TEMPLATE_NAME, config from .config import RES_PATH, TEMPLATE_NAME, config
from .util import * from .util import *
@ -27,12 +28,12 @@ showcmd.shortcut(
async def find_show( async def find_show(
state: T_State, region: Optional[str] = None, page: Optional[int] = None, date: Optional[str] = None, state: T_State, region: Optional[str] = None, page: Optional[int] = None, date: Optional[str] = None,
): ):
if not region: await showcmd.finish(__plugin_meta__.usage) if not region: await UniMessage(__plugin_meta__.usage).send() ; return
if not page: page = 1 if not page: page = 1
if not date: date = "" if not date: date = ""
regions_dict = get_regions_dict() regions_dict = get_regions_dict()
regionid = regions_dict.get(region,None) regionid = regions_dict.get(region,None)
if regionid == None: await showcmd.finish("不支持此地区") ; return if regionid == None: await UniMessage("不支持此地区").send() ; return
#await showcmd.send("日期:"+ date) #await showcmd.send("日期:"+ date)
shows = get_shows_data(regionid,page=page,pagesize=config.acgnshow_pagesize) shows = get_shows_data(regionid,page=page,pagesize=config.acgnshow_pagesize)
# print(shows) # print(shows)
@ -44,4 +45,4 @@ async def find_show(
# print(pic) # print(pic)
# a = Image.open(io.BytesIO(pic)) # a = Image.open(io.BytesIO(pic))
# a.save("template2pic.png", format="PNG") # a.save("template2pic.png", format="PNG")
await showcmd.finish(MessageSegment.image(pic)) await UniMessage.image(pic).send()

View File

@ -1,6 +1,6 @@
[project] [project]
name = "nonebot-plugin-acgnshow" name = "nonebot-plugin-acgnshow"
version = "0.1.2.1" version = "0.1.3"
description = "Nonebot2插件从哔哩哔哩会员购获取简易展览数据" description = "Nonebot2插件从哔哩哔哩会员购获取简易展览数据"
readme = "README.md" readme = "README.md"
requires-python = "<4.0,>=3.9" requires-python = "<4.0,>=3.9"
@ -14,7 +14,7 @@ dependencies = [
"nonebot-adapter-satori>=0.12", "nonebot-adapter-satori>=0.12",
"nonebot-adapter-onebot>=2.4.3", "nonebot-adapter-onebot>=2.4.3",
"jinja2>=3.1.4", "jinja2>=3.1.4",
"requests>=2.32.3", "requests>=2.32.3"
] ]
license = {text = "MIT"} license = {text = "MIT"}