完整 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 等)
This commit is contained in:
Claw
2026-05-04 16:23:59 +08:00
parent d7d33c39a4
commit e1fbd31c64
35 changed files with 5058 additions and 276 deletions

111
scripts/qq_send_msg.py Normal file
View File

@ -0,0 +1,111 @@
#!/usr/bin/env python3
"""
QQ 主动发信脚本 - 通过 go-cqhttp HTTP API 发送消息到 QQ
用于 qq-agent 主动推送消息(非回复场景)
用法:
# 发送私聊消息
python3 qq_send_msg.py --private YOUR_ADMIN_QQ --message "服务器已重启完成"
# 发送群聊消息
python3 qq_send_msg.py --group YOUR_BOT_QQ --message "系统维护通知: ..."
# 从文件读取消息内容
python3 qq_send_msg.py --private YOUR_ADMIN_QQ --file /tmp/report.txt
# 快速发送(私聊+短时间内多条消息带上合并开关)
python3 qq_send_msg.py --private YOUR_ADMIN_QQ --message "你好" --auto_escape
注意:
- 管理员 QQ 号: YOUR_ADMIN_QQ
- 默认发送到管理员私聊
"""
import json
import sys
import argparse
import requests
import os
# go-cqhttp HTTP API 地址(与 qqrebot 配置文件一致)
CQHTTP_URL = "http://YOUR_NAP CAT_HOST:25570"
# 默认接收用户(管理员)
DEFAULT_USER = "YOUR_ADMIN_QQ"
def send_private_msg(user_id, message, auto_escape=False):
"""发送私聊消息"""
url = f"{CQHTTP_URL}/send_private_msg"
payload = {
"user_id": int(user_id),
"message": message,
"auto_escape": auto_escape,
}
resp = requests.post(url, json=payload, timeout=10)
data = resp.json()
if data.get("status") == "ok":
return True, data
return False, data
def send_group_msg(group_id, message, auto_escape=False):
"""发送群聊消息"""
url = f"{CQHTTP_URL}/send_group_msg"
payload = {
"group_id": int(group_id),
"message": message,
"auto_escape": auto_escape,
}
resp = requests.post(url, json=payload, timeout=10)
data = resp.json()
if data.get("status") == "ok":
return True, data
return False, data
def main():
parser = argparse.ArgumentParser(description="发送 QQ 消息")
target = parser.add_mutually_exclusive_group(required=False)
target.add_argument("--private", type=str, default=DEFAULT_USER, nargs="?",
const=DEFAULT_USER, help="接收用户 QQ 号 (默认: 管理员)")
target.add_argument("--group", type=str, help="目标群号")
content = parser.add_mutually_exclusive_group(required=True)
content.add_argument("--message", help="消息内容")
content.add_argument("--file", help="从文件读取消息内容")
parser.add_argument("--auto_escape", action="store_true",
help="是否转义 CQ 码 (默认不转义)")
args = parser.parse_args()
if args.file:
with open(args.file, "r") as f:
message = f.read()
else:
message = args.message
try:
if args.group:
ok, result = send_group_msg(args.group, message, args.auto_escape)
target_desc = f"{args.group}"
else:
ok, result = send_private_msg(args.private, message, args.auto_escape)
target_desc = f"用户 {args.private}"
if ok:
print(f"✅ 消息已发送到 {target_desc}")
else:
print(f"❌ 发送失败 ({target_desc}): {json.dumps(result, ensure_ascii=False)}")
sys.exit(1)
except requests.exceptions.ConnectionError:
print(f"❌ 连接失败: 无法连接到 go-cqhttp ({CQHTTP_URL})")
sys.exit(1)
except Exception as e:
print(f"❌ 发送异常: {e}")
sys.exit(1)
if __name__ == "__main__":
main()