fix: clean up poll merge
This commit is contained in:
@@ -81,8 +81,6 @@ import {
|
||||
type ResponseFrame,
|
||||
ResponseFrameSchema,
|
||||
SendParamsSchema,
|
||||
type PollParams,
|
||||
PollParamsSchema,
|
||||
type SessionsCompactParams,
|
||||
SessionsCompactParamsSchema,
|
||||
type SessionsDeleteParams,
|
||||
|
||||
@@ -159,7 +159,8 @@ export function createTelegramBot(opts: TelegramBotOptions) {
|
||||
(senderUsername &&
|
||||
normalizedAllowFromLower.some(
|
||||
(entry) =>
|
||||
entry === senderUsernameLower || entry === `@${senderUsernameLower}`,
|
||||
entry === senderUsernameLower ||
|
||||
entry === `@${senderUsernameLower}`,
|
||||
));
|
||||
const wasMentioned =
|
||||
(Boolean(botUsername) && hasBotMention(msg, botUsername)) ||
|
||||
|
||||
@@ -456,6 +456,10 @@ export async function monitorWebInbox(options: {
|
||||
const result = await sock.sendMessage(jid, payload);
|
||||
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 (
|
||||
to: string,
|
||||
poll: { question: string; options: string[]; maxSelections?: number },
|
||||
@@ -478,24 +482,6 @@ export async function monitorWebInbox(options: {
|
||||
const jid = toWhatsappJid(to);
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user