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
|
||||
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 (buttonId === 'doc_1') {
|
||||
await sock.sendMessage(jid, {
|
||||
document: {
|
||||
url: 'hhttps://merlo-ch.com/uploads/proposition/f_p_250505_0000136_00008_EB00001909.pdf',
|
||||
},
|
||||
mimetype: 'application/pdf',
|
||||
fileName: 'Document_1.pdf',
|
||||
caption: 'Voici votre *Document 1* 📄',
|
||||
footer: '© Fizzxy Dev',
|
||||
});
|
||||
} else if (buttonId === 'doc_2') {
|
||||
await sock.sendMessage(jid, {
|
||||
document: {
|
||||
url: 'https://merlo-ch.com/uploads/proposition/d_p_250505_0000136_00008_EB00001909.pdf',
|
||||
},
|
||||
mimetype: 'application/pdf',
|
||||
fileName: 'Document_2.pdf',
|
||||
caption: 'Voici votre *Document 2* 📄',
|
||||
footer: '© Fizzxy Dev',
|
||||
});
|
||||
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: 'https://wa.canguidev.fr/static/document1.pdf',
|
||||
},
|
||||
mimetype: 'application/pdf',
|
||||
fileName: 'Document_1.pdf',
|
||||
caption: 'Voici votre *Document 1* 📄',
|
||||
footer: '© Fizzxy Dev',
|
||||
});
|
||||
} else if (buttonId === 'doc_2') {
|
||||
await sock.sendMessage(jid, {
|
||||
document: {
|
||||
url: 'https://wa.canguidev.fr/static/document2.pdf',
|
||||
},
|
||||
mimetype: 'application/pdf',
|
||||
fileName: 'Document_2.pdf',
|
||||
caption: 'Voici votre *Document 2* 📄',
|
||||
footer: '© Fizzxy Dev',
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user