mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 11:43:14 +08:00
fix(whatsapp): deliver scheduled job attachments to groups
Scheduled outbound only sent text via pollOutboundQueue; collect deliverable attachments from the turn, encode them in source JSON, and send via sendReplyWithAttachments. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
40eed39110
commit
f5cb64a3a4
7 changed files with 248 additions and 16 deletions
|
|
@ -6436,19 +6436,35 @@ class SqliteStore(ScheduledJobStoreMixin):
|
|||
""",
|
||||
(str(channel), str(account_id), utc_now_iso(), lim),
|
||||
).fetchall()
|
||||
return [
|
||||
{
|
||||
out: list[dict[str, Any]] = []
|
||||
for r in rows:
|
||||
source = str(r["source"] or "")
|
||||
meta: dict[str, Any] = {}
|
||||
if source.startswith("{"):
|
||||
try:
|
||||
parsed = json.loads(source)
|
||||
if isinstance(parsed, dict):
|
||||
meta = parsed
|
||||
except Exception:
|
||||
meta = {}
|
||||
item: dict[str, Any] = {
|
||||
"id": str(r["id"] or ""),
|
||||
"tenant_id": str(r["tenant_id"] or ""),
|
||||
"channel": str(r["channel"] or ""),
|
||||
"account_id": str(r["account_id"] or ""),
|
||||
"chat_id": str(r["chat_id"] or ""),
|
||||
"text": str(r["text"] or ""),
|
||||
"source": str(r["source"] or ""),
|
||||
"source": source,
|
||||
"created_at": str(r["created_at"] or ""),
|
||||
}
|
||||
for r in rows
|
||||
]
|
||||
atts = [a for a in (meta.get("attachments") or []) if isinstance(a, dict)]
|
||||
if atts:
|
||||
item["attachments"] = atts
|
||||
mp = str(meta.get("media_path") or "").strip()
|
||||
if mp:
|
||||
item["media_path"] = mp
|
||||
out.append(item)
|
||||
return out
|
||||
|
||||
def list_pending_weixin_outbound_messages(
|
||||
self,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue