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

Function handler

plugins/listreplies.ts:12–41  ·  view source on GitHub ↗
(sock: any, message: any, args: any[], context: BotContext)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

initConfigFunction · 0.70

Tested by

no test coverage detected