1
0
forked from bot/app

[nonebot-plugin]状态提供更多品牌的cpu支持

This commit is contained in:
2024-08-23 23:47:01 +08:00
parent a7d0560932
commit 2eb5aae23f
9 changed files with 89 additions and 6 deletions

View File

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
"""
Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved
@Time : 2024/8/22 下午2:17
@Author : snowykami
@Email : snowykami@outlook.com
@File : liteyuki_docs.py
@Software: PyCharm
"""
from liteyuki import get_bot, logger
from liteyuki.utils import IS_MAIN_PROCESS
from liteyuki.plugin import PluginMetadata, PluginType
from fastapi import FastAPI
import uvicorn
__plugin_meta__ = PluginMetadata(
name="轻雪文档 Liteyuki Docs",
type=PluginType.SERVICE,
)
docs_root_path = "docs/.vuepress/dist"
app = FastAPI()
@app.get("/docs")
async def read_root():
return {
"Hello": "World"
}
def start_server():
logger.success("Docs server started.")
uvicorn.run(app, host="127.0.0.1", port=8000, )
if IS_MAIN_PROCESS:
bot = get_bot()
bot.process_manager.add_target("liteyuki_docs_server", start_server)

View File

@ -225,10 +225,20 @@ async def get_hardware_data() -> dict:
pass
swap = psutil.swap_memory()
cpu_brand_raw = cpuinfo.get_cpu_info().get("brand_raw", "Unknown")
if "AMD" in cpu_brand_raw:
if "amd" in cpu_brand_raw.lower():
brand = "AMD"
elif "Intel" in cpu_brand_raw:
elif "intel" in cpu_brand_raw.lower():
brand = "Intel"
elif "apple" in cpu_brand_raw.lower():
brand = "Apple"
elif "qualcomm" in cpu_brand_raw.lower():
brand = "Qualcomm"
elif "mediatek" in cpu_brand_raw.lower():
brand = "MediaTek"
elif "samsung" in cpu_brand_raw.lower():
brand = "Samsung"
elif "nvidia" in cpu_brand_raw.lower():
brand = "NVIDIA"
else:
brand = "Unknown"
result = {

View File

@ -31,6 +31,7 @@ async def _(bot: Bot, event: MessageEvent):
raw_message=event.raw_message,
data=event.dict(),
bot_id=bot.self_id,
user_id=str(event.user_id),
session_id=str(event.user_id if event.message_type == "private" else event.group_id),
session_type=event.message_type,
receive_channel="event_to_nonebot"