// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "console", aliases: ["log", "cls"], version: "1.0.0", author: "rX", countDown: 3, role: 2, shortDescription: "Bật/tắt hiển thị console chi tiết", longDescription: "Module quản lý hiển thị console của bot: bật/tắt log tin nhắn, lệnh, API, database.", category: "system", guide: { en: "{pn} on — Bật hiển thị tin nhắn\n" + "{pn} off — Tắt hiển thị tin nhắn\n" + "{pn} status — Xem trạng thái hiện tại\n" + "{pn} clear — Xóa màn hình console" } }, onLoad: function () { global.consoleConfig = global.consoleConfig || { showMessage: true, showCommand: true, showApi: false, showEvent: false, showDatabase: false, showDebug: false }; }, onStart: async function ({ api, event, args }) { const { threadID } = event; const cfg = global.consoleConfig; if (!global.consoleConfig) { global.consoleConfig = { showMessage: true, showCommand: true, showApi: false, showEvent: false, showDatabase: false, showDebug: false }; } const sub = args[0]?.toLowerCase(); if (!sub) { return api.sendMessage( `📟 Quản lý Console\n` + `━━━━━━━━━━━━━━━━━━\n` + `• console on — Bật tin nhắn\n` + `• console off — Tắt tin nhắn\n` + `• console status — Trạng thái\n` + `• console clear — Xóa màn hình`, threadID ); } if (sub === "on") { global.consoleConfig.showMessage = true; global.consoleConfig.showCommand = true; return api.sendMessage("✅ Đã BẬT hiển thị tin nhắn và lệnh trên console.", threadID); } if (sub === "off") { global.consoleConfig.showMessage = false; global.consoleConfig.showCommand = false; return api.sendMessage("🔇 Đã TẮT hiển thị tin nhắn và lệnh trên console.", threadID); } if (sub === "clear" || sub === "cls") { console.clear(); return api.sendMessage("🧹 Đã xóa màn hình console.", threadID); } if (sub === "status") { const c = global.consoleConfig; const badge = v => v ? "✅ BẬT" : "❌ TẮT"; return api.sendMessage( `📟 Trạng thái Console\n` + `━━━━━━━━━━━━━━━━━━\n` + `• Tin nhắn : ${badge(c.showMessage)}\n` + `• Lệnh : ${badge(c.showCommand)}\n` + `• API : ${badge(c.showApi)}\n` + `• Sự kiện : ${badge(c.showEvent)}\n` + `• Database : ${badge(c.showDatabase)}\n` + `• Debug : ${badge(c.showDebug)}`, threadID ); } return api.sendMessage("❌ Lệnh không hợp lệ. Gõ `console` để xem hướng dẫn.", threadID); } };