Initial Commit
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s

This commit is contained in:
2026-08-28 23:53:45 +10:00
parent 3ce70b3701
commit 37ff8e0a88
13 changed files with 292 additions and 23 deletions
+13
View File
@@ -61,6 +61,18 @@ function extractShare(node) {
};
}
// A raw photo/video message has content_type 'IMAGES' with one or more
// attachments (Instagram allows sending several photos in a single message).
function extractAttachments(node) {
const attachments = node.content?.attachments;
if (!attachments?.length) return null;
return attachments.map((a) => ({
url: a.attachment_cdn_url || a.preview_cdn_url || null,
width: a.preview_width || null,
height: a.preview_height || null,
})).filter((a) => a.url);
}
function extractMessage(node, thread, fbidLookup) {
const senderDict = node.sender?.user_dict;
const resolved = senderDict
@@ -85,6 +97,7 @@ function extractMessage(node, thread, fbidLookup) {
text: node.text_body || node.content?.text_body || null,
timestamp_ms: node.timestamp_ms ? Number(node.timestamp_ms) : null,
share: extractShare(node),
attachments: extractAttachments(node),
reactions: reactions.length ? reactions : null,
replied_to_id: node.replied_to_message_id || null,
replied_to_text: node.replied_to_message?.text_body || null,