goat
command
baby
Full Mirai-style Baby AI
0
views
0
likes
0
installs
Aliases: mari, maria, hippi, xan, bby, bbz
raw source
const axios = require("axios");
const simsim = "https://simsimi-api-tjb1.onrender.com";
const typing = async (api, threadID, ms = 3000) => {
try {
if (typeof api.sendTypingIndicator === "function") {
await api.sendTypingIndicator(threadID, true);
await new Promise(resolve => setTimeout(resolve, ms));
await api.sendTypingIndicator(threadID, false);
}
} catch {}
};
module.exports = {
config: {
name: "baby",
aliases: ["mari", "maria", "hippi", "xan", "bby", "bbz"],
version: "3.6",
author: "rX (fixed by GPT)",
countDown: 0,
role: 0,
shortDescription: "Full Mirai-style Baby AI",
longDescription: "Teachable AI + autoteach + list/msg/edit/remove + typing",
category: "box chat",
guide: {
en: "{p}baby [message]\n{p}baby teach [q] - [a]\n{p}baby autoteach on/off\n{p}baby list\n{p}baby msg [trigger]\n{p}baby edit [q] - [old] - [new]\n{p}baby remove/rm [q] - [a]"
}
},
onStart: async function ({ api, event, args, message, usersData }) {
const senderID = event.senderID;
const senderName = await usersData.getName(senderID);
const threadID = event.threadID;
const query = args.join(" ").trim().toLowerCase();
try {
// no text => random reply
if (!query) {
await typing(api, threadID, 2000);
const ran = ["Bolo baby ๐", "Hea baby ๐", "Yes I'm here ๐", "Ki khobor janu? ๐ฅฐ"];
return message.reply(ran[Math.floor(Math.random() * ran.length)], (err, info) => {
if (!err) global.GoatBot.onReply.set(info.messageID, { commandName: "baby" });
});
}
// AUTOTEACH TOGGLE
if (args[0] === "autoteach") {
const mode = args[1]?.toLowerCase();
if (!["on","off"].includes(mode)) return message.reply("Use: baby autoteach on/off");
const status = mode === "on";
await axios.post(`${simsim}/setting`, { autoTeach: status }, { timeout: 10000 });
return message.reply(`โ
Auto teach now ${status ? "ON ๐ข" : "OFF ๐ด"}`);
}
// LIST
if (args[0] === "list") {
const res = await axios.get(`${simsim}/list`, { timeout: 10000 });
return message.reply(
`โญโโผ๐ ๐๐๐๐ฒ ๐๐ ๐๐ญ๐๐ญ๐ฎ๐ฌ
โ ๐ ๐๐๐๐๐ก๐๐ ๐๐ฎ๐๐ฌ๐ญ๐ข๐จ๐ง๐ฌ: ${res.data.totalQuestions || 0}
โ ๐ฆ ๐๐ญ๐จ๐ซ๐๐ ๐๐๐ฉ๐ฅ๐ข๐๐ฌ: ${res.data.totalReplies || 0}
โฐโโผ๐ค ๐๐๐ฏ: rX ๐๐๐๐ฎ๐ฅ๐ฅ๐๐ก`
);
}
// MSG
if (args[0] === "msg") {
const trigger = args.slice(1).join(" ").trim();
if (!trigger) return message.reply("Use: baby msg [trigger]");
const res = await axios.get(`${simsim}/simsimi-list?ask=${encodeURIComponent(trigger)}`, { timeout: 10000 });
if (!res.data.replies?.length) return message.reply("โ No replies found for this trigger.");
const formatted = res.data.replies.map((rep, i) => `โค ${i+1}. ${rep}`).join("\n");
return message.reply(
`๐ ๐ง๐ฟ๐ถ๐ด๐ด๐ฒ๐ฟ: ${trigger.toUpperCase()}
๐ ๐ง๐ผ๐๐ฎ๐น ๐ฅ๐ฒ๐ฝ๐น๐ถ๐ฒ๐: ${res.data.total || res.data.replies.length}
โโโโโโโโโโโโโโ
${formatted}`
);
}
// TEACH
if (args[0] === "teach") {
const parts = query.replace(/^teach\s+/i, "").split(" - ");
if (parts.length < 2) return message.reply("Use: baby teach question - answer");
const [ask, ans] = parts.map(s => s.trim());
const res = await axios.get(`${simsim}/teach?ask=${encodeURIComponent(ask)}&ans=${encodeURIComponent(ans)}&senderName=${encodeURIComponent(senderName)}&senderID=${senderID}`, { timeout: 10000 });
return message.reply(res.data.message || "โ
Taught successfully!");
}
// EDIT
if (args[0] === "edit") {
const parts = query.replace(/^edit\s+/i, "").split(" - ");
if (parts.length < 3) return message.reply("Use: baby edit question - old reply - new reply");
const [ask, oldR, newR] = parts.map(s => s.trim());
const res = await axios.get(`${simsim}/edit?ask=${encodeURIComponent(ask)}&old=${encodeURIComponent(oldR)}&new=${encodeURIComponent(newR)}`, { timeout: 10000 });
return message.reply(res.data.message || "โ
Edited successfully!");
}
// REMOVE / RM
if (["remove","rm"].includes(args[0])) {
const parts = query.replace(/^(remove|rm)\s+/i, "").split(" - ");
if (parts.length < 2) return message.reply("Use: baby remove question - answer");
const [ask, ans] = parts.map(s => s.trim());
const res = await axios.get(`${simsim}/delete?ask=${encodeURIComponent(ask)}&ans=${encodeURIComponent(ans)}`, { timeout: 10000 });
return message.reply(res.data.message || "โ
Removed successfully!");
}
// Normal chat
await typing(api, threadID, 2000);
const res = await axios.get(`${simsim}/simsimi?text=${encodeURIComponent(query)}&senderName=${encodeURIComponent(senderName)}`, { timeout: 15000 });
let responses = Array.isArray(res.data.response) ? res.data.response : [res.data.response || "Hmm baby ๐"];
for (const r of responses) {
await new Promise(resolve => {
message.reply(r, (err, info) => {
if (!err) global.GoatBot.onReply.set(info.messageID, { commandName: "baby" });
resolve();
});
});
}
} catch (err) {
console.error("Baby command error:", err.message);
message.reply("โ Error: " + (err.message.includes("404") ? "Feature not available (backend issue)" : err.message));
}
},
onReply: async function ({ api, event, message, usersData }) {
const text = event.body?.trim();
if (!text) return;
const senderName = await usersData.getName(event.senderID);
try {
await typing(api, event.threadID, 2000);
const res = await axios.get(`${simsim}/simsimi?text=${encodeURIComponent(text)}&senderName=${encodeURIComponent(senderName)}`, { timeout: 15000 });
const replies = Array.isArray(res.data.response) ? res.data.response : [res.data.response];
for (const r of replies) {
await message.reply(r, (err, info) => {
if (!err) global.GoatBot.onReply.set(info.messageID, { commandName: "baby" });
});
}
} catch (err) {
console.error("onReply error:", err.message);
}
},
onChat: async function ({ api, event, message, usersData }) {
const raw = event.body ? event.body.toLowerCase().trim() : "";
if (!raw) return;
const senderID = event.senderID;
const senderName = await usersData.getName(senderID);
const threadID = event.threadID;
try {
// triggers only
const triggers = ["baby","bby","xan","bbz","mari","เฆฎเฆพเฆฐเฆฟเฆฏเฆผเฆพ","bot"];
if (triggers.includes(raw)) {
await typing(api, threadID, 5000);
const funny = [
"๐ฌ๐ช ๐๐ฐ๐ช๐ด๐ฆ ๐๐ข๐ฏ ๐ฃ๐ฐ๐ญ๐ฐ ๐ฟ", "๐๐ต๐ฐ ๐๐ข๐ฌ๐ฐ ๐๐ฆ๐ฏ ๐๐ถ๐ฏ๐ด๐ช ๐๐ฐ ๐โโ๏ธ", "๐๐ต๐ฐ ๐๐ฐ๐ต ๐๐ฐ๐ต ๐๐ฐ๐ณ๐ญ๐ฆ ๐๐ฆ๐ข๐ท๐ฆ ๐๐ช๐ฎ๐ถ ๐",
"๐๐ถ๐ฎ๐ช ๐๐ข๐ฌ๐ญ๐ฆ๐ช ๐๐ฐ๐ญ๐ฆ ๐๐ด๐ช ๐โโ๏ธ", "เฆเฆ เฆเฆพเฆจ เฆเฆคเงเฆฌเฆพเฆฐ เฆกเฆพเฆเง เฆเงเฆจ ๐ฅน", "เฆเฆฎเฆพเฆเง เฆจเฆพ เฆกเงเฆเง เฆเฆเฆพเฆถ เฆญเฆพเฆ เฆเง เฆชเงเฆฐเงเฆชเงเฆ เฆเฆฐ ๐ท๐ซถ",
"เฆนเงเฆฎ เฆฌเฆฒเง เฆชเฆพเฆเฆฟ ๐ซถ๐ค ", "เฆคเงเฆฎเฆพเฆฐเง เฆฐเฆพเฆเฆคเง เฆญเฆพเฆฒเงเฆฌเฆพเฆธเฆฟ ๐", "เฆเฆฎเฆพเฆเง เฆกเฆพเฆเฆเง? ๐"
];
return message.reply(funny[Math.floor(Math.random() * funny.length)], (err, info) => {
if (!err) global.GoatBot.onReply.set(info.messageID, { commandName: "baby" });
});
}
// prefixes
const prefixes = ["baby ","bby ","xan ","bbz ","mari ","เฆฎเฆพเฆฐเฆฟเฆฏเฆผเฆพ ","bot "];
const prefix = prefixes.find(p => raw.startsWith(p));
if (prefix) {
const q = raw.replace(prefix,"").trim();
if (!q) return;
await typing(api, threadID, 2000);
const res = await axios.get(`${simsim}/simsimi?text=${encodeURIComponent(q)}&senderName=${encodeURIComponent(senderName)}`, { timeout: 15000 });
const replies = Array.isArray(res.data.response) ? res.data.response : [res.data.response];
for (const r of replies) {
await message.reply(r, (err, info) => {
if (!err) global.GoatBot.onReply.set(info.messageID, { commandName: "baby" });
});
}
return;
}
// AUTO-TEACH from reply
if (event.messageReply) {
try {
const setting = await axios.get(`${simsim}/setting`, { timeout: 8000 });
if (setting.data?.autoTeach) {
const ask = event.messageReply.body?.toLowerCase().trim();
const ans = raw.trim();
if (ask && ans && ask !== ans) {
setTimeout(async () => {
try {
await axios.get(`${simsim}/teach?ask=${encodeURIComponent(ask)}&ans=${encodeURIComponent(ans)}&senderName=${encodeURIComponent(senderName)}`, { timeout: 10000 });
} catch {}
}, 500);
}
}
} catch {}
}
} catch (err) {
console.error("onChat error:", err.message);
}
}
};