每日备份 2026-06-10 12:57:13
This commit is contained in:
1 parent
fda2ccb8c2
commit
3d2e638c6a
244 files changed
+58890
-3
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
# 发送会话提醒到 Telegram
|
||||
# 用法: ./send-session-alert.sh <类型> <会话ID> <大小MB>
|
||||
# 类型: warn, new
|
||||
|
||||
TYPE="$1"
|
||||
SESSION_ID="$2"
|
||||
SIZE_MB="$3"
|
||||
|
||||
if [ -z "$TYPE" ] || [ -z "$SESSION_ID" ] || [ -z "$SIZE_MB" ]; then
|
||||
echo "用法: $0 <warn|new> <会话ID> <大小MB>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MESSAGE_FILE="/tmp/openclaw-temp-message.json"
|
||||
|
||||
case "$TYPE" in
|
||||
warn)
|
||||
cat > "$MESSAGE_FILE" << EOF
|
||||
{
|
||||
"action": "send",
|
||||
"target": "5117446326",
|
||||
"message": "⚠️ 会话文件过大提醒\n\n会话: ${SESSION_ID}\n大小: ${SIZE_MB}MB\n\n建议开启新对话以避免性能问题。",
|
||||
"channel": "telegram"
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
new)
|
||||
cat > "$MESSAGE_FILE" << EOF
|
||||
{
|
||||
"action": "send",
|
||||
"target": "5117446326",
|
||||
"message": "🆕 已自动开启新会话\n\n旧会话: ${SESSION_ID}\n大小: ${SIZE_MB}MB\n\n新对话已就绪。",
|
||||
"channel": "telegram"
|
||||
}
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
echo "未知类型: $TYPE"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# 发送到 OpenClaw Gateway
|
||||
curl -s -X POST "http://127.0.0.1:18789/messages" \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: Bearer openclaw-guardian-token-2nd" \
|
||||
-d @"$MESSAGE_FILE"
|
||||
|
||||
rm -f "$MESSAGE_FILE"
|
||||
Reference in new issue
Block a user