web: send read receipts for inbound messages

This commit is contained in:
Peter Steinberger
2025-11-25 06:36:22 +01:00
parent 716f31f17a
commit a331bd5ea1
3 changed files with 60 additions and 0 deletions

View File

@@ -260,6 +260,20 @@ export async function monitorWebInbox(options: {
// Ignore status/broadcast traffic; we only care about direct chats.
if (remoteJid.endsWith("@status") || remoteJid.endsWith("@broadcast"))
continue;
if (id) {
const participant = msg.key?.participant;
try {
await sock.readMessages([
{ remoteJid, id, participant, fromMe: false },
]);
if (isVerbose()) {
const suffix = participant ? ` (participant ${participant})` : "";
logVerbose(`Marked message ${id} as read for ${remoteJid}${suffix}`);
}
} catch (err) {
logVerbose(`Failed to mark message ${id} read: ${String(err)}`);
}
}
const from = jidToE164(remoteJid);
if (!from) continue;
let body = extractText(msg.message ?? undefined);