goat
command
spy
Get user information and a styled banner
0
views
0
likes
0
installs
Aliases: whoishe, whoisshe, whoami, atake
raw source
const axios = require("axios");
const baseApiUrl = async () => {
const base = await axios.get(`https://raw.githubusercontent.com/Blankid018/D1PT0/main/baseApiUrl.json`);
return base.data.api;
};
module.exports = {
config: {
name: "spy",
aliases: ["whoishe", "whoisshe", "whoami", "atake"],
version: "2.1",
author: "Chitron Bhattacharjee",
role: 0,
countDown: 10,
description: "Get user information and a styled banner",
category: "information"
},
onStart: async function ({ event, message, usersData, api, args }) {
const uidSelf = event.senderID;
const uidMentioned = Object.keys(event.mentions)[0];
let uid;
if (args[0]) {
if (/^\d+$/.test(args[0])) {
uid = args[0];
} else {
const match = args[0].match(/profile\.php\?id=(\d+)/);
if (match) uid = match[1];
}
}
if (!uid)
uid = event.type === "message_reply"
? event.messageReply.senderID
: uidMentioned || uidSelf;
const userInfo = await api.getUserInfo(uid);
const avatarUrl = await usersData.getAvatarUrl(uid);
const user = userInfo[uid];
const nickname = (await usersData.get(uid))?.nickName || user.alternateName || "๐ฝ๐๐๐";
const username = user.vanity || "๐ฝ๐๐๐";
const profileUrl = user.profileUrl || "๐ฟ๐๐๐๐๐๐";
const birthday = user.isBirthday !== false ? user.isBirthday : "๐ฟ๐๐๐๐๐๐";
const gender = user.gender === 1 ? "๐ง Girl" : user.gender === 2 ? "๐ฆ Boy" : "๐ Undefined";
const isFriend = user.isFriend ? "โ
Yes" : "โ No";
const position = user.type?.toUpperCase() || "Normal User";
const allUser = await usersData.getAll();
const userData = await usersData.get(uid);
const money = userData.money || 0;
const exp = userData.exp || 0;
const rank = allUser.slice().sort((a, b) => b.exp - a.exp)
.findIndex(u => u.userID === uid) + 1;
const moneyRank = allUser.slice().sort((a, b) => b.money - a.money)
.findIndex(u => u.userID === uid) + 1;
// Baby teach system
let babyTeach = 0;
try {
const res = await axios.get(`${await baseApiUrl()}/baby?list=all`);
const babyList = res.data?.teacher?.teacherList || [];
babyTeach = babyList.find(t => t[uid])?.[uid] || 0;
} catch { }
const info = `
โญโ๐ ๐จ๐ฆ๐๐ฅ ๐๐ก๐๐ข ๐โโฎ
๐ค ๐ก๐ฎ๐บ๐ฒ: ${user.name}
๐ ๐จ๐๐: ${uid}
โง ๐๐ฒ๐ป๐ฑ๐ฒ๐ฟ: ${gender}
๐งญ ๐ฅ๐ผ๐น๐ฒ: ${position}
๐ ๐จ๐๐ฒ๐ฟ๐ป๐ฎ๐บ๐ฒ: ${username}
๐ ๐ฃ๐ฟ๐ผ๐ณ๐ถ๐น๐ฒ: ${profileUrl}
๐ ๐๐ถ๐ฟ๐๐ต๐ฑ๐ฎ๐: ${birthday}
๐ค ๐๐ฟ๐ถ๐ฒ๐ป๐ฑ ๐ช๐ถ๐๐ต ๐๐ผ๐: ${isFriend}
โฐโโโโโโโโโโโโโโฏ
โญโโ ๐ ๐ฆ๐ง๐๐ง๐ฆ ๐ โโโฎ
๐ฐ ๐ ๐ผ๐ป๐ฒ๐: $${formatMoney(money)}
๐ ๐ฅ๐ฎ๐ป๐ธ: #${rank}/${allUser.length}
๐ธ ๐ ๐ผ๐ป๐ฒ๐ ๐ฅ๐ฎ๐ป๐ธ: #${moneyRank}/${allUser.length}
๐ถ ๐๐ฎ๐ฏ๐ ๐ง๐ฒ๐ฎ๐ฐ๐ต: ${babyTeach}
โฐโโโโโโโโโโโโโโฏ
โจ ๐๐ฐ๐ต ๐ฃ๐บ: ๐๐ฉ๐ช๐ต๐ณ๐ฐ๐ฏ ๐๐ฉ๐ข๐ต๐ต๐ข๐ค๐ฉ๐ข๐ณ๐ซ๐ฆ๐ฆ โจ`.trim();
// Generate banner via Popcat API
const bannerUrl = `https://api.popcat.xyz/welcomecard` +
`?username=${encodeURIComponent(user.name)}` +
`&discriminator=${uid.slice(-4)}` +
`&avatar=${encodeURIComponent(avatarUrl)}` +
`&background=${encodeURIComponent("https://shipu.c0m.in/banner.png")}` +
`&color=${randomColor()}` +
`&text1=${encodeURIComponent(user.name)}` +
`&text2=${encodeURIComponent("API Ownerโ")}` +
`&text3=${encodeURIComponent("Chitron Bhattacharjee")}`;
return message.reply({
body: info,
attachment: await global.utils.getStreamFromURL(bannerUrl)
});
}
};
// Format large numbers with suffix
function formatMoney(num) {
const units = ["", "K", "M", "B", "T", "Q", "Qi", "Sx", "Sp", "Oc", "N"];
let unit = 0;
while (num >= 1000 && ++unit < units.length) num /= 1000;
return num.toFixed(1).replace(/\.0$/, "") + units[unit];
}
// Random color for banner
function randomColor() {
const colors = ["red", "blue", "purple", "green", "yellow", "pink", "orange", "aqua"];
return colors[Math.floor(Math.random() * colors.length)];
}