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

Function handler

plugins/clear.ts:10–29  ·  view source on GitHub ↗
(sock: any, message: any, args: any, context: BotContext)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected