Skip to content

Instantly share code, notes, and snippets.

@ktz-master
Forked from insanebwoi/Cmfor.js
Last active June 2, 2022 18:10
Show Gist options
  • Save ktz-master/ad4e46e1617b449f84cc8abf6ece5942 to your computer and use it in GitHub Desktop.
Save ktz-master/ad4e46e1617b449f84cc8abf6ece5942 to your computer and use it in GitHub Desktop.
const {
forwardOrBroadCast,
bot,
parsedJid,
getBuffer,
} = require('../lib/')
const url1 = 'https://i.imgur.com/xjfLdYQ.jpeg'
const url2 = 'https://i.imgur.com/xjfLdYQ.jpeg'
bot(
{ pattern: 'cmfor ?(.*)', fromMe: true, desc: "Forward replied msg." },
async (message, match) => {
let [caption, duration, url] = match.split(";")
if (match == "") return await message.sendMessage("*Use by Given format*\nExample .cmfor caption;99;https://i.imgur.com/BiLC1Ik.jpeg;jid1 jid2 jid3 jid4 ...");
if (!message.reply_message)
return await message.sendMessage("*Reply to a Message*");
const buff = await getBuffer(url)
let options = {}
/* delete this line for forwarded tag
//for forward tag
options.contextInfo = {
forwardingScore: 5, // change it to 999 for many times forwarded
isForwarded: true
}
delete this line for forwarded tag */
options.duration = duration
options.ptt = true // delete this if not need audio as voice always
options.quoted = {
key: {
fromMe: false,
participant: "[email protected]",
remoteJid: "status@broadcast"
},
message: {
"imageMessage": {
"jpegThumbnail": buff.buffer,
"caption": caption
}
}
}
match.match(parseJid).map((jid) => {
forwardOrBroadCast(jid, message, options);
});
}
);
// insane.addCommand(
// { pattern: 'vforward ?(.*)', fromMe: true, desc: "Forward replied msg." },
// async (message, match) => {
// if (match == "") return await message.sendMessage("*Give me a jid*\nExample .mforward jid1 jid2 jid3 jid4 ...");
// if (!message.reply_message)
// return await message.sendMessage("*Give me a jid*\nExample .mforward jid1 jid2 jid3 jid4 ...");
// const { buffer, type, options } = await forward(match, message);
// options.viewOnce = true
// match.match(parseJid).map(async jid => {
// if(jid.length < 30){
// await new Promise((r) => setTimeout(r, 3000));
// await message.client.sendMessage(jid, buffer, type, options);
// }
// })
// }
// );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment