(sock, message, args, context)
| 7 | usage: '.delreply <trigger>', |
| 8 | ownerOnly: true, |
| 9 | async handler(sock, message, args, context) { |
| 10 | const chatId = context.chatId || message.key.remoteJid; |
| 11 | const channelInfo = context.channelInfo || {}; |
| 12 | if (!args || args.length === 0) { |
| 13 | return await sock.sendMessage(chatId, { |
| 14 | text: '❌ Please provide the trigger to delete.\n\nUsage: `.delreply hello`\nSee all triggers: `.listreplies`', |
| 15 | ...channelInfo |
| 16 | }, { quoted: message }); |
| 17 | } |
| 18 | const trigger = args.join(' ').toLowerCase().trim(); |
| 19 | const config = await initConfig(); |
| 20 | const before = config.replies.length; |
| 21 | config.replies = config.replies.filter(r => r.trigger !== trigger); |
| 22 | if (config.replies.length === before) { |
| 23 | return await sock.sendMessage(chatId, { |
| 24 | text: `❌ No auto-reply found for *"${trigger}"*\n\nUse \`.listreplies\` to see all triggers.`, |
| 25 | ...channelInfo |
| 26 | }, { quoted: message }); |
| 27 | } |
| 28 | await saveConfig(config); |
| 29 | await sock.sendMessage(chatId, { |
| 30 | text: `🗑️ *Auto-reply deleted!*\n\nTrigger *"${trigger}"* has been removed.`, |
| 31 | ...channelInfo |
| 32 | }, { quoted: message }); |
| 33 | } |
| 34 | }; |
nothing calls this directly
no test coverage detected