1
0
forked from bot/app

feat: 野兽先辈主题包

fix: 插件模块名问题
feat: `nps` -> `npm`
This commit is contained in:
2024-04-08 17:01:55 +08:00
parent c45061a95a
commit 8e1ec22679
22 changed files with 814 additions and 773 deletions

View File

@ -24,6 +24,7 @@ driver = get_driver()
markdown_image = common_db.first(StoredConfig(), default=StoredConfig()).config.get("markdown_image", False)
@on_alconna(
command=Alconna(
"liteecho",
@ -165,8 +166,9 @@ async def _(event: T_MessageEvent, matcher: Matcher):
async def _(matcher: Matcher):
matcher.finish("https://bot.liteyuki.icu/usage")
# system hook
@Bot.on_calling_api # 图片模式检测
@Bot.on_calling_api # 图片模式检测
async def test_for_md_image(bot: T_Bot, api: str, data: dict):
if api in ["send_msg", "send_private_msg", "send_group_msg"] and markdown_image and data.get("user_id") != bot.self_id:
if api == "send_msg" and data.get("message_type") == "private" or api == "send_private_msg":

View File

@ -139,21 +139,24 @@ async def get_stats_data(self_id: str = None, lang: str = None) -> dict:
disk_data = []
for disk in psutil.disk_partitions(all=True):
disk_usage = psutil.disk_usage(disk.mountpoint)
disk_total_show = convert_size(disk_usage.total, 1)
disk_free_show = convert_size(disk_usage.free, 1)
if disk_usage.total > 0:
disk_data.append(
{
"name" : disk.device,
"total" : disk_total_show,
"free" : disk_free_show,
"percent" : disk_usage.percent,
"usedValue" : disk_usage.used,
"freeValue" : disk_usage.free,
"totalValue": disk_usage.total,
}
)
try:
disk_usage = psutil.disk_usage(disk.mountpoint)
disk_total_show = convert_size(disk_usage.total, 1)
disk_free_show = convert_size(disk_usage.free, 1)
if disk_usage.total > 0:
disk_data.append(
{
"name" : disk.device,
"total" : disk_total_show,
"free" : disk_free_show,
"percent" : disk_usage.percent,
"usedValue" : disk_usage.used,
"freeValue" : disk_usage.free,
"totalValue": disk_usage.total,
}
)
except Exception:
pass
cpu_info = get_cpu_info()
if "AMD" in cpu_info.get("brand_raw", ""):