'Quick.db + Discord.js Leader Board

Hello I Was Making A Leader Board For My Xp System And The Points One Worked!

But The Mention Gives An Unknown Id And Its The Same Always

Here Is What It Shows

So The Code Is In Quick.db If You Can Help Me It Would Mean The World For Me

client.on('message', msg => {
    if(msg.content === prefix + "top") {
        let xp = db.all().filter(data => data.ID.startsWith(`guild_${msg.guild.id}_xp`)).sort((a, b) => b.data - a.data)
        xp.length = 10;
        var message= "";
        var i = 0;
        for (i in xp) {
          message += `${xp.indexOf(xp[i])+1}# | <@${xp[i].ID.split('_')[1]}> | ${xp[i].data}  \n`;
        }
            let embed = new Discord.MessageEmbed()
            .setAuthor(msg.author.username , msg.author.displayAvatarURL({dynamic:true}))
            .setColor('#FFD700')
            .addField(`Top Text Xp`, message)
            .setTimestamp()
            msg.channel.send(embed)
        }
})

So Yea Peace Out



Solution 1:[1]

message += `${xp.indexOf(xp[i])+1}# | <@${xp[i].ID.split('xp')[1]}> | ${xp[i].data} 

Just replace _ with xp. it will help.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Saeed Zhiany