网淘吧来吧,欢迎您!

iResponder

2026-03-31 新闻来源:网淘吧 围观:10
电脑广告
手机广告

iMessage 自动回复器

使用符合您语气和对话情境的AI生成回复,自动响应特定联系人的iMessage/SMS消息。

⚠️ 前提条件清单

使用此技能前,请确保您已具备:

iResponder

  • macOS 操作系统且“信息”应用已登录 iMessage
  • imsg 命令行工具已安装:通过命令 `brew install steipete/tap/imsg` 安装
  • OpenAI API 密钥已在 Clawdbot 配置中设置好
  • 完全磁盘访问权限已授予终端/iTerm
  • 信息应用自动化权限(首次使用时 macOS 会提示)

功能特点

  • 🤖基于 AI 的智能回复使用 OpenAI GPT-4 模型
  • 📱基于联系人的提示词设置- 可为不同联系人设置不同的 AI 个性
  • ⏱️速率限制- 自动回复之间的可配置延迟
  • 💬上下文感知- AI 能看到最近的对话历史
  • 📊Telegram 管理- 斜杠命令 + 自然语言
  • 🔄后台监控- 持续轮询新消息
  • 🔧自动清理- 重启时清除陈旧锁定(防止联系人卡住)
  • 🧪测试模式- 生成真实 AI 回复但不发送
  • 时间窗口- 仅在特定时段响应(例如,上午 9 点 - 晚上 10 点)
  • 🔑关键词触发器- 仅当消息包含特定关键词(例如“紧急”、“帮助”)时回复
  • 📊统计追踪- 追踪总回复数、每日计数以及每个联系人的平均回复量
  • 🚦每日上限- 限制每个联系人每日最大回复数(安全功能)

快速开始

1. 将联系人添加到监控列表

cd ~/clawd/imsg-autoresponder/scripts
node manage.js add "+15551234567" "Reply with a middle finger emoji" "Best Friend"
node manage.js add "+15559876543" "You are my helpful assistant. Reply warmly and briefly, as if I'm responding myself. Keep it under 160 characters." "Mom"

2. 启动监控器

node watcher.js

监控器在前台运行,日志记录在~/clawd/logs/imsg-autoresponder.log

3. 在后台运行(推荐)

# Start in background
nohup node ~/clawd/imsg-autoresponder/scripts/watcher.js > /dev/null 2>&1 &

# Or use screen/tmux
screen -S imsg-watcher
node ~/clawd/imsg-autoresponder/scripts/watcher.js
# Ctrl+A, D to detach

配置

配置文件:~/clawd/imsg-autoresponder.json

{
  "enabled": true,
  "defaultMinMinutesBetweenReplies": 15,
  "watchList": [
    {
      "identifier": "+15551234567",
      "name": "Best Friend",
      "prompt": "Reply with a middle finger emoji",
      "minMinutesBetweenReplies": 10,
      "enabled": true
    }
  ]
}

通过Telegram管理(推荐)

自动回复器可以通过Telegram直接管理,使用斜杠命令自然语言.

斜杠命令

支持空格和下划线两种格式:

/autorespond list              OR  /autorespond_list
/autorespond status            OR  /autorespond_status
/autorespond add               OR  /autorespond_add <number> <name> <prompt>
/autorespond remove            OR  /autorespond_remove <number>
/autorespond edit              OR  /autorespond_edit <number> <prompt>
/autorespond delay             OR  /autorespond_delay <number> <minutes>
/autorespond history           OR  /autorespond_history <number>
/autorespond test              OR  /autorespond_test <number> <message>
/autorespond toggle            OR  /autorespond_toggle
/autorespond restart           OR  /autorespond_restart

Bulk Operations:
/autorespond set-all-delays    OR  /autorespond_set_all_delays <minutes>
/autorespond enable-all        OR  /autorespond_enable_all
/autorespond disable-all       OR  /autorespond_disable_all

Time Windows:
/autorespond set-time-window   OR  /autorespond_set_time_window <number> <start> <end>
/autorespond clear-time-windows OR  /autorespond_clear_time_windows <number>

Keyword Triggers:
/autorespond add-keyword       OR  /autorespond_add_keyword <number> <keyword>
/autorespond remove-keyword    OR  /autorespond_remove_keyword <number> <keyword>
/autorespond clear-keywords    OR  /autorespond_clear_keywords <number>

Statistics & Limits:
/autorespond stats             OR  /autorespond_stats [<number>]
/autorespond set-daily-cap     OR  /autorespond_set_daily_cap <number> <max>

示例:

