//base by DGXeon //re-upload? recode? copy code? give credit ya :) //YouTube: @DGXeon //Instagram: unicorn_xeon13 //Telegram: t.me/xeonbotinc //GitHub: @DGXeon //WhatsApp: +916909137213 //want more free bot scripts? subscribe to my youtube channel: https://youtube.com/@DGXeon const fs = require('fs') const addAfkUser = (userId, time, reason, _dir) => { const obj = { id: userId, time: time, reason: reason } _dir.push(obj) fs.writeFileSync('./database/afk-user.json', JSON.stringify(_dir, null, 2)) } const checkAfkUser = (userId, _dir) => { let status = false Object.keys(_dir).forEach((i) => { if (_dir[i].id === userId) { status = true } }) return status } const getAfkReason = (userId, _dir) => { let position = null Object.keys(_dir).forEach((i) => { if (_dir[i].id === userId) { position = i } }) if (position !== null) { return _dir[position].reason } } const getAfkTime = (userId, _dir) => { let position = null Object.keys(_dir).forEach((i) => { if (_dir[i].id === userId) { position = i } }) if (position !== null) { return _dir[position].time } } const getAfkId = (userId, _dir) => { let position = null Object.keys(_dir).forEach((i) => { if (_dir[i].id === userId) { position = i } }) if (position !== null) { return _dir[position].id } } const getAfkPosition = (userId, _dir) => { let position = null Object.keys(_dir).forEach((i) => { if (_dir[i].id === userId) { position = i } }) return position } module.exports = { addAfkUser, checkAfkUser, getAfkReason, getAfkTime, getAfkId, getAfkPosition }