// code from goatstore // api: https://store.agi.bd const axios = require("axios"); const API = axios.create({ baseURL: "https://eryxenx.agi.bd/api/simsimi", timeout: 20000 }); let botUID = null; function getBotUID(api) { if (botUID) return botUID; try { if (typeof api.getCurrentUserID === "function") { botUID = api.getCurrentUserID(); } } catch {} return botUID; } async function getUserName(api, uid, usersData) { try { if (usersData && typeof usersData.getName === "function") { const name = await usersData.getName(uid); if (name) return name; } const info = await api.getUserInfo(uid); return (info && info[uid] && info[uid].name) || "User"; } catch { return "User"; } } module.exports.config = { name: "autoteach", version: "1.0.0", role: 0, author: "EryXenX", countTime: 0, category: "chat", shortDescription: "Auto teach AI from group chat", longDescription: "Group e duijon kotha bolle pair toiri hoye AI-ke automatic teach kore. Kono setup lage na, bot group e thakleเฆ‡ always ON.", guide: "{pn} - autoteach status dekhte", envConfig: {} }; module.exports.onStart = async function ({ api, event }) { try { const res = await API.get("/autoteach/stats"); const { today = 0, total = 0 } = res.data || {}; return api.sendMessage( `โ•ญโ”€โ•ผ๐ŸŒŸ ๐—”๐˜‚๐˜๐—ผ๐˜๐—ฒ๐—ฎ๐—ฐ๐—ต ๐—ฆ๐˜๐—ฎ๐˜๐˜‚๐˜€\nโ”œ ๐ŸŸข ๐—ฆ๐˜๐—ฎ๐˜๐˜‚๐˜€: ๐—”๐—น๐˜„๐—ฎ๐˜†๐˜€ ๐—ข๐—ก\nโ”œ ๐Ÿ“… ๐—ง๐—ผ๐—ฑ๐—ฎ๐˜†: ${today}\nโ•ฐโ”€โ•ผ๐Ÿ“Š ๐—ง๐—ผ๐˜๐—ฎ๐—น: ${total}`, event.threadID, event.messageID ); } catch (e) { console.error("โŒ [autoteach/onStart] error:", e); return api.sendMessage( `โ•ญโ”€โ•ผ๐ŸŒŸ ๐—”๐˜‚๐˜๐—ผ๐˜๐—ฒ๐—ฎ๐—ฐ๐—ต ๐—ฆ๐˜๐—ฎ๐˜๐˜‚๐˜€\nโ•ฐโ”€โ•ผ๐ŸŸข ๐—ฆ๐˜๐—ฎ๐˜๐˜‚๐˜€: ๐—”๐—น๐˜„๐—ฎ๐˜†๐˜€ ๐—ข๐—ก`, event.threadID, event.messageID ); } }; module.exports.onChat = async function ({ api, event, usersData }) { if (!event.isGroup || !event.senderID) return; const uid = getBotUID(api); if (event.senderID === uid) return; const text = event.body?.trim(); if (!text) return; const senderName = await getUserName(api, event.senderID, usersData); try { await API.get("/autoteach", { params: { text, senderName, senderID: event.senderID, threadID: event.threadID }, timeout: 10000 }); } catch (e) { console.error("โŒ [autoteach/onChat] network error:", e.message); } };