The following changes were made by the replace_file_content tool to: /root/aadharbot/index.js. If relevant, proactively run terminal commands to execute this code for the USER. Don't ask for permission. [diff_block_start] @@ -673,57 +673,15 @@ const sessions = {}; -// ── FREE MODE CONFIGURATION ────────────────────────────────────────────── -const FREEMODE_FILE = 'freemode.json'; - -let freeModeState = { - active: false, - expiresAt: null -}; - -if (fs.existsSync(FREEMODE_FILE)) { - try { - freeModeState = JSON.parse(fs.readFileSync(FREEMODE_FILE, 'utf8')); - } catch (e) { - console.error("Failed to parse freemode.json", e.message); - } -} - -function saveFreeModeState() { - try { - fs.writeFileSync(FREEMODE_FILE, JSON.stringify(freeModeState, null, 2)); - } catch (e) { - console.error("Failed to save freemode.json", e.message); - } -} - -function isFreeModeActive() { - if (freeModeState.active) { - if (freeModeState.expiresAt && Date.now() > freeModeState.expiresAt) { - freeModeState.active = false; - freeModeState.expiresAt = null; - saveFreeModeState(); - console.log("[FREE MODE] Expired automatically."); - return false; - } - return true; - } - return false; -} - -function parseDuration(str) { - const match = str.match(/^(\d+)([smhd])$/i); - if (!match) return null; - const value = parseInt(match[1]); - const unit = match[2].toLowerCase(); - switch (unit) { - case 's': return value * 1000; - case 'm': return value * 60 * 1000; - case 'h': return value * 60 * 60 * 1000; - case 'd': return value * 24 * 60 * 60 * 1000; - default: return null; - } -} +// ── FREE MODE CONFIGURATION (MODULAR) ────────────────────────────────── +const { + freeModeState, + saveFreeModeState, + isFreeModeActive, + parseDuration, + applyFreeMode +} = require('./modules/admin/freemode'); + async function triggerFreeModeBroadcast(durationText) { let targets = []; [diff_block_end] Please note that the above snippet only shows the MODIFIED lines from the last change. It shows up to 3 lines of unchanged lines before and after the modified lines. The actual file contents may have many more lines not shown.