我想知道如何将ID转换为会员。我要转换的ID在.JSON文件中。我有这个脚本:
if(message.content == "!fl leaderboard") {
embed = new Discord.MessageEmbed()
const c = Object.entries(db).sort((a, b)=> b[1].level - a[1].level)
for(const [key, value] of c) {
embed.addField(db[message.author.id].tag, `Level: ${value.level} | XP: ${value.xp}`)
}
message.channel.send(embed)
}
关卡系统的脚本为:https://hastebin.com/epucihenin.js
答案 0 :(得分:1)
const User = client.users.cache.get("userid");
if (!User) return console.error("Couldn't find the user"); // Note that the user must be in a Guild with your bot for this to work.
console.log(`I found the user ${User.username}.`);
答案 1 :(得分:0)