/autorespond_list
/autorespond_status
/autorespond_edit +15551234567 Be more sarcastic
/autorespond_delay +15551234567 30
/autorespond_history +15551234567
/autorespond_set_time_window +15551234567 09:00 22:00
/autorespond_clear_time_windows +15551234567
/autorespond_add_keyword +15551234567 urgent
/autorespond_add_keyword +15551234567 help
/autorespond_clear_keywords +15551234567
/autorespond_stats
/autorespond_stats +15551234567
/autorespond_set_daily_cap +15551234567 10
/autorespond_set_all_delays 30
/autorespond_disable_all
/autorespond_restart

自然语言

您也可以用自然语言直接询问:

  • "显示自动回复器的状态"
  • "将 +15551234567 添加到监控列表,并设置提示语:语气要讽刺"
  • "将 Scott 的提示语改为更友好些"
  • "为妈妈禁用自动回复"
  • "自动回复器最近给 Foxy 发送了什么?"
  • "重启自动回复器"

代理将理解并使用telegram-handler.js脚本来执行命令。

命令行管理(高级)

cd ~/clawd/imsg-autoresponder/scripts

# List all contacts
node manage.js list

# Add contact
node manage.js add "+15551234567" "Your custom prompt here" "Optional Name"

# Remove contact
node manage.js remove "+15551234567"

# Enable/disable contact
node manage.js enable "+15551234567"
node manage.js disable "+15551234567"

# Set custom delay for contact (in minutes)
node manage.js set-delay "+15551234567" 30

# Toggle entire system on/off
node manage.js toggle

工作原理

  1. Watcher(监控器)通过imsg watch
  2. 监控所有传入的消息。检查监控列表
  3. 限速确保我们不会发送垃圾信息(回复间隔时间可配置)
  4. 获取消息历史记录用于对话(最近20条消息)
  5. 生成AI回复使用Clawdbot + 联系人的配置提示
  6. 发送回复通过imsg send
  7. 记录所有信息~/clawd/logs/imsg-autoresponder.log

状态跟踪

响应时间被记录在~/clawd/data/imsg-autoresponder-state.json:

{
  "lastResponses": {
    "+15551234567": 1706453280000
  }
}

这确保限速功能在重启后仍能正常工作。

提示词

提示词定义了AI应如何回应每个联系人。请务必具体!

示例:

"Reply with a middle finger emoji"

"You are my helpful assistant. Reply warmly and briefly, as if I'm responding myself. Keep it under 160 characters."

"You are my sarcastic friend. Reply with witty, slightly snarky responses. Keep it short."

"Politely decline any requests and say I'm busy. Be brief but friendly."

AI将看到:

  • 联系人的自定义提示词
  • 最近消息历史(最近5条消息)
  • 最新收到的消息

