const timeout = 14400000 const { tmpdir } = require('os') const { join } = require('path') const path = require('path') const fs = require('fs'); let handler = async (m, { args, text }) => { function deleteFiles(filenya) { fs.readdir(filenya, (err, files) => { if (err) throw err; let totalFiles = files.length; // Calculate total number of session files for (const file of files) { if (file !== 'creds.json') { fs.unlink(path.join(filenya, file), err => { if (err) throw err; }); } } // Reply with the total number of sessions and percentage m.reply(`[ √ ] Done, deleting ${totalFiles} sessions (${(totalFiles / 200 * 100).toFixed(2)}%).`); }); setTimeout(() => { // conn.reply(m.chat, `[ ! ] Session folder is full use *.csesi* to delete it.`, m) }, timeout) } deleteFiles(`./session`); } handler.help = ['csesi'] handler.command = ['clearsession', 'csesi', 'c', 'clearsesi']; handler.tag = ['info']; module.exports = handler;