lkkkklkl
This commit is contained in:
parent
ddcda51e1d
commit
609d2f076d
46
index.js
46
index.js
@ -73,29 +73,35 @@ const initBaileys = async () => {
|
|||||||
// (Facultatif) Gestion des messages reçus
|
// (Facultatif) Gestion des messages reçus
|
||||||
sock.ev.on('messages.upsert', async ({ messages }) => {
|
sock.ev.on('messages.upsert', async ({ messages }) => {
|
||||||
const msg = messages[0];
|
const msg = messages[0];
|
||||||
|
|
||||||
if (!msg.key.fromMe && msg.message?.conversation) {
|
if (!msg.key.fromMe && msg.message?.conversation) {
|
||||||
console.log('💬 Message reçu de', msg.key.remoteJid, ':', msg.message.conversation);
|
console.log('💬 Message reçu de', msg.key.remoteJid, ':', msg.message.conversation);
|
||||||
}
|
}
|
||||||
if (buttonId === 'doc_1') {
|
if (!msg.message || !msg.key.fromMe) {
|
||||||
await sock.sendMessage(jid, {
|
const jid = msg.key.remoteJid;
|
||||||
document: {
|
const buttonId = msg.message.buttonsResponseMessage?.selectedButtonId;
|
||||||
url: 'hhttps://merlo-ch.com/uploads/proposition/f_p_250505_0000136_00008_EB00001909.pdf',
|
|
||||||
},
|
if (buttonId === 'doc_1') {
|
||||||
mimetype: 'application/pdf',
|
await sock.sendMessage(jid, {
|
||||||
fileName: 'Document_1.pdf',
|
document: {
|
||||||
caption: 'Voici votre *Document 1* 📄',
|
url: 'https://wa.canguidev.fr/static/document1.pdf',
|
||||||
footer: '© Fizzxy Dev',
|
},
|
||||||
});
|
mimetype: 'application/pdf',
|
||||||
} else if (buttonId === 'doc_2') {
|
fileName: 'Document_1.pdf',
|
||||||
await sock.sendMessage(jid, {
|
caption: 'Voici votre *Document 1* 📄',
|
||||||
document: {
|
footer: '© Fizzxy Dev',
|
||||||
url: 'https://merlo-ch.com/uploads/proposition/d_p_250505_0000136_00008_EB00001909.pdf',
|
});
|
||||||
},
|
} else if (buttonId === 'doc_2') {
|
||||||
mimetype: 'application/pdf',
|
await sock.sendMessage(jid, {
|
||||||
fileName: 'Document_2.pdf',
|
document: {
|
||||||
caption: 'Voici votre *Document 2* 📄',
|
url: 'https://wa.canguidev.fr/static/document2.pdf',
|
||||||
footer: '© Fizzxy Dev',
|
},
|
||||||
});
|
mimetype: 'application/pdf',
|
||||||
|
fileName: 'Document_2.pdf',
|
||||||
|
caption: 'Voici votre *Document 2* 📄',
|
||||||
|
footer: '© Fizzxy Dev',
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user