(sock: any, message: any, args: any, context: BotContext)
| 7 | usage: '.excard Title | Body | ImageURL', |
| 8 | |
| 9 | async handler(sock: any, message: any, args: any, context: BotContext) { |
| 10 | const chatId = context.chatId || message.key.remoteJid; |
| 11 | const input = args.join(' '); |
| 12 | |
| 13 | if (!input.includes('|')) { |
| 14 | return await sock.sendMessage(chatId, { |
| 15 | text: '*Usage:* .excard Title | Body | ImageURL\n\n*Example:* .excard Google | Search anything | https://google.com/logo.png' |
| 16 | }, { quoted: message }); |
| 17 | } |
| 18 | |
| 19 | const [title, body, url] = input.split('|').map((t: any) => t.trim()); |
| 20 | |
| 21 | const quoted = message.message?.extendedTextMessage?.contextInfo?.quotedMessage; |
| 22 | const _hasQuotedImage = quoted?.imageMessage; |
| 23 | |
| 24 | await sock.sendMessage(chatId, { |
| 25 | text: body || " ", |
| 26 | contextInfo: { |
| 27 | externalAdReply: { |
| 28 | title: title, |
| 29 | body: 'Shared via Mega Md', |
| 30 | thumbnailUrl: url || 'https://i.ibb.co/3S6f0mS/default.jpg', |
| 31 | mediaType: 1, |
| 32 | renderLargerThumbnail: true, |
| 33 | sourceUrl: url || 'https://github.com' |
| 34 | } |
| 35 | } |
| 36 | }, { quoted: message }); |
| 37 | } |
| 38 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected