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

Function handler

plugins/listreplies.js:9–34  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

7 usage: '.listreplies',
8 ownerOnly: true,
9 async handler(sock, message, args, context) {
10 const chatId = context.chatId || message.key.remoteJid;
11 const channelInfo = context.channelInfo || {};
12 const config = await initConfig();
13 if (config.replies.length === 0) {
14 return await sock.sendMessage(chatId, {
15 text: `📭 *No auto-replies configured yet*\n\nStatus: ${config.enabled ? '✅ Enabled' : '❌ Disabled'}\n\nUse \`.addreply <trigger> | <response>\` to add one!`,
16 ...channelInfo
17 }, { quoted: message });
18 }
19 const lines = config.replies.map((r, i) => {
20 const preview = r.response.length > 40
21 ? `${r.response.substring(0, 40) }...`
22 : r.response;
23 const matchIcon = r.exactMatch ? '🎯' : '🔍';
24 return `${i + 1}. ${matchIcon} *${r.trigger}*\n ↳ ${preview}`;
25 }).join('\n\n');
26 await sock.sendMessage(chatId, {
27 text: `*🤖 AUTO-REPLIES (${config.replies.length})*\n` +
28 `*Status:* ${config.enabled ? '✅ Enabled' : '❌ Disabled'}\n\n` +
29 `${lines}\n\n` +
30 `🎯 = exact match | 🔍 = contains\n` +
31 `_Use .delreply <trigger> to remove one_`,
32 ...channelInfo
33 }, { quoted: message });
34 }
35};

Callers

nothing calls this directly

Calls 1

initConfigFunction · 0.90

Tested by

no test coverage detected