// code from goatstore // api: https://store.agi.bd const fs = require("fs"); const path = require("path"); const dbPath = path.join(__dirname, "teach_data.json"); function loadData() { try { return JSON.parse(fs.readFileSync(dbPath, "utf8")); } catch { return {}; } } function saveData(data) { fs.writeFileSync(dbPath, JSON.stringify(data, null, 2)); } module.exports = { config: { name: "teach", version: "1.0.0", author: "Abir", role: 0, description: "Teach the bot custom replies", category: "learning", usages: "teach question | answer" }, onStart: async function ({ api, event, args }) { const input = args.join(" "); const parts = input.split("|"); if (parts.length < 2) { return api.sendMessage( "Usage: teach bby | I love you", event.threadID, event.messageID ); } const question = parts[0].trim().toLowerCase(); const answer = parts.slice(1).join("|").trim(); if (!question || !answer) { return api.sendMessage( "Question and answer both required!", event.threadID, event.messageID ); } const data = loadData(); data[question] = answer; saveData(data); return api.sendMessage( `✅ শিখে ফেলেছি!\nপ্রশ্ন: ${question}\nউত্তর: ${answer}`, event.threadID, event.messageID ); } };