feat: 对nb-cli的支持

This commit is contained in:
2024-04-12 13:07:19 +08:00
parent 6a4c88a6ba
commit e2779bdfd7
17 changed files with 127 additions and 40 deletions

View File

@ -6,7 +6,7 @@ from .runtime import *
__author__ = "snowykami"
__plugin_meta__ = PluginMetadata(
name="轻雪主程序",
name="轻雪核心插件",
description="轻雪主程序插件,包含了许多初始化的功能",
usage="",
homepage="https://github.com/snowykami/LiteyukiBot",

View File

@ -4,8 +4,8 @@ from .rpm import *
__author__ = "snowykami"
__plugin_meta__ = PluginMetadata(
name="轻雪插件管理",
description="本地插件管理和插件商店支持,支持启用/停用,安装/卸载插件",
name="轻雪管理",
description="本地插件管理和插件商店支持,资源包管理,支持启用/停用,安装/卸载插件",
usage=(
"npm list\n"
"npm enable/disable <plugin_name>\n"

View File

@ -0,0 +1,24 @@
from nonebot.plugin import PluginMetadata
from .status import *
__author__ = "snowykami"
__plugin_meta__ = PluginMetadata(
name="状态查看器",
description="",
usage=(
"MARKDOWN### 状态查看器\n"
"查看机器人的状态\n"
"### 用法\n"
"- `/status` 查看基本情况\n"
"- `/status memory` 查看内存使用情况\n"
"- `/status process` 查看进程情况\n"
),
type="application",
homepage="https://github.com/snowykami/LiteyukiBot",
extra={
"liteyuki": True,
"toggleable" : False,
"default_enable" : True,
}
)

View File

View File

@ -0,0 +1,29 @@
from nonebot import require
require("nonebot_plugin_alconna")
from nonebot_plugin_alconna import on_alconna, Alconna, Args, Subcommand, Arparma
status_alc = on_alconna(
aliases={"status"},
command=Alconna(
"status",
Subcommand(
"memory",
alias={"mem", "m", "内存"},
),
Subcommand(
"process",
alias={"proc", "p", "进程"},
)
),
)
@status_alc.assign("memory")
async def _():
print("memory")
@status_alc.assign("process")
async def _():
print("process")

View File

@ -0,0 +1,14 @@
const bgs = [
"bg1.png",
"bg2.png",
"bg3.png",
"bg4.png",
"bg5.png",
"bg6.png",
"bg7.png",
"bg8.png",
"bg9.png",
"bg10.png",
]
// 随机选择背景图片
document.body.style.backgroundImage = `url(./img/${bgs[Math.floor(Math.random() * bgs.length)]})`;

View File

@ -3,12 +3,17 @@
<head>
<meta charset="UTF-8">
<title>Liteyuki Status</title>
<link rel="stylesheet" href="css/card.css">
<link rel="stylesheet" href="./css/card.css">
<link rel="stylesheet" href="./css/status.css">
</head>
<body>
<div class="data-storage" id="data">{{ data | tojson }}</div>
<div class="info-box" id="system-info"></div>
<div class="info-box" id="disk-info"></div>
<div class="info-box" id="motto-info"></div>
<script src="./js/card.js"></script>
<script src="./js/status.js"></script>
</body>
</html>

View File

@ -60,6 +60,10 @@ def init():
if not os.path.exists("data/liteyuki/liteyuki.json"):
register_bot()
if not os.path.exists("pyproject.toml"):
with open("pyproject.toml", "w", encoding="utf-8") as f:
f.write("[tool.nonebot]\n")
nonebot.logger.info(
f"Run Liteyuki with Python{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro} "
f"at {sys.executable}"