2024-04-12 13:07:19 +08:00
|
|
|
from nonebot import require
|
|
|
|
|
2024-04-22 23:55:33 +08:00
|
|
|
from liteyuki.utils.base.resource import get_path
|
|
|
|
from liteyuki.utils.message.html_tool import template2image
|
|
|
|
from liteyuki.utils.base.language import get_user_lang
|
|
|
|
from .api import *
|
|
|
|
from ...utils.base.ly_typing import T_Bot, T_MessageEvent
|
|
|
|
|
2024-04-12 13:07:19 +08:00
|
|
|
require("nonebot_plugin_alconna")
|
2024-04-22 23:55:33 +08:00
|
|
|
from nonebot_plugin_alconna import on_alconna, Alconna, Args, Subcommand, Arparma, UniMessage
|
2024-04-12 13:07:19 +08:00
|
|
|
|
|
|
|
status_alc = on_alconna(
|
2024-04-26 15:02:46 +08:00
|
|
|
aliases={"状态"},
|
2024-04-12 13:07:19 +08:00
|
|
|
command=Alconna(
|
2024-04-26 15:02:46 +08:00
|
|
|
"status",
|
2024-04-12 13:07:19 +08:00
|
|
|
Subcommand(
|
|
|
|
"memory",
|
|
|
|
alias={"mem", "m", "内存"},
|
|
|
|
),
|
|
|
|
Subcommand(
|
|
|
|
"process",
|
|
|
|
alias={"proc", "p", "进程"},
|
|
|
|
)
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2024-04-22 23:55:33 +08:00
|
|
|
@status_alc.handle()
|
|
|
|
async def _(event: T_MessageEvent, bot: T_Bot):
|
|
|
|
ulang = get_user_lang(event.user_id)
|
|
|
|
image = await generate_status_card(
|
|
|
|
bot=await get_bots_data(),
|
|
|
|
hardware=await get_hardware_data(),
|
|
|
|
liteyuki=await get_liteyuki_data(),
|
|
|
|
lang=ulang.lang_code,
|
|
|
|
bot_id=bot.self_id
|
|
|
|
)
|
|
|
|
await status_alc.finish(UniMessage.image(raw=image))
|
|
|
|
|
|
|
|
|
2024-04-12 13:07:19 +08:00
|
|
|
@status_alc.assign("memory")
|
|
|
|
async def _():
|
|
|
|
print("memory")
|
|
|
|
|
|
|
|
|
|
|
|
@status_alc.assign("process")
|
|
|
|
async def _():
|
|
|
|
print("process")
|