feat: unify poll support

Co-authored-by: DBH <5251425+dbhurley@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-06 04:43:35 +00:00
parent 1f4d9e83ff
commit 0b27964693
19 changed files with 360 additions and 118 deletions

View File

@@ -456,6 +456,20 @@ export async function monitorWebInbox(options: {
const result = await sock.sendMessage(jid, payload);
return { messageId: result?.key?.id ?? "unknown" };
},
sendPoll: async (
to: string,
poll: { question: string; options: string[]; maxSelections?: number },
): Promise<{ messageId: string }> => {
const jid = toWhatsappJid(to);
const result = await sock.sendMessage(jid, {
poll: {
name: poll.question,
values: poll.options,
selectableCount: poll.maxSelections ?? 1,
},
});
return { messageId: result?.key?.id ?? "unknown" };
},
/**
* Send typing indicator ("composing") to a chat.
* Used after IPC send to show more messages are coming.