fix: clean up poll merge

This commit is contained in:
Peter Steinberger
2026-01-06 04:50:35 +00:00
parent 0b27964693
commit 35a2140e48
3 changed files with 6 additions and 21 deletions

View File

@@ -81,8 +81,6 @@ import {
type ResponseFrame, type ResponseFrame,
ResponseFrameSchema, ResponseFrameSchema,
SendParamsSchema, SendParamsSchema,
type PollParams,
PollParamsSchema,
type SessionsCompactParams, type SessionsCompactParams,
SessionsCompactParamsSchema, SessionsCompactParamsSchema,
type SessionsDeleteParams, type SessionsDeleteParams,

View File

@@ -159,7 +159,8 @@ export function createTelegramBot(opts: TelegramBotOptions) {
(senderUsername && (senderUsername &&
normalizedAllowFromLower.some( normalizedAllowFromLower.some(
(entry) => (entry) =>
entry === senderUsernameLower || entry === `@${senderUsernameLower}`, entry === senderUsernameLower ||
entry === `@${senderUsernameLower}`,
)); ));
const wasMentioned = const wasMentioned =
(Boolean(botUsername) && hasBotMention(msg, botUsername)) || (Boolean(botUsername) && hasBotMention(msg, botUsername)) ||

View File

@@ -456,6 +456,10 @@ export async function monitorWebInbox(options: {
const result = await sock.sendMessage(jid, payload); const result = await sock.sendMessage(jid, payload);
return { messageId: result?.key?.id ?? "unknown" }; return { messageId: result?.key?.id ?? "unknown" };
}, },
/**
* Send a poll message through this connection's socket.
* Used by IPC to create WhatsApp polls in groups or chats.
*/
sendPoll: async ( sendPoll: async (
to: string, to: string,
poll: { question: string; options: string[]; maxSelections?: number }, poll: { question: string; options: string[]; maxSelections?: number },
@@ -478,24 +482,6 @@ export async function monitorWebInbox(options: {
const jid = toWhatsappJid(to); const jid = toWhatsappJid(to);
await sock.sendPresenceUpdate("composing", jid); await sock.sendPresenceUpdate("composing", jid);
}, },
/**
* Send a poll message through this connection's socket.
* Used by IPC to create WhatsApp polls in groups or chats.
*/
sendPoll: async (
to: string,
poll: { question: string; options: string[]; selectableCount?: number },
): Promise<{ messageId: string }> => {
const jid = toWhatsappJid(to);
const result = await sock.sendMessage(jid, {
poll: {
name: poll.question,
values: poll.options,
selectableCount: poll.selectableCount ?? 1,
},
});
return { messageId: result?.key?.id ?? "unknown" };
},
} as const; } as const;
} }