返回顶部
u

unanswered-messages未回复消息

Track and find unanswered messages using a local file-based inbox. No DB required. Use when asked to find unanswered messages, missed messages, people waiting for a response, or to log a new incoming message.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
85
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

unanswered-messages

技能名称: unanswered-messages
详细描述:

未回复消息(基于文件)

追踪发送给Heleni但尚未回复的消息。
无需数据库 — 使用 /opt/ocana/openclaw/workspace/inbox/pending.json。



文件结构

/opt/ocana/openclaw/workspace/inbox/pending.json:

json
{
version: 1,
messages: [
{
id: MSG_ID,
ts: 2026-04-01T14:30:00Z,
chat_id: +972XXXXXXXXX,
chat_name: Netanel,
chat_type: direct,
sender_name: Netanel,
sender_phone: +972XXXXXXXXX,
body: message text...,
answered: false,
answered_at: null
}
]
}



1. 记录一条传入消息

当需要回复的消息到达时,将其添加到文件中:

python
import json, datetime

INBOX = /opt/ocana/openclaw/workspace/inbox/pending.json

with open(INBOX) as f:
data = json.load(f)

data[messages].append({
id: ,
ts: datetime.datetime.utcnow().isoformat() + Z,
chatid: id>,
chatname: name>,
chat_type: direct, # 或 group
sendername: name>,
senderphone: phone>,
body: ,
answered: False,
answered_at: None
})

with open(INBOX, w) as f:
json.dump(data, f, indent=2)



2. 将消息标记为已回复

回复后,将其标记为已完成:

python
import json, datetime

INBOX = /opt/ocana/openclaw/workspace/inbox/pending.json

with open(INBOX) as f:
data = json.load(f)

for msg in data[messages]:
if msg[id] == :
msg[answered] = True
msg[answered_at] = datetime.datetime.utcnow().isoformat() + Z

with open(INBOX, w) as f:
json.dump(data, f, indent=2)



3. 查找未回复消息

python
import json
from datetime import datetime, timedelta, timezone

INBOX = /opt/ocana/openclaw/workspace/inbox/pending.json
MAXAGEHOURS = 24 # 忽略非常旧的消息

with open(INBOX) as f:
data = json.load(f)

cutoff = datetime.now(timezone.utc) - timedelta(hours=MAXAGEHOURS)
unanswered = [
m for m in data[messages]
if not m[answered]
and datetime.fromisoformat(m[ts].replace(Z, +00:00)) > cutoff
]

for m in sorted(unanswered, key=lambda x: x[ts]):
ts = datetime.fromisoformat(m[ts].replace(Z, +00:00)).strftime(%d/%m %H:%M)
print(f📩 {m[sendername]} | {m[chatname]} | {ts})
print(f > {m[body][:100]})
print(f Message ID: {m[id]})



4. 清理 — 移除旧的已回复消息

定期运行(例如通过心跳每周一次)以保持文件小巧:

python
import json
from datetime import datetime, timedelta, timezone

INBOX = /opt/ocana/openclaw/workspace/inbox/pending.json

with open(INBOX) as f:
data = json.load(f)

cutoff = datetime.now(timezone.utc) - timedelta(days=7)
data[messages] = [
m for m in data[messages]
if not m[answered]
or datetime.fromisoformat(m[ts].replace(Z, +00:00)) > cutoff
]

with open(INBOX, w) as f:
json.dump(data, f, indent=2)

print(fKept {len(data[messages])} messages)



心跳集成

在心跳期间,检查过去2小时内未回复的消息:

python
import json
from datetime import datetime, timedelta, timezone

INBOX = /opt/ocana/openclaw/workspace/inbox/pending.json

with open(INBOX) as f:
data = json.load(f)

cutoff = datetime.now(timezone.utc) - timedelta(hours=2)
unanswered = [
m for m in data[messages]
if not m[answered]
and datetime.fromisoformat(m[ts].replace(Z, +00:00)) > cutoff
]

if unanswered:
# 提醒Netanel或直接处理
for m in unanswered:
print(f⚠️ לא ענינו ל-{m[sender_name]}: {m[body][:80]})

将此检查添加到 HEARTBEAT.md 的 Heartbeat Checks 部分下。



输出格式

报告未回复消息的格式为:

  • - 📩 [sendername] | [chatname] | [DD/MM HH:MM]

> [body preview, max 100 chars]
> Message ID: [message_id]

如果来自同一对话的多条消息,则按聊天分组。



备注

  • - ❌ 无需数据库,无需隧道,无需psql — 纯文件I/O
  • ✅ 可离线工作,可在AWS上工作而无需Mac隧道
  • 收件箱文件:/opt/ocana/openclaw/workspace/inbox/pending.json
  • 当前:当Heleni决定追踪消息时,手动记录消息
  • 未来:接入入站消息处理器以自动记录

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 unanswered-messages-1775884741 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 unanswered-messages-1775884741 技能

通过命令行安装

skillhub install unanswered-messages-1775884741

下载

⬇ 下载 unanswered-messages v1.0.0(免费)

文件大小: 2.26 KB | 发布时间: 2026-4-12 11:47

v1.0.0 最新 2026-4-12 11:47
Initial release — track unanswered messages via a local JSON file, no database needed.

- Add, find, and mark messages as answered using a simple file structure.
- Purge old answered messages periodically to keep the file small.
- Provides code snippets for logging, querying, and maintaining an unanswered messages inbox.
- Supports heartbeat integration to alert on recent unanswered messages.
- Designed for offline and AWS use with no external dependencies.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large