mirror of
https://github.com/ChenXu233/nonebot_plugin_dialectlist.git
synced 2025-09-06 20:46:25 +00:00
✨ 恢复图片渲染
This commit is contained in:
@ -2,14 +2,18 @@ from nonebot import require
|
||||
|
||||
require("nonebot_plugin_chatrecorder")
|
||||
require("nonebot_plugin_apscheduler")
|
||||
require("nonebot_plugin_htmlrender")
|
||||
require("nonebot_plugin_userinfo")
|
||||
require("nonebot_plugin_alconna")
|
||||
require("nonebot_plugin_cesaa")
|
||||
|
||||
import re
|
||||
|
||||
import os
|
||||
import nonebot_plugin_saa as saa
|
||||
|
||||
from pyecharts.charts import Bar
|
||||
from pyecharts.render import make_snapshot
|
||||
|
||||
from typing import Union, Optional, List
|
||||
from datetime import datetime, timedelta
|
||||
from arclet.alconna import ArparmaBehavior
|
||||
@ -37,6 +41,8 @@ from nonebot_plugin_alconna import (
|
||||
)
|
||||
|
||||
from nonebot_plugin_chatrecorder import get_message_records
|
||||
from nonebot_plugin_localstore import get_cache_file
|
||||
from nonebot_plugin_htmlrender import html_to_pic
|
||||
from nonebot_plugin_userinfo import get_user_info
|
||||
from nonebot_plugin_session import Session, SessionIdType, extract_session
|
||||
|
||||
@ -252,4 +258,12 @@ async def handle_rank(
|
||||
)
|
||||
string += str_example
|
||||
|
||||
await saa.Text(string).finish(reply=True)
|
||||
bar = Bar()
|
||||
bar.add_xaxis(nicknames)
|
||||
bar.add_yaxis("B话数量", [i[1] for i in rank]) # type: ignore
|
||||
bar.render(str(get_cache_file("nonebot_plugin_dialectlist","cache.html")))
|
||||
with open(get_cache_file("nonebot_plugin_dialectlist","cache.html")) as f:
|
||||
a = f.read()
|
||||
image = await html_to_pic(a)
|
||||
|
||||
await (saa.Text(string)+saa.Image(image)).finish(reply=True)
|
||||
|
Reference in New Issue
Block a user