// code from goatstore // api: https://store.agi.bd const { box } = require("../../bot/v3ui.js"); const B = require("../../bot/autoBackup.js"); module.exports = { config: { name: "dbbackup", aliases: ["backupdb"], version: "3.0", author: "R S Rifat", countDown: 10, role: 2, description: { en: "Create or list SQLite database backups" }, category: "system", guide: { en: "{pn} now | {pn} list" } }, onStart: async function ({ message, args }) { const sub = (args[0] || "list").toLowerCase(); if (sub === "now") { try { const r = B.run(); return message.reply(r.ok ? box("๐Ÿ’พ", "BACKUP DONE", [`โ—ˆ File โŸถ ${r.name}`], "Saved in the backups/ folder") : box("โœ–", "BACKUP FAILED", [r.reason])); } catch (e) { return message.reply(box("โœ–", "BACKUP FAILED", [String(e.message || e)])); } } const l = B.list(); return message.reply(box("๐Ÿ’พ", "BACKUPS", l.length ? l.slice(0, 8).map(x => `โ—ˆ ${x.name} ยท ${(x.size / 1024).toFixed(0)} KB`) : ["No backups yet."], "Use: dbbackup now")); } };