// code from goatstore // api: https://store.agi.bd module.exports = { config: { name: "top", aliases: ["tp"], version: "1.0", author: "MR_FARHAN", role: 0, shortDescription: { en: "Top 30 Rich Users" }, longDescription: { en: "Displays the top 30 richest users in terms of money with formatted values" }, category: "group", guide: { en: "{pn}" } }, onStart: async function ({ api, args, message, event, usersData }) { function formatMoney(amount) { if (amount >= 1e9) return `${(amount / 1e9).toFixed(2)} BπŸ’΅`; if (amount >= 1e6) return `${(amount / 1e6).toFixed(2)} MπŸ’΅`; if (amount >= 1e3) return `${(amount / 1e3).toFixed(2)} KπŸ’΅`; return amount.toString(); } const allUsers = await usersData.getAll(); const topUsers = allUsers.sort((a, b) => b.money - a.money).slice(0, 15); const topUsersList = topUsers.map( (user, index) => `${index + 1}. πŸŽ€ ${user.name}: πŸ’Έ ${formatMoney(user.money)} πŸ’΅` ); const messageText = `πŸŽ‰ π™π™Šπ™‹ 15 π™π™„π˜Ύπ™ƒπ™€π™Žπ™ π™π™Žπ™€π™π™Ž πŸŽ‰\n \n${topUsersList.join('\n \n')}\n\nπŸŒŸπ™Ίπ™΄π™΄π™Ώ 𝙀𝙰𝙍𝙉𝙄𝙉𝙢 π™π™Š π™²π™‡π™„π™ˆπ™— 𝙏𝙃𝙀 π™π™π™‰π™†π™ŽπŸŒŸ`; message.reply(messageText); } };