(sock, message, args, context)
| 132 | usage: '.autotyping <on|off>', |
| 133 | ownerOnly: true, |
| 134 | async handler(sock, message, args, context) { |
| 135 | const chatId = context.chatId || message.key.remoteJid; |
| 136 | const channelInfo = context.channelInfo || {}; |
| 137 | try { |
| 138 | const config = await initConfig(); |
| 139 | const action = args[0]?.toLowerCase(); |
| 140 | if (!action) { |
| 141 | const ghostActive = await isGhostModeActive(); |
| 142 | await sock.sendMessage(chatId, { |
| 143 | text: `*⌨️ AUTOTYPING STATUS*\n\n` + |
| 144 | `*Current Status:* ${config.enabled ? '✅ Enabled' : '❌ Disabled'}\n` + |
| 145 | `*Ghost Mode:* ${ghostActive ? '👻 Active (blocks typing)' : '❌ Inactive'}\n` + |
| 146 | `*Storage:* ${HAS_DB ? 'Database' : 'File System'}\n\n` + |
| 147 | `*Commands:*\n` + |
| 148 | `• \`.autotyping on\` - Enable auto-typing\n` + |
| 149 | `• \`.autotyping off\` - Disable auto-typing\n\n` + |
| 150 | `*What it does:*\n` + |
| 151 | `When enabled, the bot will show "typing..." indicator while processing messages and commands.\n\n` + |
| 152 | `*Note:* Ghost mode overrides autotyping to maintain stealth.`, |
| 153 | ...channelInfo |
| 154 | }, { quoted: message }); |
| 155 | return; |
| 156 | } |
| 157 | if (action === 'on' || action === 'enable') { |
| 158 | if (config.enabled) { |
| 159 | await sock.sendMessage(chatId, { |
| 160 | text: '⚠️ *Autotyping is already enabled*', |
| 161 | ...channelInfo |
| 162 | }, { quoted: message }); |
| 163 | return; |
| 164 | } |
| 165 | config.enabled = true; |
| 166 | await saveConfig(config); |
| 167 | const ghostActive = await isGhostModeActive(); |
| 168 | await sock.sendMessage(chatId, { |
| 169 | text: `✅ *Auto-typing enabled!*\n\nThe bot will now show typing indicator while processing.${ghostActive ? '\n\n⚠️ *Ghost mode is active* - typing indicators are currently blocked.' : ''}`, |
| 170 | ...channelInfo |
| 171 | }, { quoted: message }); |
| 172 | } |
| 173 | else if (action === 'off' || action === 'disable') { |
| 174 | if (!config.enabled) { |
| 175 | await sock.sendMessage(chatId, { |
| 176 | text: '⚠️ *Autotyping is already disabled*', |
| 177 | ...channelInfo |
| 178 | }, { quoted: message }); |
| 179 | return; |
| 180 | } |
| 181 | config.enabled = false; |
| 182 | await saveConfig(config); |
| 183 | await sock.sendMessage(chatId, { |
| 184 | text: '❌ *Auto-typing disabled!*\n\nThe bot will no longer show typing indicator.', |
| 185 | ...channelInfo |
| 186 | }, { quoted: message }); |
| 187 | } |
| 188 | else { |
| 189 | await sock.sendMessage(chatId, { |
| 190 | text: '❌ *Invalid option!*\n\nUse: `.autotyping on/off`', |
| 191 | ...channelInfo |
nothing calls this directly
no test coverage detected