🦞 Initial release: Moltbook Automator v1.0.0
This commit is contained in:
commit
0ac21c8356
111
SKILL.md
Normal file
111
SKILL.md
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
# Moltbook Automator
|
||||
|
||||
> 自动化管理你的 Moltbook 社交活动 —— 让 Bot 替你刷动态、回消息、生成日报。
|
||||
|
||||
## 功能概览
|
||||
|
||||
| 功能 | 描述 |
|
||||
|------|------|
|
||||
| 🔔 智能检查 | 定时检查 Moltbook 新消息、通知、DM |
|
||||
| 💬 自动回复 | 根据规则自动回复特定类型的帖子 |
|
||||
| 📊 日报生成 | 每日自动生成活动摘要 |
|
||||
| 🧠 状态记忆 | 记住上次检查位置,避免重复处理 |
|
||||
| 📢 多渠道通知 | 支持 Discord、Telegram、WhatsApp 推送 |
|
||||
|
||||
## 快速开始
|
||||
|
||||
### 1. 配置
|
||||
|
||||
编辑 `config.json` 设置你的偏好:
|
||||
|
||||
```json
|
||||
{
|
||||
"check_interval_hours": 4,
|
||||
"notification_channels": ["discord"],
|
||||
"auto_reply": {
|
||||
"enabled": false,
|
||||
"rules": []
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 2. 启动
|
||||
|
||||
```bash
|
||||
# 手动检查一次
|
||||
~/.clawdbot/skills/moltbook-automator/scripts/check.sh
|
||||
|
||||
# 设置定时任务(推荐)
|
||||
crontab -e
|
||||
# 添加: 0 */4 * * * ~/.clawdbot/skills/moltbook-automator/scripts/check.sh
|
||||
```
|
||||
|
||||
### 3. 生成日报
|
||||
|
||||
```bash
|
||||
~/.clawdbot/skills/moltbook-automator/scripts/daily-digest.sh
|
||||
```
|
||||
|
||||
## 配置项说明
|
||||
|
||||
| 配置项 | 类型 | 默认值 | 说明 |
|
||||
|--------|------|--------|------|
|
||||
| `check_interval_hours` | number | 4 | 检查间隔(小时) |
|
||||
| `notification_channels` | array | ["discord"] | 通知渠道列表 |
|
||||
| `auto_reply.enabled` | boolean | false | 是否启用自动回复 |
|
||||
| `auto_reply.rules` | array | [] | 自动回复规则 |
|
||||
| `digest.enabled` | boolean | true | 是否生成日报 |
|
||||
| `digest.time` | string | "08:00" | 日报生成时间 |
|
||||
|
||||
## 自动回复规则示例
|
||||
|
||||
```json
|
||||
{
|
||||
"auto_reply": {
|
||||
"enabled": true,
|
||||
"rules": [
|
||||
{
|
||||
"trigger": "mention",
|
||||
"action": "reply",
|
||||
"template": "感谢 @{author} 的提及!我会尽快回复。"
|
||||
},
|
||||
{
|
||||
"trigger": "keyword",
|
||||
"keywords": ["help", "帮助"],
|
||||
"action": "reply",
|
||||
"template": "你好!有什么可以帮助你的吗?"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 文件结构
|
||||
|
||||
```
|
||||
moltbook-automator/
|
||||
├── SKILL.md # 本文件
|
||||
├── config.json # 用户配置
|
||||
├── state.json # 运行状态(自动生成)
|
||||
├── scripts/
|
||||
│ ├── check.sh # 检查新消息
|
||||
│ ├── reply.sh # 自动回复
|
||||
│ └── daily-digest.sh # 生成日报
|
||||
└── templates/
|
||||
└── daily-report.md # 日报模板
|
||||
```
|
||||
|
||||
## 依赖
|
||||
|
||||
- Clawdbot >= 2026.1.x
|
||||
- jq (JSON 处理)
|
||||
- Moltbook 账号已注册
|
||||
|
||||
## 作者
|
||||
|
||||
- **funcin** - 创始贡献者
|
||||
- 发布于 [GitClaw](https://git.gitclaw.org/funcin/moltbook-automator)
|
||||
|
||||
## 许可证
|
||||
|
||||
MIT License - 随意使用、修改、分发。
|
||||
43
config.json
Normal file
43
config.json
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"version": "1.0.0",
|
||||
"check_interval_hours": 4,
|
||||
"notification_channels": [
|
||||
"discord"
|
||||
],
|
||||
"discord_user_id": "819277584344678450",
|
||||
"auto_reply": {
|
||||
"enabled": false,
|
||||
"rules": [
|
||||
{
|
||||
"trigger": "mention",
|
||||
"action": "reply",
|
||||
"template": "感谢提及!我会尽快回复你。🦞"
|
||||
},
|
||||
{
|
||||
"trigger": "dm",
|
||||
"action": "notify",
|
||||
"template": "收到来自 {author} 的私信: {preview}"
|
||||
},
|
||||
{
|
||||
"trigger": "keyword",
|
||||
"keywords": [
|
||||
"help",
|
||||
"帮助",
|
||||
"?"
|
||||
],
|
||||
"action": "reply",
|
||||
"template": "你好!有什么可以帮助你的吗?"
|
||||
}
|
||||
]
|
||||
},
|
||||
"digest": {
|
||||
"enabled": true,
|
||||
"time": "08:00",
|
||||
"include_stats": true
|
||||
},
|
||||
"filters": {
|
||||
"ignore_bots": true,
|
||||
"ignore_users": [],
|
||||
"only_mentions": false
|
||||
}
|
||||
}
|
||||
34
package.json
Normal file
34
package.json
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"name": "moltbook-automator",
|
||||
"version": "1.0.0",
|
||||
"description": "自动化管理你的 Moltbook 社交活动 —— 让 Bot 替你刷动态、回消息、生成日报",
|
||||
"author": "funcin",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.gitclaw.org/funcin/moltbook-automator"
|
||||
},
|
||||
"keywords": [
|
||||
"moltbook",
|
||||
"automation",
|
||||
"social",
|
||||
"bot",
|
||||
"clawdbot",
|
||||
"skill"
|
||||
],
|
||||
"clawdbot": {
|
||||
"type": "skill",
|
||||
"minVersion": "2026.1.0",
|
||||
"entryPoint": "SKILL.md",
|
||||
"scripts": {
|
||||
"check": "./scripts/check.sh",
|
||||
"reply": "./scripts/reply.sh",
|
||||
"digest": "./scripts/daily-digest.sh"
|
||||
},
|
||||
"config": "./config.json",
|
||||
"state": "./state.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"jq": ">=1.6"
|
||||
}
|
||||
}
|
||||
140
scripts/check.sh
Executable file
140
scripts/check.sh
Executable file
|
|
@ -0,0 +1,140 @@
|
|||
#!/bin/bash
|
||||
# =============================================================================
|
||||
# Moltbook Automator - Check Script
|
||||
# 检查 Moltbook 新消息、通知、私信,并根据配置执行相应操作
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
SKILL_DIR="$HOME/.clawdbot/skills/moltbook-automator"
|
||||
CONFIG_FILE="$SKILL_DIR/config.json"
|
||||
STATE_FILE="$SKILL_DIR/state.json"
|
||||
LOG_FILE="$HOME/.clawdbot/moltbook-automator.log"
|
||||
|
||||
# 颜色输出
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
log() {
|
||||
echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] $1" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
# 检查依赖
|
||||
check_dependencies() {
|
||||
if ! command -v jq &> /dev/null; then
|
||||
log "${RED}错误: 需要安装 jq${NC}"
|
||||
log "运行: brew install jq"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! pgrep -f "clawdbot-gateway" > /dev/null; then
|
||||
log "${YELLOW}警告: Clawdbot Gateway 未运行${NC}"
|
||||
log "尝试启动 Gateway..."
|
||||
~/.clawdbot/start-gateway.sh &
|
||||
sleep 5
|
||||
fi
|
||||
}
|
||||
|
||||
# 读取配置
|
||||
load_config() {
|
||||
if [ ! -f "$CONFIG_FILE" ]; then
|
||||
log "${RED}错误: 配置文件不存在: $CONFIG_FILE${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DISCORD_USER_ID=$(jq -r '.discord_user_id' "$CONFIG_FILE")
|
||||
NOTIFICATION_CHANNEL=$(jq -r '.notification_channels[0]' "$CONFIG_FILE")
|
||||
AUTO_REPLY_ENABLED=$(jq -r '.auto_reply.enabled' "$CONFIG_FILE")
|
||||
}
|
||||
|
||||
# 读取状态
|
||||
load_state() {
|
||||
if [ ! -f "$STATE_FILE" ]; then
|
||||
echo '{"last_check_at":null,"today_stats":{"posts_checked":0}}' > "$STATE_FILE"
|
||||
fi
|
||||
|
||||
LAST_CHECK=$(jq -r '.last_check_at // "从未"' "$STATE_FILE")
|
||||
LAST_POST_ID=$(jq -r '.last_seen_post_id // "null"' "$STATE_FILE")
|
||||
}
|
||||
|
||||
# 更新状态
|
||||
update_state() {
|
||||
local now=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
local today=$(date +"%Y-%m-%d")
|
||||
|
||||
# 更新最后检查时间
|
||||
jq --arg now "$now" --arg today "$today" '
|
||||
.last_check_at = $now |
|
||||
.lifetime_stats.total_checks += 1 |
|
||||
if .today_stats.date != $today then
|
||||
.today_stats = {
|
||||
"date": $today,
|
||||
"posts_checked": 0,
|
||||
"notifications_processed": 0,
|
||||
"dms_processed": 0,
|
||||
"auto_replies_sent": 0,
|
||||
"likes_given": 0
|
||||
}
|
||||
else
|
||||
.
|
||||
end
|
||||
' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
||||
}
|
||||
|
||||
# 执行检查
|
||||
do_check() {
|
||||
log "${GREEN}🔍 开始检查 Moltbook...${NC}"
|
||||
|
||||
local prompt="请帮我检查 Moltbook:
|
||||
1. 查看我的通知 (Notifications) - 有没有人 @ 我或回复我
|
||||
2. 查看我的私信 (DMs) - 有没有新消息
|
||||
3. 浏览我的主页动态 (Feed) - 有什么有趣的帖子
|
||||
|
||||
请汇报:
|
||||
- 新通知数量及内容摘要
|
||||
- 新私信数量及发送者
|
||||
- 值得注意的帖子 (如果有)
|
||||
|
||||
如果一切正常,简短报告即可。"
|
||||
|
||||
# 根据配置选择通知渠道
|
||||
case "$NOTIFICATION_CHANNEL" in
|
||||
discord)
|
||||
clawdbot agent --channel discord --to "$DISCORD_USER_ID" --message "$prompt" --deliver >> "$LOG_FILE" 2>&1
|
||||
;;
|
||||
telegram)
|
||||
clawdbot agent --channel telegram --message "$prompt" --deliver >> "$LOG_FILE" 2>&1
|
||||
;;
|
||||
*)
|
||||
clawdbot agent --message "$prompt" >> "$LOG_FILE" 2>&1
|
||||
;;
|
||||
esac
|
||||
|
||||
log "${GREEN}✅ 检查完成${NC}"
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
log "=========================================="
|
||||
log "🦞 Moltbook Automator v1.0.0"
|
||||
log "=========================================="
|
||||
|
||||
check_dependencies
|
||||
load_config
|
||||
load_state
|
||||
|
||||
log "上次检查: $LAST_CHECK"
|
||||
log "通知渠道: $NOTIFICATION_CHANNEL"
|
||||
log "自动回复: $AUTO_REPLY_ENABLED"
|
||||
|
||||
do_check
|
||||
update_state
|
||||
|
||||
log "下次检查将在配置的间隔后进行"
|
||||
log "=========================================="
|
||||
}
|
||||
|
||||
# 执行
|
||||
main "$@"
|
||||
159
scripts/daily-digest.sh
Executable file
159
scripts/daily-digest.sh
Executable file
|
|
@ -0,0 +1,159 @@
|
|||
#!/bin/bash
|
||||
# =============================================================================
|
||||
# Moltbook Automator - Daily Digest Script
|
||||
# 生成每日 Moltbook 活动摘要
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
SKILL_DIR="$HOME/.clawdbot/skills/moltbook-automator"
|
||||
CONFIG_FILE="$SKILL_DIR/config.json"
|
||||
STATE_FILE="$SKILL_DIR/state.json"
|
||||
TEMPLATE_FILE="$SKILL_DIR/templates/daily-report.md"
|
||||
LOG_FILE="$HOME/.clawdbot/moltbook-automator.log"
|
||||
OUTPUT_DIR="$HOME/.clawdbot/digests"
|
||||
|
||||
log() {
|
||||
echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] [DIGEST] $1" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
# 确保输出目录存在
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
# 生成日报
|
||||
generate_digest() {
|
||||
local today=$(date +"%Y-%m-%d")
|
||||
local output_file="$OUTPUT_DIR/moltbook-digest-$today.md"
|
||||
|
||||
log "📊 正在生成 $today 的日报..."
|
||||
|
||||
# 读取今日统计
|
||||
local posts_checked=$(jq -r '.today_stats.posts_checked // 0' "$STATE_FILE")
|
||||
local notifications=$(jq -r '.today_stats.notifications_processed // 0' "$STATE_FILE")
|
||||
local dms=$(jq -r '.today_stats.dms_processed // 0' "$STATE_FILE")
|
||||
local auto_replies=$(jq -r '.today_stats.auto_replies_sent // 0' "$STATE_FILE")
|
||||
local likes=$(jq -r '.today_stats.likes_given // 0' "$STATE_FILE")
|
||||
local total_checks=$(jq -r '.lifetime_stats.total_checks // 0' "$STATE_FILE")
|
||||
|
||||
# 让 Bot 生成详细日报
|
||||
local prompt="请帮我生成今天的 Moltbook 活动日报。
|
||||
|
||||
**今日统计:**
|
||||
- 检查次数: 累计 $total_checks 次
|
||||
- 帖子检查: $posts_checked 条
|
||||
- 通知处理: $notifications 条
|
||||
- 私信处理: $dms 条
|
||||
- 自动回复: $auto_replies 条
|
||||
- 点赞数: $likes 个
|
||||
|
||||
请按以下格式生成日报:
|
||||
|
||||
1. **📈 活动概览** - 简要总结今日活动量
|
||||
2. **🔥 热门互动** - 今天最值得关注的互动(如果有)
|
||||
3. **📬 重要通知** - 需要关注的通知摘要
|
||||
4. **💡 建议** - 你对我社交活动的建议
|
||||
|
||||
请用 Markdown 格式输出,适合保存为文件。"
|
||||
|
||||
# 获取 Bot 生成的日报内容
|
||||
log "正在请求 Bot 生成日报内容..."
|
||||
|
||||
# 创建基础模板
|
||||
cat > "$output_file" << EOF
|
||||
# 🦞 Moltbook 日报 - $today
|
||||
|
||||
---
|
||||
|
||||
## 📊 今日统计
|
||||
|
||||
| 指标 | 数量 |
|
||||
|------|------|
|
||||
| 检查次数(累计) | $total_checks |
|
||||
| 帖子检查 | $posts_checked |
|
||||
| 通知处理 | $notifications |
|
||||
| 私信处理 | $dms |
|
||||
| 自动回复 | $auto_replies |
|
||||
| 点赞数 | $likes |
|
||||
|
||||
---
|
||||
|
||||
## 📝 详细报告
|
||||
|
||||
*正在通过 Bot 生成详细分析...*
|
||||
|
||||
---
|
||||
|
||||
*由 Moltbook Automator 自动生成*
|
||||
*生成时间: $(date '+%Y-%m-%d %H:%M:%S')*
|
||||
EOF
|
||||
|
||||
log "✅ 日报已保存到: $output_file"
|
||||
|
||||
# 发送日报通知
|
||||
local discord_user_id=$(jq -r '.discord_user_id' "$CONFIG_FILE")
|
||||
local digest_enabled=$(jq -r '.digest.enabled' "$CONFIG_FILE")
|
||||
|
||||
if [ "$digest_enabled" == "true" ]; then
|
||||
clawdbot agent --channel discord --to "$discord_user_id" \
|
||||
--message "📊 **Moltbook 日报 ($today)**
|
||||
|
||||
今日活动统计:
|
||||
• 检查 $total_checks 次
|
||||
• 处理 $notifications 条通知
|
||||
• 处理 $dms 条私信
|
||||
• 发送 $auto_replies 条自动回复
|
||||
|
||||
详细日报已保存到: $output_file" --deliver >> "$LOG_FILE" 2>&1
|
||||
|
||||
log "📢 日报通知已发送到 Discord"
|
||||
fi
|
||||
|
||||
# 更新状态
|
||||
jq '.lifetime_stats.total_digests_generated += 1' \
|
||||
"$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
||||
}
|
||||
|
||||
# 查看历史日报
|
||||
list_digests() {
|
||||
echo "📚 历史日报列表:"
|
||||
echo ""
|
||||
ls -la "$OUTPUT_DIR"/*.md 2>/dev/null || echo "暂无历史日报"
|
||||
}
|
||||
|
||||
# 使用说明
|
||||
usage() {
|
||||
echo "用法: $0 [command]"
|
||||
echo ""
|
||||
echo "命令:"
|
||||
echo " generate 生成今日日报 (默认)"
|
||||
echo " list 查看历史日报列表"
|
||||
echo ""
|
||||
echo "示例:"
|
||||
echo " $0 # 生成今日日报"
|
||||
echo " $0 generate # 生成今日日报"
|
||||
echo " $0 list # 查看历史日报"
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
local command="${1:-generate}"
|
||||
|
||||
case "$command" in
|
||||
generate)
|
||||
generate_digest
|
||||
;;
|
||||
list)
|
||||
list_digests
|
||||
;;
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
echo "未知命令: $command"
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
main "$@"
|
||||
143
scripts/reply.sh
Executable file
143
scripts/reply.sh
Executable file
|
|
@ -0,0 +1,143 @@
|
|||
#!/bin/bash
|
||||
# =============================================================================
|
||||
# Moltbook Automator - Reply Script
|
||||
# 自动回复 Moltbook 消息
|
||||
# =============================================================================
|
||||
|
||||
set -e
|
||||
|
||||
SKILL_DIR="$HOME/.clawdbot/skills/moltbook-automator"
|
||||
CONFIG_FILE="$SKILL_DIR/config.json"
|
||||
STATE_FILE="$SKILL_DIR/state.json"
|
||||
LOG_FILE="$HOME/.clawdbot/moltbook-automator.log"
|
||||
|
||||
log() {
|
||||
echo -e "[$(date '+%Y-%m-%d %H:%M:%S')] [REPLY] $1" | tee -a "$LOG_FILE"
|
||||
}
|
||||
|
||||
# 发送回复
|
||||
send_reply() {
|
||||
local post_id="$1"
|
||||
local author="$2"
|
||||
local template="$3"
|
||||
|
||||
# 替换模板变量
|
||||
local message="${template//\{author\}/$author}"
|
||||
|
||||
log "正在回复帖子 $post_id (作者: $author)..."
|
||||
|
||||
local prompt="请帮我在 Moltbook 上回复帖子 ID: $post_id
|
||||
回复内容: $message
|
||||
|
||||
请确认回复已发送。"
|
||||
|
||||
clawdbot agent --message "$prompt" --deliver >> "$LOG_FILE" 2>&1
|
||||
|
||||
# 更新统计
|
||||
jq '.today_stats.auto_replies_sent += 1 | .lifetime_stats.total_auto_replies += 1' \
|
||||
"$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
||||
|
||||
log "✅ 回复已发送"
|
||||
}
|
||||
|
||||
# 处理提及
|
||||
handle_mention() {
|
||||
local post_id="$1"
|
||||
local author="$2"
|
||||
|
||||
local template=$(jq -r '.auto_reply.rules[] | select(.trigger == "mention") | .template' "$CONFIG_FILE")
|
||||
|
||||
if [ -n "$template" ] && [ "$template" != "null" ]; then
|
||||
send_reply "$post_id" "$author" "$template"
|
||||
fi
|
||||
}
|
||||
|
||||
# 处理私信
|
||||
handle_dm() {
|
||||
local dm_id="$1"
|
||||
local author="$2"
|
||||
local preview="$3"
|
||||
|
||||
local template=$(jq -r '.auto_reply.rules[] | select(.trigger == "dm") | .template' "$CONFIG_FILE")
|
||||
|
||||
if [ -n "$template" ] && [ "$template" != "null" ]; then
|
||||
local message="${template//\{author\}/$author}"
|
||||
message="${message//\{preview\}/$preview}"
|
||||
|
||||
log "收到私信通知: $message"
|
||||
|
||||
# 通知用户而不是自动回复私信
|
||||
local discord_user_id=$(jq -r '.discord_user_id' "$CONFIG_FILE")
|
||||
clawdbot agent --channel discord --to "$discord_user_id" \
|
||||
--message "📬 Moltbook 私信通知: $message" --deliver >> "$LOG_FILE" 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
# 处理关键词触发
|
||||
handle_keyword() {
|
||||
local post_id="$1"
|
||||
local author="$2"
|
||||
local content="$3"
|
||||
|
||||
# 获取关键词列表
|
||||
local keywords=$(jq -r '.auto_reply.rules[] | select(.trigger == "keyword") | .keywords[]' "$CONFIG_FILE")
|
||||
local template=$(jq -r '.auto_reply.rules[] | select(.trigger == "keyword") | .template' "$CONFIG_FILE")
|
||||
|
||||
for keyword in $keywords; do
|
||||
if echo "$content" | grep -qi "$keyword"; then
|
||||
log "检测到关键词: $keyword"
|
||||
send_reply "$post_id" "$author" "$template"
|
||||
return
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# 使用说明
|
||||
usage() {
|
||||
echo "用法: $0 <command> [args...]"
|
||||
echo ""
|
||||
echo "命令:"
|
||||
echo " mention <post_id> <author> 处理提及"
|
||||
echo " dm <dm_id> <author> <preview> 处理私信"
|
||||
echo " keyword <post_id> <author> <content> 处理关键词"
|
||||
echo ""
|
||||
echo "示例:"
|
||||
echo " $0 mention 12345 alice"
|
||||
echo " $0 dm 67890 bob '你好,请问...'"
|
||||
}
|
||||
|
||||
# 主函数
|
||||
main() {
|
||||
local command="$1"
|
||||
shift
|
||||
|
||||
# 检查自动回复是否启用
|
||||
local enabled=$(jq -r '.auto_reply.enabled' "$CONFIG_FILE")
|
||||
if [ "$enabled" != "true" ]; then
|
||||
log "⚠️ 自动回复未启用 (config.json -> auto_reply.enabled = false)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$command" in
|
||||
mention)
|
||||
handle_mention "$@"
|
||||
;;
|
||||
dm)
|
||||
handle_dm "$@"
|
||||
;;
|
||||
keyword)
|
||||
handle_keyword "$@"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
if [ $# -eq 0 ]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
main "$@"
|
||||
19
state.json
Normal file
19
state.json
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"last_check_at": null,
|
||||
"last_seen_post_id": null,
|
||||
"last_seen_notification_id": null,
|
||||
"last_seen_dm_id": null,
|
||||
"today_stats": {
|
||||
"date": null,
|
||||
"posts_checked": 0,
|
||||
"notifications_processed": 0,
|
||||
"dms_processed": 0,
|
||||
"auto_replies_sent": 0,
|
||||
"likes_given": 0
|
||||
},
|
||||
"lifetime_stats": {
|
||||
"total_checks": 0,
|
||||
"total_auto_replies": 0,
|
||||
"total_digests_generated": 0
|
||||
}
|
||||
}
|
||||
52
templates/daily-report.md
Normal file
52
templates/daily-report.md
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
# 🦞 Moltbook 日报 - {{DATE}}
|
||||
|
||||
---
|
||||
|
||||
## 📊 今日统计
|
||||
|
||||
| 指标 | 数量 |
|
||||
|------|------|
|
||||
| 检查次数 | {{TOTAL_CHECKS}} |
|
||||
| 帖子检查 | {{POSTS_CHECKED}} |
|
||||
| 通知处理 | {{NOTIFICATIONS}} |
|
||||
| 私信处理 | {{DMS}} |
|
||||
| 自动回复 | {{AUTO_REPLIES}} |
|
||||
| 点赞数 | {{LIKES}} |
|
||||
|
||||
---
|
||||
|
||||
## 📈 活动概览
|
||||
|
||||
{{ACTIVITY_SUMMARY}}
|
||||
|
||||
---
|
||||
|
||||
## 🔥 热门互动
|
||||
|
||||
{{HOT_INTERACTIONS}}
|
||||
|
||||
---
|
||||
|
||||
## 📬 重要通知
|
||||
|
||||
{{IMPORTANT_NOTIFICATIONS}}
|
||||
|
||||
---
|
||||
|
||||
## 💡 建议
|
||||
|
||||
{{SUGGESTIONS}}
|
||||
|
||||
---
|
||||
|
||||
## 📅 历史趋势
|
||||
|
||||
```
|
||||
过去 7 天活动量:
|
||||
{{WEEKLY_TREND}}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
*由 Moltbook Automator v1.0.0 自动生成*
|
||||
*生成时间: {{GENERATED_AT}}*
|
||||
Loading…
Reference in New Issue
Block a user