(sock, chatId, message, args)
| 21 | } |
| 22 | |
| 23 | async function anticallCommand(sock, chatId, message, args) { |
| 24 | const state = readState(); |
| 25 | const sub = (args || '').trim().toLowerCase(); |
| 26 | |
| 27 | if (!sub || (sub !== 'on' && sub !== 'off' && sub !== 'status')) { |
| 28 | await sock.sendMessage(chatId, { text: '*ANTICALL*\n\n.anticall on - Enable auto-block on incoming calls\n.anticall off - Disable anticall\n.anticall status - Show current status' }, { quoted: message }); |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | if (sub === 'status') { |
| 33 | await sock.sendMessage(chatId, { text: `Anticall is currently *${state.enabled ? 'ON' : 'OFF'}*.` }, { quoted: message }); |
| 34 | return; |
| 35 | } |
| 36 | |
| 37 | const enable = sub === 'on'; |
| 38 | writeState(enable); |
| 39 | await sock.sendMessage(chatId, { text: `Anticall is now *${enable ? 'ENABLED' : 'DISABLED'}*.` }, { quoted: message }); |
| 40 | } |
| 41 | |
| 42 | module.exports = { anticallCommand, readState }; |
| 43 |
nothing calls this directly
no test coverage detected