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

Function handler

plugins/clear.js:8–25  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

6 usage: '.clear',
7 ownerOnly: true,
8 async handler(sock, message, args, context) {
9 const { chatId, channelInfo } = context;
10 try {
11 const sent = await sock.sendMessage(chatId, {
12 text: 'Clearing bot messages...',
13 ...channelInfo
14 });
15 await new Promise(resolve => setTimeout(resolve, 1000));
16 await sock.sendMessage(chatId, { delete: sent.key });
17 }
18 catch (error) {
19 console.error('Error clearing messages:', error);
20 await sock.sendMessage(chatId, {
21 text: 'An error occurred while clearing messages.',
22 ...channelInfo
23 }, { quoted: message });
24 }
25 }
26};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected