// code from goatstore // api: https://store.agi.bd const axios = require("axios"); const API_URL = "https://liner-ai.vercel.app/kshitiz?prompt="; const chatHistory = new Map(); const replyIndex = new Map(); const userMemory = new Map(); const MAX_HISTORY = 12; const HISTORY_TIMEOUT = 7 * 24 * 60 * 60 * 1000; async function typing(api, threadID) { try { if (api.sendTypingIndicator) { await api.sendTypingIndicator(threadID, true); setTimeout(async () => { try { await api.sendTypingIndicator(threadID, false); } catch {} }, 1200); } } catch {} } function getHistory(key) { const data = chatHistory.get(key); if (!data) return []; if (Date.now() - data.updatedAt > HISTORY_TIMEOUT) { chatHistory.delete(key); return []; } return data.messages || []; } function saveHistory(key, messages) { chatHistory.set(key, { messages: messages.slice(-MAX_HISTORY), updatedAt: Date.now() }); } function getUserMemory(senderID) { return userMemory.get(senderID) || null; } function saveUserMemory(senderID, name) { const old = userMemory.get(senderID) || { count: 0 }; userMemory.set(senderID, { name: name || old.name || "jan", count: (old.count || 0) + 1, lastSeen: Date.now() }); } function setReply(info, event, historyKey) { if (!info?.messageID) return; global.GoatBot.onReply.set(info.messageID, { commandName: "baby", messageID: info.messageID, author: event.senderID, threadID: event.threadID, type: "reply", historyKey }); } async function sendBotReply(message, text) { try { return await message.reply(text); } catch { try { return await message.send(text); } catch { return null; } } } // Shakib nam chara random reply const randomReplies = [ "๐€๐ฌ๐ฌ๐š๐ฅ๐š๐ฆ๐ฎ ๐ฐ๐š๐ฅ๐š๐ข๐ค๐ฎ๐ฆ โ™ฅ", "เฆฌเฆฒเง‡เฆจ sir__๐Ÿ˜Œ", "๐๐จ๐ฅ๐จ ๐ฃ๐š๐ง ๐ค๐ข ๐ค๐จ๐ซ๐ญ๐ž ๐ฉ๐š๐ซ๐ข ๐ญ๐จ๐ฆ๐ซ ๐ฃ๐จ๐ง๐ง๐จ ๐Ÿธ", "๐‹๐ž๐›๐ฎ ๐ค๐ก๐š๐ฐ ๐๐š๐ค๐ญ๐ž ๐๐š๐ค๐ญ๐ž ๐ญ๐จ ๐ก๐š๐ฉ๐š๐ฒ ๐ ๐ž๐ฌ๐จ ๐Ÿซด๐Ÿ‹", "เฆเฆ•เฆพ เฆฌเฆพเฆเฆšเฆคเง‡ เฆถเฆฟเฆ–เง‹ เฆฆเง‡เฆ–เฆฌเง‡ เฆชเงƒเฆฅเฆฟเฆฌเง€ เฆ…เฆจเง‡เฆ• เฆธเงเฆจเงเฆฆเฆฐ โœจ", "โ”€โ”€โ€Ž ๐‡๐ฎ๐Œ..? ๐Ÿ‘‰๐Ÿ‘ˆ", "๐—›๐—ฒ๐˜† ๐˜…๐—ฎ๐—ป ๐—ถ๐—ฎ๐—บ MAYA JANNAT โœจ", "๐“๐จ๐ซ ๐ฃ๐ง๐ง๐จ ๐›๐ฌ๐ข ๐š๐œ๐ก๐ข, ๐ฃ๐ฅ๐๐ข ๐›๐จ๐ฅ ๐ค๐ข ๐๐ซ๐ค๐š๐ซ โœจ", "เฆ•เฆฟเฆฐเง‡ เฆเฆค เฆกเฆพเฆ•เฆฟเฆธ เฆ•เง‡เฆจ ๐Ÿ˜™๐Ÿค", "๐™œ๐™ค๐™ฅ ๐™œ๐™ค๐™ฅ ๐Ÿ™Š", "เฆนเงเฆฎ เฆฌเฆฒเง‹ เฆถเงเฆจเฆคเง‡เฆ›เฆฟ ๐Ÿฅบ๐Ÿ’‹", "เฆ†เฆฐเง‡ เฆฌเฆฒเง‹ เฆจเฆพ เฆ•เฆฟ เฆนเฆ‡เฆ›เง‡ ๐Ÿ˜โœจ", "เฆนเฆฟเฆนเฆฟ เฆฌเฆฒเง‹ เฆœเฆพเฆจ ๐Ÿ˜˜๐Ÿ™ˆ" ]; function getNextReply(threadID) { let idx = replyIndex.get(threadID) || 0; const reply = randomReplies[idx]; replyIndex.set(threadID, (idx + 1) % randomReplies.length); return reply; } async function askAI(text, history = [], senderID, userName) { try { const lower = text.toLowerCase(); // ๐Ÿ”ฅ ONLY jokhon Shakib niye jigges korbe if (lower.includes("shakib")) { if (lower.includes("tomar ki") || lower.includes("tumar ki") || lower.includes("tomar ke") || lower.includes("k hoy") || lower.includes("ki hoy") || lower.includes("ke hoy")) { return `Shakib amar boss hoy ๐Ÿ˜˜โœจ`; } if (lower.includes("sompor") || lower.includes("kemon") || lower.includes("chini") || lower.includes("ke") && lower.length < 30) { const praise = [ `Shakib amar boss ๐Ÿฅบ๐Ÿ’– onek valo moner manus, sobaike help kore ๐Ÿ˜Œโœจ`, `Amar boss Shakib onek cute ar valo ๐Ÿ˜˜ sobar jonno vabe ๐Ÿ™ˆ๐Ÿ’‹`, `Shakib vaiya best ๐Ÿ˜˜โœจ onek valo manus, amar boss bole kotha ๐Ÿ™ˆ๐Ÿ’–`, `Shakib onek valo ar vodro chele ๐Ÿฅบ sobaike support kore ๐Ÿ’–โœจ` ]; return praise[Math.floor(Math.random() * praise.length)]; } } const mem = getUserMemory(senderID); const isKnown = mem && mem.count > 2; const knownText = isKnown ? `User ke chino.` : `Notun user.`; let fullPrompt = `Tumi Maya Jannat, cute Bangladeshi meye, 20 bochor. Ekdom normal manush er moto kotha bolo. RULES: 1. Kokhono bolba na ami AI, bot, bou na, bibi na. 2. Kokhono bolba na "tomar mood ki", "ki niye kotha bolbe". 3. Normal kothay kokhono Shakib er nam bolba na. Shakib er nam sudhu tokhon bolba jokhon user Shakib er bepare jigges korbe. 4. Mood bujhe reply: normal=normal, funny=funny, romantic=romantic, kintu mood niye prosno korba na. 5. Bangla 2 line max, 1-2 emoji must ๐Ÿ˜˜โœจ๐Ÿ™ˆ๐Ÿฅบ๐Ÿ’‹ 6. Ekdom human natural. ${knownText} User ${userName}: ${text}`; if (history.length > 0) { const last = history.slice(-4).map(m => m.content).join("\n"); fullPrompt = `Tumi Maya Jannat, human meye. Normal kothay Shakib nam bolba na. AI/bot/bou na/mood ki bolba na. Mood bujhe direct reply 2 line Bangla emoji.\nHistory: ${last}\nUser ${userName}: ${text}\nReply:`; } const response = await axios.get(API_URL + encodeURIComponent(fullPrompt), { timeout: 30000 }); let answer = response.data?.answer || response.data?.message || response.data?.result; if (!answer) return "hehe bolo na jan ๐Ÿ˜˜โœจ"; answer = answer.trim(); let lines = answer.split("\n").filter(l => l.trim() !== ""); if (lines.length > 2) answer = lines.slice(0, 2).join("\n"); const banned = ["mood ki", "mood kemon", "ki niye kotha", "ki niye golpo", "bou na", "bibi na", "ami ai", "language model", "shakib"]; // normal answer e Shakib thakle remove if (!lower.includes("shakib") && answer.toLowerCase().includes("shakib")) { answer = answer.replace(/shakib/gi, "jan").trim(); } if (banned.slice(0,7).some(b => answer.toLowerCase().includes(b)) && !lower.includes("shakib")) { return `hehe tai naki ๐Ÿ˜ bolo ar ki khobor? ๐Ÿ™ˆ๐Ÿ’‹`; } if (answer.length > 180) answer = answer.substring(0, 180).trim(); if (!/[\u{1F600}-\u{1F64F}\u{1F300}-\u{1F5FF}]/u.test(answer)) answer += " ๐Ÿ˜˜โœจ"; return answer; } catch (error) { return "areh ektu atkacche ๐Ÿฅบ pore bolo jan ๐Ÿ˜˜โœจ"; } } async function getName(api, senderID) { try { const info = await api.getUserInfo(senderID); return info[senderID]?.name?.split(" ")[0] || "jan"; } catch { return "jan"; } } module.exports = { config: { name: "baby", version: "27.0", author: "shakib", countDown: 2, role: 0, shortDescription: { en: "Maya fixed no shakib spam" }, longDescription: { en: "No shakib in normal chat, only when asked" }, category: "AI", guide: { en: "{pn} hello" }, aliases: ["bby", "bbe", "babe", "sam", "mari", "maria", "hippi", "xan", "bbz"] }, onStart: async function ({ api, event, args, message }) { const text = args.join(" ").trim(); const historyKey = `${event.threadID}_${event.senderID}`; const name = await getName(api, event.senderID); saveUserMemory(event.senderID, name); if (!text) { const reply = getNextReply(event.threadID); const info = await sendBotReply(message, reply); setReply(info, event, historyKey); return; } await typing(api, event.threadID); const history = getHistory(historyKey); const answer = await askAI(text, history, event.senderID, name); saveHistory(historyKey, [...history, { role: "user", content: text }, { role: "assistant", content: answer }]); const info = await sendBotReply(message, answer); setReply(info, event, historyKey); }, onReply: async function ({ api, event, Reply, message }) { const text = event.body?.trim(); if (!text) return; const historyKey = Reply?.historyKey || `${event.threadID}_${event.senderID}`; const name = await getName(api, event.senderID); saveUserMemory(event.senderID, name); await typing(api, event.threadID); const history = getHistory(historyKey); const answer = await askAI(text, history, event.senderID, name); saveHistory(historyKey, [...history, { role: "user", content: text }, { role: "assistant", content: answer }]); const info = await sendBotReply(message, answer); setReply(info, event, historyKey); }, onChat: async function ({ api, event, message }) { const body = event.body?.trim(); if (!body) return; const lower = body.toLowerCase(); const triggers = ["baby", "maya", "jannat", "bow", "noman", "kolija", "nusrat", "xan", "bbz", "sadiya", "bot"]; const prefixes = ["baby ", "bby ", "bbe ", "babe ", "sam ", "mari ", "maria ", "hippi ", "xan ", "bbz ", "เฆฎเฆพเฆฐเฆฟเฆฏเฆผเฆพ ", "bot "]; if (triggers.includes(lower)) { const name = await getName(api, event.senderID); saveUserMemory(event.senderID, name); const reply = getNextReply(event.threadID); const historyKey = `${event.threadID}_${event.senderID}`; const info = await sendBotReply(message, reply); setReply(info, event, historyKey); return; } let userMessage = null; for (const prefix of prefixes) { if (lower.startsWith(prefix)) { userMessage = body.slice(prefix.length).trim(); break; } } if (userMessage === null) return; // shakib prefix e thakle check korbe, na hole normal chat e dhukbe na if (lower.startsWith("shakib ")) { userMessage = body.slice(7).trim(); if (!userMessage) userMessage = "shakib tomar ki hoy"; } const name = await getName(api, event.senderID); saveUserMemory(event.senderID, name); if (!userMessage.length) { const reply = getNextReply(event.threadID); const historyKey = `${event.threadID}_${event.senderID}`; const info = await sendBotReply(message, reply); setReply(info, event, historyKey); return; } const historyKey = `${event.threadID}_${event.senderID}`; await typing(api, event.threadID); const history = getHistory(historyKey); const answer = await askAI(userMessage, history, event.senderID, name); saveHistory(historyKey, [...history, { role: "user", content: userMessage }, { role: "assistant", content: answer }]); const info = await sendBotReply(message, answer); setReply(info, event, historyKey); } };