要求

  • 已登录Messages.app的macOS系统
  • imsg已安装CLI(brew install steipete/tap/imsg
  • 终端完全磁盘访问权限
  • 已安装并配置Clawdbot
  • Anthropic API密钥(在~/.clawdbot/clawdbot.jsonANTHROPIC_API_KEY环境变量中配置)
  • curl(macOS预安装)

安全措施

  • 速率限制防止垃圾消息(默认:每个联系人15分钟内最多回复一次)
  • 手动覆盖通过enabled: false在配置中或node manage.js disable <编号>
  • 系统切换禁用所有自动回复:node manage.js toggle
  • 日志追踪所有活动以供审查

故障排除

监控器无响应:

  • 检查~/clawd/logs/imsg-autoresponder.log中的错误
  • 验证imsg watch手动工作:imsg watch --json
  • 确保联系人位于监控列表中:node manage.js list

速率限制过于严格:

  • 调整延迟:node manage.js set-delay "+15551234567" 5
  • 或编辑defaultMinMinutesBetweenReplies在配置中

AI回复已关闭:

  • 优化该联系人的提示
  • 检查消息历史记录是否正确捕获(查看日志)

代理命令处理

当用户使用斜杠命令或关于自动回复器的自然语言时,使用telegram-handler.js脚本。

命令映射(两种格式均支持)

用户输入标准化为处理程序调用
/autorespond list/autorespond_listlistnode telegram-handler.js list
/autorespond status/autorespond_statusstatusnode telegram-handler.js status
/autorespond add/autorespond_add <参数>添加node telegram-handler.js add <number> <name> <prompt>
/autorespond remove/autorespond_remove <num>移除node telegram-handler.js remove <number>
/autorespond edit/autorespond_edit <args>编辑node telegram-handler.js edit <number> <prompt>
/autorespond delay/autorespond_delay <args>延迟node telegram-handler.js delay <number> <minutes>
/autorespond history/autorespond_history <num>历史记录node telegram-handler.js history <number> [limit]
/autorespond test/autorespond_test <数字> <消息>测试node telegram-handler.js 测试 <号码> <消息>
/autorespond 切换/autorespond_toggle切换node telegram-handler.js 切换
/autorespond 重启/autorespond_restart重启node telegram-handler.js 重启
/autorespond 设置全部延迟/autorespond_set_all_delays <分钟>设置全部延迟node telegram-handler.js 设置全部延迟 <分钟>
/autorespond 启用全部/autorespond_enable_all启用全部node telegram-handler.js 启用全部
/autorespond 禁用全部/autorespond_disable_alldisable-allnode telegram-handler.js disable-all
/autorespond set-time-window/autorespond_set_time_window <num> <s> <e>set-time-windownode telegram-handler.js set-time-window <number> <start> <end>
/autorespond clear-time-windows/autorespond_clear_time_windows <num>clear-time-windowsnode telegram-handler.js clear-time-windows <number>
/autorespond add-keyword/autorespond_add_keyword <num> <word>add-keywordnode telegram-handler.js add-keyword <number> <keyword>
/autorespond remove-keyword/autorespond_remove_keyword <num> <word>移除关键词node telegram-handler.js remove-keyword <编号> <关键词>
/autorespond clear-keywords/autorespond_clear_keywords <编号>清空关键词node telegram-handler.js clear-keywords <编号>
/autorespond stats/autorespond_stats [<编号>]统计信息node telegram-handler.js stats [<编号>]
/autorespond set-daily-cap/autorespond_set_daily_cap <编号> <上限>设置每日上限node telegram-handler.js set-daily-cap <编号> <上限>

处理步骤:

  1. 检测/autorespond/autorespond_前缀
  2. 提取子命令(将下划线标准化为空格)
  3. 解析剩余参数
  4. 使用适当参数调用 telegram-handler.js

自然语言模式匹配

  • "显示/列出/查看自动回复器" →node telegram-handler.js list
  • "将[联系人]添加到自动回复器" →node telegram-handler.js add <number> <name> <prompt>
  • "更改/编辑/更新[联系人]的提示" →node telegram-handler.js edit <number> <prompt>
  • "为[联系人]设置延迟" →node telegram-handler.js delay <number> <minutes>
  • "从自动回复器中禁用/移除[联系人]" →node telegram-handler.js remove <number>
  • "自动回复器状态" →node telegram-handler.js status
  • "自动回复器向[联系人]发送了什么" →node telegram-handler.js history <number>
  • "重启自动回复器" →node telegram-handler.js restart
  • "启用/禁用自动回复器" →node telegram-handler.js toggle

联系人解析:

  • 当用户提及联系人姓名时,从配置文件中查找其电话号码
  • 始终使用完整的E.164格式(例如,+15551234567

配置更改后:如果命令输出中提到需要重启,请务必提醒用户重启监控程序。

故障排除

监控程序无响应

检查状态:

/autorespond_status

查看日志:

tail -f ~/clawd/logs/imsg-autoresponder.log

重启:

/autorespond_restart

常见问题

"未找到OPENAI_API_KEY"

  • 将API密钥添加到~/.clawdbot/clawdbot.json:
    {
      "skills": {
        "openai-whisper-api": {
          "apiKey": "sk-proj-YOUR_KEY_HERE"
        }
      }
    }
    
  • 添加密钥后重启监控程序

权限错误

  • 在系统设置中授予终端完全磁盘访问权限
  • 授予权限后重启终端
  • 验证imsg chats --json手动运行有效

未检测到消息

  • 检查 Messages.app 是否已登录
  • 确认联系人是否在监控列表中:/autorespond_list
  • 确保监控程序正在运行:/autorespond_status

重复响应问题

  • 当前版本已通过处理锁机制修复
  • 重启监控程序以应用修复:/autorespond_restart

测试

生成实际AI响应但不发送(预览模式):

/autorespond_test +15551234567 Hey what's up?

此操作将:

  • 使用联系人的实际提示词
  • 通过OpenAI生成真实的AI响应
  • 显示将要发送的确切内容
  • 但不会实际发送消息

非常适合在上线前测试新提示词!

隐私与安全

⚠️重要提示:此工具会自动代表您发送消息。

  • 仅添加那些知道自己正在与AI发短信或不介意此事的联系人
  • 定期通过以下途径审核回复/autorespond_history
  • 使用速率限制以避免垃圾信息
  • 在适当时保持透明
  • 如需可立即禁用:/autorespond_toggle

未来增强功能

  • 基于对话模式的智能速率限制
  • 群聊支持
  • 网页仪表板
  • 语音消息转录

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏
文章底部电脑广告
手机广告位-内容正文底部
上一篇:MS Outlook + Teams Assistant 下一篇:4todo

相关文章

您是本站第349368名访客 今日有175篇新文章/评论