LiteyukiBot/liteyuki/liteyuki_main/webdash.py

16 lines
487 B
Python
Raw Normal View History

2024-03-29 22:04:17 +00:00
from nonebot.adapters.onebot.v11 import MessageSegment
from nonebot.permission import SUPERUSER
from liteyuki.utils.htmlrender import render_html
2024-03-29 22:04:17 +00:00
from liteyuki.utils.resource import get
from nonebot import on_command
2024-03-29 22:04:17 +00:00
stats = on_command("stats", priority=5, permission=SUPERUSER)
2024-03-29 22:04:17 +00:00
@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))