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

Function handler

plugins/cleartmp.js:54–79  ·  view source on GitHub ↗
(sock, message, args, context)

Source from the content-addressed store, hash-verified

52 description: 'Clear tmp and temp directories',
53 usage: '.cleartmp',
54 async handler(sock, message, args, context) {
55 const chatId = context.chatId || message.key.remoteJid;
56 const senderId = message.key.participant || message.key.remoteJid;
57 try {
58 const isOwner = await isOwnerOrSudo(senderId, sock, chatId);
59 if (!message.key.fromMe && !isOwner) {
60 await sock.sendMessage(chatId, {
61 text: '*This command is only for the owner!*'
62 }, { quoted: message });
63 return;
64 }
65 const result = await clearTmpDirectory();
66 const text = result.success
67 ? `✅ *Temporary Files Cleared!*\n\n${result.message}`
68 : `❌ *Clear Failed!*\n\n${result.message}`;
69 await sock.sendMessage(chatId, {
70 text
71 }, { quoted: message });
72 }
73 catch (error) {
74 console.error('Error in cleartmp command:', error);
75 await sock.sendMessage(chatId, {
76 text: '❌ Failed to clear temporary files!'
77 }, { quoted: message });
78 }
79 }
80};
81function startAutoClear() {
82 clearTmpDirectory();

Callers

nothing calls this directly

Calls 2

isOwnerOrSudoFunction · 0.85
clearTmpDirectoryFunction · 0.85

Tested by

no test coverage detected