(sock: any, message: any, args: any, context: BotContext)
| 23 | usage: '.viral <text> OR reply to a message', |
| 24 | |
| 25 | async handler(sock: any, message: any, args: any, context: BotContext) { |
| 26 | const chatId = context.chatId || message.key.remoteJid; |
| 27 | |
| 28 | try { |
| 29 | let txt = ""; |
| 30 | const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage; |
| 31 | |
| 32 | if (quoted) { |
| 33 | txt = quoted.conversation || |
| 34 | quoted.extendedTextMessage?.text || |
| 35 | quoted.imageMessage?.caption || |
| 36 | quoted.videoMessage?.caption || |
| 37 | ""; |
| 38 | } |
| 39 | |
| 40 | if (!txt || txt.trim() === "") { |
| 41 | txt = args?.join(' ') || ""; |
| 42 | } |
| 43 | |
| 44 | if (!txt || txt.trim() === "") { |
| 45 | return await sock.sendMessage(chatId, { |
| 46 | text: 'Please provide text or reply to a message to forward.' |
| 47 | }, { quoted: message }); |
| 48 | } |
| 49 | |
| 50 | await sock.sendMessage(chatId, { |
| 51 | text: txt, |
| 52 | contextInfo: { |
| 53 | isForwarded: true, |
| 54 | forwardingScore: 999 |
| 55 | } |
| 56 | }); |
| 57 | |
| 58 | } catch(err: any) { |
| 59 | console.error('Forwarding Spoof Error:', err); |
| 60 | await sock.sendMessage(chatId, { text: '❌ Failed to spoof forwarding.' }); |
| 61 | } |
| 62 | } |
| 63 | }; |
| 64 | |
| 65 | /***************************************************************************** |
nothing calls this directly
no outgoing calls
no test coverage detected