From ae474fd344b9e91aa6a4c154cb0cf56ca12b9432 Mon Sep 17 00:00:00 2001 From: gavrielc Date: Fri, 13 Feb 2026 23:05:36 +0200 Subject: [PATCH] fix: use available instead of paused when stopping typing indicator Sending 'paused' after the first response caused WhatsApp to stop relaying subsequent 'composing' presence updates. Using 'available' keeps the bot in a state where typing indicators work consistently. Co-Authored-By: Claude Opus 4.6 --- src/channels/whatsapp.test.ts | 4 ++-- src/channels/whatsapp.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/channels/whatsapp.test.ts b/src/channels/whatsapp.test.ts index 0921f60..de0674b 100644 --- a/src/channels/whatsapp.test.ts +++ b/src/channels/whatsapp.test.ts @@ -820,14 +820,14 @@ describe('WhatsAppChannel', () => { expect(fakeSocket.sendPresenceUpdate).toHaveBeenCalledWith('composing', 'test@g.us'); }); - it('sends paused presence when stopping', async () => { + it('sends available presence when stopping', async () => { const opts = createTestOpts(); const channel = new WhatsAppChannel(opts); await connectChannel(channel); await channel.setTyping('test@g.us', false); - expect(fakeSocket.sendPresenceUpdate).toHaveBeenCalledWith('paused', 'test@g.us'); + expect(fakeSocket.sendPresenceUpdate).toHaveBeenCalledWith('available', 'test@g.us'); }); it('handles typing indicator failure gracefully', async () => { diff --git a/src/channels/whatsapp.ts b/src/channels/whatsapp.ts index fb0fe44..17c9b72 100644 --- a/src/channels/whatsapp.ts +++ b/src/channels/whatsapp.ts @@ -218,7 +218,7 @@ export class WhatsAppChannel implements Channel { async setTyping(jid: string, isTyping: boolean): Promise { try { - await this.sock.sendPresenceUpdate(isTyping ? 'composing' : 'paused', jid); + await this.sock.sendPresenceUpdate(isTyping ? 'composing' : 'available', jid); } catch (err) { logger.debug({ jid, err }, 'Failed to update typing status'); }