mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
perf(clover_yuc_wiki): 优化图片生成质量和异常处理- 将图片生成质量从50 调整为40,提高性能
This commit is contained in:
parent
755fc2fb17
commit
31e898676e
2 changed files with 4 additions and 3 deletions
|
|
@ -112,7 +112,7 @@ async def get_yuc_wiki_image(template_name,width,height):
|
||||||
template_path=yuc_wiki_path,
|
template_path=yuc_wiki_path,
|
||||||
template_name=f'{template_name}.html',
|
template_name=f'{template_name}.html',
|
||||||
templates={"data": None},
|
templates={"data": None},
|
||||||
quality=50,
|
quality=40,
|
||||||
type="jpeg",
|
type="jpeg",
|
||||||
pages={
|
pages={
|
||||||
"viewport": {"width": width, "height": height},
|
"viewport": {"width": width, "height": height},
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,6 @@ async def handle_function(message: MessageEvent):
|
||||||
await yuc_wiki.finish("暂无新番信息")
|
await yuc_wiki.finish("暂无新番信息")
|
||||||
try:
|
try:
|
||||||
await yuc_wiki.finish(MessageSegment.file_image(Path(yuc_wiki_image)))
|
await yuc_wiki.finish(MessageSegment.file_image(Path(yuc_wiki_image)))
|
||||||
except Exception:
|
except Exception as e:
|
||||||
|
if not isinstance(e, nonebot.exception.FinishedException):
|
||||||
await yuc_wiki.finish("新番信息被外星人抢走啦,请重试。这绝对不是咱的错,绝对不是!")
|
await yuc_wiki.finish("新番信息被外星人抢走啦,请重试。这绝对不是咱的错,绝对不是!")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue