feat: 配置项目的热修改

This commit is contained in:
2024-03-30 19:24:09 +08:00
parent c15c604752
commit 9b2b0a7c7d
15 changed files with 11526 additions and 47 deletions

View File

@ -1,8 +1,9 @@
import requests
from nonebot.adapters.onebot.v11 import MessageSegment
from nonebot.permission import SUPERUSER
from liteyuki.utils.htmlrender import render_html
from liteyuki.utils.htmlrender import template_to_pic, html_to_pic
from liteyuki.utils.resource import get
from liteyuki.utils.resource import get_path
from nonebot import on_command
stats = on_command("stats", priority=5, permission=SUPERUSER)
@ -10,6 +11,9 @@ stats = on_command("stats", priority=5, permission=SUPERUSER)
@stats.handle()
async def _():
html = get("templates/stats.html")
html_bytes = await render_html(open(html, "r", encoding="utf-8").read())
await stats.finish(MessageSegment.image(html_bytes))
image_bytes = await template_to_pic(
template_path=get_path("templates/index.html", abs_path=True),
templates={}
)
await stats.finish(MessageSegment.image(image_bytes))