Files
chatrebot_aireply_plug/skills/mc-query/SKILL.md
Claw e1fbd31c64 完整 AgentSkill:词库外部化 + 全部脚本/Skill 脱敏上传
- 高危词库从 process.py 抽到 config.toml [security] section
- process.py 改为 _get_high_risk_words() 动态加载(配置优先)
- 新增 15 个 QQ 操作脚本(已脱敏:QQ号/IP/Token → 占位符)
- 新增 8 个 SKILL.md(qq-messenger/management/resolver/napcat-extras 等)
- 新增 SKILL.md 入口(完整部署方案文档)
- 保留 SDK 框架(plugin_modules.py, file_store_api.py, package.py 等)
2026-05-04 16:23:59 +08:00

86 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# mc-query Skill
Minecraft 服务器信息查询能力。通过本地脚本直接读取服务器数据,无需经过 ops-manager。
## 脚本清单
| 脚本 | 功能 | 输出 |
|---|---|---|
| `mc_query.py status` | 服务器运行状态 | 人数、内存、CPU、TPS、版本、存档大小、磁盘 |
| `mc_query.py players` | 玩家信息 | 最近动态、在线时间排行、死亡排行、成就排行 |
| `mc_query.py world` | 世界详情 | 世界时间、实体统计、网络流量、活跃模组 |
| `mc_query.py all` | 全部信息 | 综合输出 |
## 使用方法
```python
import subprocess, json
# 获取服务器状态(JSON)
result = subprocess.run(
["python3", "YOUR_WORKSPACE_PATH/scripts/mc_query.py", "status", "--json"],
capture_output=True, text=True, timeout=30
)
data = json.loads(result.stdout)
# 获取玩家排行
result = subprocess.run(
["python3", "YOUR_WORKSPACE_PATH/scripts/mc_query.py", "players", "--json"],
capture_output=True, text=True, timeout=30
)
data = json.loads(result.stdout)
# 获取世界详情
result = subprocess.run(
["python3", "YOUR_WORKSPACE_PATH/scripts/mc_query.py", "world", "--json"],
capture_output=True, text=True, timeout=30
)
data = json.loads(result.stdout)
```
## JSON 返回示例
### status
```json
{
"players": {"online": 3, "max": 20, "list": "Alice, Bob, Charlie"},
"memory": {"used_mb": 4096, "used_gb": "4.0GB"},
"cpu": "15.2%",
"uptime": "2天5小时30分钟",
"tps": {"tps_1m": 19.8},
"version": "NeoForge 21.1.72",
"world_size": "12.3G",
"disk": {"used": "45.2GB", "total": "100.0GB", "percent": "45.2%"},
"load": {"avg": 0.85, "percent": "28.3%", "cores": 8}
}
```
### players
```json
{
"recent_events": [{"type": "join", "player": "Alice"}],
"playtime": [
{"name": "Alice", "seconds": 45000, "formatted": "12小时30分钟"}
],
"deaths": [{"name": "Charlie", "deaths": 23}],
"achievements": [{"name": "Alice", "achievements": 47}]
}
```
### world
```json
{
"world_time": {"day": 123, "time": "14:30", "phase": "白天"},
"entities": {"total": 1523, "hostile": 234, "friendly": 890, "other": 399},
"top_entities": {"sheep": 120, "zombie": 89},
"network": {"rx_gb": 1.2, "tx_gb": 0.8},
"mods": ["create", "appliedenergistics2", "farmersdelight"]
}
```
## 注意事项
- 所有脚本依赖 `mc_config.py` 中的 RCON 配置
- 脚本设计为功能正交:每个只做一件事,可组合使用
- 输出到 QQ 时禁止使用 Markdown(不用 `#`, `*`, `` ` ``, `>`, `-` 列表等)