简体   繁体   中英

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

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

Just replace _ with xp . it will help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM