Hi again (2/2),
Another self-chat mode quirk: clawdis sends read receipts (blue ticks) for every incoming whatsapp message I receive.
In two-phone mode this makes sense, because the bot is a separate entity that "reads" the message. In self-chat mode, this means everyone who messages me sees blue ticks instantly, and I can't see which of my messages are unread.
I'd patched this locally by auto-detecting self-chat mode and skip sending read receipts. Local implementation duplicates computing isSelfChatMode (like in #34); but if both make it in would instead extract to a shared helper (see below for both cases).
Happy to submit a small PR alongside the other one if this looks right!
Thomas
Issue writeup
- Expected: In self-chat mode, read receipts behave normally (sent when I actually view messages on my phone)
- Actual: All incoming WhatsApp messages are immediately marked as read
- Cause: sock.readMessages() is called unconditionally for all processed messages
- Proposed fix: Detect self-chat mode and skip read receipts.
- Implementation:
// src/utils.ts or src/config/config.ts
export function isSelfChatMode(selfE164: string | null, allowFrom?: string[]): boolean {
if (!selfE164 || !allowFrom?.length) return false;
return allowFrom.some((n) => normalizeE164(n) === selfE164);
}
- Else, standalone fix is to recompute
isSelfChatMode in src/web/inbound.ts
const isSelfChatMode = selfE164 && allowFrom?.some((n) => normalizeE164(n) === selfE164);
if (id && !isSelfChatMode) {
await sock.readMessages([...]);
}
Hi again (2/2),
Another self-chat mode quirk: clawdis sends read receipts (blue ticks) for every incoming whatsapp message I receive.
In two-phone mode this makes sense, because the bot is a separate entity that "reads" the message. In self-chat mode, this means everyone who messages me sees blue ticks instantly, and I can't see which of my messages are unread.
I'd patched this locally by auto-detecting self-chat mode and skip sending read receipts. Local implementation duplicates computing
isSelfChatMode(like in #34); but if both make it in would instead extract to a shared helper (see below for both cases).Happy to submit a small PR alongside the other one if this looks right!
Thomas
Issue writeup
isSelfChatModeto a shared helper that both src/web/auto-reply.ts and src/web/inbound.ts import and useisSelfChatModeinsrc/web/inbound.ts