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

Function handler

plugins/echo.js:8–21  ·  view source on GitHub ↗
(sock, message, args)

Source from the content-addressed store, hash-verified

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};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected