mirror of
https://github.com/LiteyukiStudio/LiteyukiBot.git
synced 2025-07-27 20:20:56 +00:00
feat: 配置项目的热修改
This commit is contained in:
@ -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))
|
||||
|
Reference in New Issue
Block a user