几天前,我制作了一个代码来在用户加入我的不和谐服务器时提及他们,这是我目前拥有的代码:
bot.on( "guildMemberAdd", member => {
let textChannel = member.guild.channels.find(channel => channel.id === '569582472812298240');
if (textChannel){
var messages = [
`Brace yourselves. <@${member.user.id}> just joined the server.`,
`Challenger approaching - <@${member.user.id}> has appeared`,
`Welcome <@${member.user.id}>. Leave your weapon by the door.`,
`Big <@${member.user.id}> showed up!`,
`<@${member.user.id}> just joined... or did they?`,
`Ready player <@${member.user.id}>`,
`<@${member.user.id}> hopped into the server. Kangaroo!!`,
`<@${member.user.id}> joined. You must construct additional pylons.`,
`Hello. Is it <@${member.user.id}> you're looking for?`,
`Where's <@${member.user.id}> in the server!`,
`It's dangerous to go alone, take <@${member.user.id}>`
]
textChannel.send({embed: {
color: 3447003,
description: messages[ Math.floor( Math.random() * 11 ) ],
timestamp: new Date(),
}
});
}
});
问题?有时我得到这个人的正确昵称,正如你在这张照片中看到的那样,但有时我得到的只是数字,我什至无法点击那个“链接”......
正确方法:
他们是可点击的,我可以看到他们的个人资料。
错误的方式:
我无法点击他们的 id,对此无能为力。
不知道为什么会随机发生,任何帮助将不胜感激。