LiteyukiBot/liteyuki/liteyuki_main/webdash.py

20 lines
550 B
Python
Raw Normal View History

2024-03-30 11:24:09 +00:00
import requests
2024-03-29 22:04:17 +00:00
from nonebot.adapters.onebot.v11 import MessageSegment
from nonebot.permission import SUPERUSER
2024-03-30 11:24:09 +00:00
from liteyuki.utils.htmlrender import template_to_pic, html_to_pic
2024-03-30 11:24:09 +00:00
from liteyuki.utils.resource import get_path
2024-03-29 22:04:17 +00:00
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 _():
2024-03-30 11:24:09 +00:00
image_bytes = await template_to_pic(
template_path=get_path("templates/index.html", abs_path=True),
templates={}
)
await stats.finish(MessageSegment.image(image_bytes))