This commit is contained in:
cangui 2025-05-07 07:19:18 +02:00
parent ddcda51e1d
commit 609d2f076d

View File

@ -73,13 +73,18 @@ const initBaileys = async () => {
// (Facultatif) Gestion des messages reçus
sock.ev.on('messages.upsert', async ({ messages }) => {
const msg = messages[0];
if (!msg.key.fromMe && msg.message?.conversation) {
console.log('💬 Message reçu de', msg.key.remoteJid, ':', msg.message.conversation);
}
if (!msg.message || !msg.key.fromMe) {
const jid = msg.key.remoteJid;
const buttonId = msg.message.buttonsResponseMessage?.selectedButtonId;
if (buttonId === 'doc_1') {
await sock.sendMessage(jid, {
document: {
url: 'hhttps://merlo-ch.com/uploads/proposition/f_p_250505_0000136_00008_EB00001909.pdf',
url: 'https://wa.canguidev.fr/static/document1.pdf',
},
mimetype: 'application/pdf',
fileName: 'Document_1.pdf',
@ -89,7 +94,7 @@ const initBaileys = async () => {
} else if (buttonId === 'doc_2') {
await sock.sendMessage(jid, {
document: {
url: 'https://merlo-ch.com/uploads/proposition/d_p_250505_0000136_00008_EB00001909.pdf',
url: 'https://wa.canguidev.fr/static/document2.pdf',
},
mimetype: 'application/pdf',
fileName: 'Document_2.pdf',
@ -97,6 +102,7 @@ const initBaileys = async () => {
footer: '© Fizzxy Dev',
});
}
}
});
};