From a0f657b23992e1f744c61d5bd57a0085c4ba3989 Mon Sep 17 00:00:00 2001 From: Snowykami Date: Tue, 17 Dec 2024 02:51:23 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E6=B7=BB=E5=8A=A0liteyuki=E6=8F=92?= =?UTF-8?q?=E4=BB=B6=EF=BC=8C=E6=94=AF=E6=8C=81=E8=8E=B7=E5=8F=96=E5=88=86?= =?UTF-8?q?=E5=B8=83=E5=BC=8F=E8=BD=BB=E9=9B=AA=E6=9C=BA=E5=99=A8=E4=BA=BA?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/builtin_tools/__init__.py | 1 + .../plugins/builtin_tools/liteyuki.py | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 nonebot_plugin_marshoai/plugins/builtin_tools/liteyuki.py diff --git a/nonebot_plugin_marshoai/plugins/builtin_tools/__init__.py b/nonebot_plugin_marshoai/plugins/builtin_tools/__init__.py index 7c072af8..a05789a3 100644 --- a/nonebot_plugin_marshoai/plugins/builtin_tools/__init__.py +++ b/nonebot_plugin_marshoai/plugins/builtin_tools/__init__.py @@ -2,6 +2,7 @@ from nonebot_plugin_marshoai.plugin import PluginMetadata from .chat import * from .file_io import * +from .liteyuki import * from .manager import * from .network import * diff --git a/nonebot_plugin_marshoai/plugins/builtin_tools/liteyuki.py b/nonebot_plugin_marshoai/plugins/builtin_tools/liteyuki.py new file mode 100644 index 00000000..1e453694 --- /dev/null +++ b/nonebot_plugin_marshoai/plugins/builtin_tools/liteyuki.py @@ -0,0 +1,22 @@ +from httpx import AsyncClient + +from nonebot_plugin_marshoai.plugin import on_function_call + + +@on_function_call(description="获取分布式轻雪机器人节点情况") +async def get_liteyuki_info() -> str: + """获取分布式轻雪机器人节点情况 + + Returns: + str: 节点情况 + """ + register = 0 + online = 0 + async with AsyncClient() as client: + response = await client.get("https://api.liteyuki.icu/count") + register = response.json().get("register") + + response = await client.get("https://api.liteyuki.icu/online") + online = response.json().get("online") + + return f"注册节点数: {register}\n在线节点数: {online}"