(sock, message, args)
| 6 | usage: '.echo <text> <count>', |
| 7 | isPrefixless: true, |
| 8 | async handler(sock, message, args) { |
| 9 | const chatId = message.key.remoteJid; |
| 10 | if (args.length < 2) { |
| 11 | return await sock.sendMessage(chatId, { text: 'Usage: .echo <text> <count>' }, { quoted: message }); |
| 12 | } |
| 13 | const count = parseInt(args[args.length - 1], 10); |
| 14 | if (isNaN(count) || count <= 0) { |
| 15 | return await sock.sendMessage(chatId, { text: 'Count must be a positive number.' }, { quoted: message }); |
| 16 | } |
| 17 | args.pop(); |
| 18 | const text = args.join(' ').trim(); |
| 19 | const repeated = Array(count).fill(text).join('\n'); |
| 20 | await sock.sendMessage(chatId, { text: repeated }, { quoted: message }); |
| 21 | } |
| 22 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected