2024-03-30 19:24:09 +08:00
|
|
|
import requests
|
2024-03-30 06:04:17 +08:00
|
|
|
from nonebot.adapters.onebot.v11 import MessageSegment
|
|
|
|
from nonebot.permission import SUPERUSER
|
2024-03-30 19:24:09 +08:00
|
|
|
from liteyuki.utils.htmlrender import template_to_pic, html_to_pic
|
2024-03-20 18:27:49 +08:00
|
|
|
|
2024-03-30 19:24:09 +08:00
|
|
|
from liteyuki.utils.resource import get_path
|
2024-03-30 06:04:17 +08:00
|
|
|
from nonebot import on_command
|
2024-03-20 18:27:49 +08:00
|
|
|
|
2024-03-30 06:04:17 +08:00
|
|
|
stats = on_command("stats", priority=5, permission=SUPERUSER)
|
2024-03-20 18:27:49 +08:00
|
|
|
|
|
|
|
|
2024-03-30 06:04:17 +08:00
|
|
|
@stats.handle()
|
|
|
|
async def _():
|
2024-03-30 19:24:09 +08: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))
|