🐛v0.1.3.1,添加简单错误处理

This commit is contained in:
Asankilp 2024-07-11 13:35:28 +00:00
parent ef22c1f744
commit 1e089baae9
2 changed files with 10 additions and 7 deletions

View File

@ -1,4 +1,3 @@
from nonebot.adapters.onebot.v11 import MessageSegment
from nonebot.typing import T_State from nonebot.typing import T_State
from typing import Optional from typing import Optional
from .acgnapis import * from .acgnapis import *
@ -37,11 +36,15 @@ async def find_show(
#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)
try:
template = { template = {
"shows":process_shows_data_to_template(shows), "shows":process_shows_data_to_template(shows),
"bgimage": choose_random_bgimage() "bgimage": choose_random_bgimage()
} }
pic = await template_to_pic(RES_PATH,TEMPLATE_NAME,template) pic = await template_to_pic(RES_PATH,TEMPLATE_NAME,template)
except:
await UniMessage("发生错误").send()
return
# 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")

View File

@ -1,6 +1,6 @@
[project] [project]
name = "nonebot-plugin-acgnshow" name = "nonebot-plugin-acgnshow"
version = "0.1.3" version = "0.1.3.1"
description = "Nonebot2插件从哔哩哔哩会员购获取简易展览数据" description = "Nonebot2插件从哔哩哔哩会员购获取简易展览数据"
readme = "README.md" readme = "README.md"
requires-python = "<4.0,>=3.9" requires-python = "<4.0,>=3.9"