goat
command
spy
Deep dive into user stats
0
views
0
likes
0
installs
raw source
module.exports = {
config: {
name: "spy",
version: "1.5",
author: "xalman",
role: 0,
countDown: 5,
shortDescription: "Deep dive into user stats",
longDescription: "Fetch complete profile details including UID, balance, level, rank, location, with reactions.",
category: "utility",
},
onStart: async function ({ event, message, api, usersData, args }) {
const requesterID = event.senderID;
const mentionIDs = Object.keys(event.mentions || {});
let targetID = mentionIDs[0];
api.setMessageReaction(event.messageID, "๐", () => {}, true);
if (args[0]) {
const numeric = /^\d+$/.test(args[0]) ? args[0] : null;
const linkMatch = args[0].match(/profile\.php\?id=(\d+)/);
targetID = numeric || (linkMatch ? linkMatch[1] : targetID);
}
if (!targetID) targetID = event.type === "message_reply" ? event.messageReply.senderID : requesterID;
try {
const fbData = await new Promise((resolve, reject) => {
api.getUserInfo(targetID, (err, result) => (err ? reject(err) : resolve(result)));
});
const avatarLink = `https://graph.facebook.com/${targetID}/picture?width=512&height=512&access_token=350685531728|62f8ce9f74b12f84c123cc23437a4a32`;
const userRecord = await usersData.get(targetID);
const requesterRecord = await usersData.get(requesterID);
const requesterName = requesterRecord.name || "Friend";
const fullName = fbData[targetID].name || "N/A";
const genderStr = fbData[targetID].gender === 1 ? "Female" : fbData[targetID].gender === 2 ? "Male" : "Unknown";
const isFriend = fbData[targetID].isFriend ? "โ
Yes" : "โ No";
const birthday = fbData[targetID].isBirthday ? "๐ Today!" : "๐ Hidden";
const balance = userRecord.money || 0;
const xp = userRecord.exp || 0;
const lvl = Math.floor(Math.sqrt(xp) * 0.1);
const threadInfo = event.threadID ? await api.getThreadInfo(event.threadID) : {};
const nickname = threadInfo.nicknames?.[targetID] || "โ";
const location = fbData[targetID].hometown_name || "Unknown";
const allUsers = await usersData.getAll();
const rankIdx = allUsers
.filter(u => typeof u.money === "number")
.sort((a, b) => b.money - a.money)
.findIndex(u => u.userID === targetID);
const rank = rankIdx !== -1 ? `#${rankIdx + 1}` : "โ";
const cardMessage = `
โโโโโโโโโโโโโโโโโโโโโโ
โ ๐ PROFILE CARD โฆ๏ธ
โโโโโโโโโโโโโโโโโโโโโโ
๐ค Name : ${fullName}
๐ฌ Nickname : ${nickname}
๐ UID : ${targetID}
๐ธ Balance : $${balance}
โก XP : ${xp}
๐ Level : ${lvl}
๐
Rank : ${rank}
โง Gender : ${genderStr}
๐ Birthday : ${birthday}
๐ Location : ${location}
๐ค Friend : ${isFriend}
๐ Relation : Single
๐ Profile : https://www.facebook.com/${targetID}
โจ Requested by: ${requesterName}
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
`;
await message.reply({
body: cardMessage,
attachment: await global.utils.getStreamFromURL(avatarLink),
});
api.setMessageReaction(event.messageID, "โ
", () => {}, true);
} catch (err) {
console.error(err);
return message.reply("โ ๏ธ Could not retrieve profile info. Try again later!");
}
},
};