goat
command
botjoin
No description
0
views
0
likes
0
installs
raw source
const axios = require("axios");
const fs = require("fs-extra");
const path = require("path");
const ownerInfo = {
name: "๐๐โข ๐๐ธ๐๐ฐ๐",
facebook: "https://facebook.com/61557500431580",
telegram: "@rifat5546",
supportGroup: "https://m.me/61557500431580"
};
module.exports = {
config: {
name: "botjoin",
version: "2.0",
author: "Saimx69x",
category: "events"
},
onStart: async function ({ event, api, message }) {
if (event.logMessageType !== "log:subscribe") return;
const { threadID, logMessageData } = event;
const botID = api.getCurrentUserID();
const addedUsers = logMessageData.addedParticipants;
const isBotAdded = addedUsers.some(u => u.userFbId === botID);
if (!isBotAdded) return;
const nickNameBot = global.GoatBot.config.nickNameBot || "Sakura Bot";
const prefix = global.utils.getPrefix(threadID);
const BOT_UID = botID;
try {
await api.changeNickname(nickNameBot, threadID, botID);
} catch (err) {
console.warn("โ ๏ธ Nickname change failed:", err.message);
}
try {
const API_ENDPOINT = "https://xsaim8x-xxx-api.onrender.com/api/botjoin";
const apiUrl = `${API_ENDPOINT}?botuid=${BOT_UID}&prefix=${encodeURIComponent(prefix)}`;
const tmpDir = path.join(__dirname, "..", "cache");
await fs.ensureDir(tmpDir);
const imagePath = path.join(tmpDir, `botjoin_image_${threadID}.png`);
const response = await axios.get(apiUrl, { responseType: "arraybuffer" });
fs.writeFileSync(imagePath, response.data);
const textMsg = [
"๐ ๐๐ก๐๐ง๐ค ๐ฒ๐จ๐ฎ ๐๐จ๐ซ ๐ข๐ง๐ฏ๐ข๐ญ๐ข๐ง๐ ๐ฆ๐ ๐",
`๐น ๐๐จ๐ญ ๐ฉ๐ซ๐๐๐ข๐ฑ: ${prefix}`,
`๐ธ ๐๐ฒ๐ฉ๐: ${prefix}help ๐ญ๐จ ๐ฌ๐๐ ๐๐ฅ๐ฅ ๐๐จ๐ฆ๐ฆ๐๐ง๐๐ฌ`,
"โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ",
`๐ ๐๐ฐ๐ง๐๐ซ: ${ownerInfo.name}`,
`๐ ๐
๐๐๐๐๐จ๐จ๐ค: ${ownerInfo.facebook}`,
`โ๏ธ ๐๐๐ฅ๐๐ ๐ซ๐๐ฆ: ${ownerInfo.telegram}`,
`๐ค ๐๐จ๐ข๐ง ๐๐ฎ๐ฉ๐ฉ๐จ๐ซ๐ญ ๐๐: ${ownerInfo.supportGroup}`
].join("\n");
await api.sendMessage({
body: textMsg,
attachment: fs.createReadStream(imagePath)
}, threadID);
fs.unlinkSync(imagePath);
} catch (err) {
console.error("โ ๏ธ Error sending botjoin message:", err);
const fallbackMsg = [
"๐ ๐๐ก๐๐ง๐ค ๐ฒ๐จ๐ฎ ๐๐จ๐ซ ๐ข๐ง๐ฏ๐ข๐ญ๐ข๐ง๐ ๐ฆ๐ ๐:",
"โ๏ธ ๐ธ๐ ๐ข๐๐ ๐๐๐๐ ๐๐๐ข ๐๐๐๐๐๐๐๐, ๐๐๐๐๐๐ ๐๐๐๐๐๐๐ ๐๐๐ ๐๐๐๐๐.",
`๐น ๐๐จ๐ญ ๐ฉ๐ซ๐๐๐ข๐ฑ: ${prefix}`,
`๐ธ ๐๐ฒ๐ฉ๐: ${prefix}help ๐ญ๐จ ๐ฌ๐๐ ๐๐ฅ๐ฅ ๐๐จ๐ฆ๐ฆ๐๐ง๐๐ฌ`,
"โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ",
`๐ ๐๐ฐ๐ง๐๐ซ: ${ownerInfo.name}`,
`๐ ๐
๐๐๐๐๐จ๐จ๐ค: ${ownerInfo.facebook}`,
`โ๏ธ ๐๐๐ฅ๐๐ ๐ซ๐๐ฆ: ${ownerInfo.telegram}`,
`๐ค ๐๐จ๐ข๐ง ๐๐ฎ๐ฉ๐ฉ๐จ๐ซ๐ญ ๐๐: ${ownerInfo.supportGroup}`
].join("\n");
api.sendMessage(fallbackMsg, threadID);
}
}
};