mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-01-26 18:12:47 +08:00
✨ 添加liteyuki插件,支持获取分布式轻雪机器人节点情况
This commit is contained in:
parent
10b2634b00
commit
a0f657b239
@ -2,6 +2,7 @@ from nonebot_plugin_marshoai.plugin import PluginMetadata
|
|||||||
|
|
||||||
from .chat import *
|
from .chat import *
|
||||||
from .file_io import *
|
from .file_io import *
|
||||||
|
from .liteyuki import *
|
||||||
from .manager import *
|
from .manager import *
|
||||||
from .network import *
|
from .network import *
|
||||||
|
|
||||||
|
22
nonebot_plugin_marshoai/plugins/builtin_tools/liteyuki.py
Normal file
22
nonebot_plugin_marshoai/plugins/builtin_tools/liteyuki.py
Normal file
@ -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}"
|
Loading…
x
Reference in New Issue
Block a user