MCPcopy Create free account
hub / github.com/Slayer128/Carltech-Bot / getBottom10Users

Function getBottom10Users

lib/level.js:64–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62
63// Function to get the bottom 10 users by XP
64async function getBottom10Users() {
65 try {
66 const data = loadUserData();
67
68 // Convert data to an array of objects and sort by XP in ascending order
69 const sortedUsers = Object.keys(data)
70 .map(jid => ({ jid, xp: data[jid].xp, messages: data[jid].messages }))
71 .sort((a, b) => b.xp - a.xp)
72 .slice(0, 10); // Get top 10 users
73
74 return sortedUsers;
75 } catch (error) {
76 console.error("Error retrieving bottom 10 users:", error);
77 return []; // Return an empty array in case of error
78 }
79}
80
81module.exports = {
82 ajouterOuMettreAJourUserData,

Callers

nothing calls this directly

Calls 1

loadUserDataFunction · 0.85

Tested by

no test coverage detected