forked from AyGemuy/Taylor-V2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbot-response-button.js
More file actions
26 lines (26 loc) · 1.25 KB
/
Copy pathbot-response-button.js
File metadata and controls
26 lines (26 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const {
proto,
generateWAMessage,
areJidsSameUser
} = (await import("@whiskeysockets/baileys")).default;
export async function all(m, chatUpdate) {
try {
if (m.isBaileys) return;
if (!m.message) return;
if (!(m.message.buttonsResponseMessage || m.message.templateButtonReplyMessage || m.message.listResponseMessage || m.message.interactiveResponseMessage)) return;
let id = m.message.buttonsResponseMessage?.selectedButtonId ?? m.message.templateButtonReplyMessage?.selectedId ?? m.message.listResponseMessage?.singleSelectReply?.selectedRowId ?? (() => {
try {
const params = JSON.parse(m.message.interactiveResponseMessage?.nativeFlowResponseMessage?.paramsJson || "{}");
return params?.id ?? null;
} catch (error) {
return null;
}
})();
let text = m.message.buttonsResponseMessage?.selectedDisplayText ?? m.message.templateButtonReplyMessage?.selectedDisplayText ?? m.message.listResponseMessage?.title ?? m.message.interactiveResponseMessage?.body?.text ?? null;
const toCmd = id || text;
if (!toCmd) return;
await this.appendTextMessage(m, m.prefix ? m.command?.match?.[0]?.[0] + toCmd : toCmd, chatUpdate);
} catch (error) {
console.error("Error in processing message:", error);
}
}