(sock, message, args, context)
| 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 | }; |
| 81 | function startAutoClear() { |
| 82 | clearTmpDirectory(); |
nothing calls this directly
no test coverage detected