|
| 1 | + const { zokou }=require("../framework/zokou") |
| 2 | +const {getContentType}=require("@whiskeysockets/baileys") |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +/*zokou({nomCom:"vv3",categorie:"General",reaction:"🤭"},async(dest,zk,commandeOptions)=>{ |
| 7 | +
|
| 8 | +const {ms,msgRepondu,repondre}=commandeOptions; |
| 9 | +
|
| 10 | +
|
| 11 | +if(!msgRepondu){return repondre("*Mentionne a view once media* .");} |
| 12 | +
|
| 13 | +
|
| 14 | +if(msgRepondu.viewOnceMessageV2) |
| 15 | +{ |
| 16 | + if(msgRepondu.viewOnceMessageV2.message.imageMessage) |
| 17 | + { |
| 18 | + var image =await zk.downloadAndSaveMediaMessage(msgRepondu.viewOnceMessageV2.message.imageMessage) |
| 19 | + var texte = msgRepondu.viewOnceMessageV2.message.imageMessage.caption |
| 20 | + |
| 21 | + await zk.sendMessage(dest,{image:{url:image},caption:texte},{quoted:ms}) |
| 22 | + }else if(msgRepondu.viewOnceMessageV2.message.videoMessage){ |
| 23 | +
|
| 24 | + var video = await zk.downloadAndSaveMediaMessage(msgRepondu.viewOnceMessageV2.message.videoMessage) |
| 25 | +var texte =msgRepondu.viewOnceMessageV2.message.videoMessage.caption |
| 26 | +
|
| 27 | +
|
| 28 | +await zk.sendMessage(dest,{video:{url:video},caption:texte},{quoted:ms}) |
| 29 | +
|
| 30 | +} |
| 31 | +}else |
| 32 | +{ |
| 33 | + return repondre("this message is not on view once .") |
| 34 | +} |
| 35 | +
|
| 36 | +
|
| 37 | +
|
| 38 | +})*/ |
| 39 | + |
| 40 | +zokou({ nomCom: "vv1", aliases: ["send", "keep"], categorie: "new" }, async (dest, zk, commandeOptions) => { |
| 41 | + const { repondre, msgRepondu, superUser } = commandeOptions; |
| 42 | + |
| 43 | + if (msgRepondu) { |
| 44 | + console.log(msgRepondu); |
| 45 | + let msg; |
| 46 | + try { |
| 47 | + // Check for different message types and handle accordingly |
| 48 | + if (msgRepondu.imageMessage) { |
| 49 | + const media = await zk.downloadAndSaveMediaMessage(msgRepondu.imageMessage); |
| 50 | + msg = { image: { url: media }, caption: msgRepondu.imageMessage.caption }; |
| 51 | + } else if (msgRepondu.videoMessage) { |
| 52 | + const media = await zk.downloadAndSaveMediaMessage(msgRepondu.videoMessage); |
| 53 | + msg = { video: { url: media }, caption: msgRepondu.videoMessage.caption }; |
| 54 | + } else if (msgRepondu.audioMessage) { |
| 55 | + const media = await zk.downloadAndSaveMediaMessage(msgRepondu.audioMessage); |
| 56 | + msg = { audio: { url: media }, mimetype: 'audio/mp4' }; |
| 57 | + } else if (msgRepondu.stickerMessage) { |
| 58 | + const media = await zk.downloadAndSaveMediaMessage(msgRepondu.stickerMessage); |
| 59 | + const stickerMess = new Sticker(media, { |
| 60 | + pack: 'ZEZE47-MD', |
| 61 | + type: StickerTypes.CROPPED, |
| 62 | + categories: ["🤩", "🎉"], |
| 63 | + id: "12345", |
| 64 | + quality: 70, |
| 65 | + background: "transparent", |
| 66 | + }); |
| 67 | + const stickerBuffer2 = await stickerMess.toBuffer(); |
| 68 | + msg = { sticker: stickerBuffer2 }; |
| 69 | + } else { |
| 70 | + msg = { text: msgRepondu.conversation }; |
| 71 | + } |
| 72 | + |
| 73 | + // Send the message |
| 74 | + await zk.sendMessage(dest, msg); |
| 75 | + |
| 76 | + } catch (error) { |
| 77 | + console.error("Error processing the message:", error); |
| 78 | + repondre('An error occurred while processing your request.'); |
| 79 | + } |
| 80 | + |
| 81 | + } else { |
| 82 | + repondre('Mention the message that you want to save'); |
| 83 | + } |
| 84 | +}); |
0 commit comments