I am using quick.db for a Leaderboard command. It can show clearly the statistics ( you can see from the image that there are someone with 5 wins, etc). However, it cannot show the correct name-tag of that user. It is undefined.
const resp = await db.startsWith("money", { sort: ".data" });
resp.length = 10;
let finalOutput = " ";
for (var i in resp) {
finalOutput += `**${message.guild.members.cache.get(resp[i].ID.split("_")[1]).tag}** ~-~ ${resp[i].data} wins \n`;
}
const embed = new Discord.MessageEmbed()
.setDescription(`${finalOutput}`)
.setColor("#ffffff")
message.channel.send(embed);
The above is my code. Is the message.guild.members.cache.get
part wrong? If yes, what shall it be? Thank you very much.