MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MD / handler

Function handler

plugins/exad.js:7–31  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected