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

Function handler

plugins/anticall.js:49–79  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

47 usage: '.anticall <on|off|status>',
48 ownerOnly: true,
49 async handler(sock, message, args, context) {
50 const chatId = context.chatId || message.key.remoteJid;
51 const state = await readState();
52 const sub = args.join(' ').trim().toLowerCase();
53 if (!sub || !['on', 'off', 'status'].includes(sub)) {
54 return await sock.sendMessage(chatId, {
55 text: '*ANTICALL SETTINGS*\n\n' +
56 '📵 Auto-block incoming calls\n\n' +
57 '*Usage:*\n' +
58 '• `.anticall on` - Enable\n' +
59 '• `.anticall off` - Disable\n' +
60 '• `.anticall status` - Current status\n\n' +
61 `*Current Status:* ${state.enabled ? '✅ ENABLED' : '❌ DISABLED'}\n` +
62 `*Storage:* ${HAS_DB ? 'Database' : 'File System'}`
63 }, { quoted: message });
64 }
65 if (sub === 'status') {
66 return await sock.sendMessage(chatId, {
67 text: `📵 *Anticall Status*\n\n` +
68 `Current: ${state.enabled ? '✅ *ENABLED*' : '❌ *DISABLED*'}\n` +
69 `Storage: ${HAS_DB ? 'Database' : 'File System'}\n\n` +
70 `${state.enabled ? 'All incoming calls will be rejected and blocked.' : 'Incoming calls are allowed.'}`
71 }, { quoted: message });
72 }
73 const enable = sub === 'on';
74 await writeState(enable);
75 await sock.sendMessage(chatId, {
76 text: `📵 *Anticall ${enable ? 'ENABLED' : 'DISABLED'}*\n\n` +
77 `${enable ? '✅ Incoming calls will now be rejected and blocked automatically.' : '❌ Incoming calls are now allowed.'}`
78 }, { quoted: message });
79 },
80 readState,
81 writeState
82};

Callers

nothing calls this directly

Calls 2

readStateFunction · 0.70
writeStateFunction · 0.70

Tested by

no test coverage detected