我正在尝试获取用户头像以显示欢迎消息,但是当有人加入时,它永远不会显示。我尝试了许多不同的方法。这是我当前的代码。
bot.on('guildMemberAdd', member => {
const exampleEmbed = new MessageEmbed()
.setColor('#0000FF')
.addField('Welcome!', `Welcome to the server, ${member}! Go to <#channel> for the rules, then grab some roles at <#channel>!`)
.setThumbnail(member.user.displayAvatarURL)
member.guild.channels.cache.get('693219932904751177').send(exampleEmbed);
});
答案 0 :(得分:2)
在最近的更新中,方法displayAvatarURL已更改为displayAvatarURL()
bot.on('guildMemberAdd', member => {
const exampleEmbed = new MessageEmbed()
.setColor('#0000FF')
.addField('Welcome!', `Welcome to the server, ${member}! Go to <#channel> for the rules, then grab some roles at <#channel>!`)
.setThumbnail(`${member.user.displayAvatarURL()}`)
member.guild.channels.cache.get('693219932904751177').send(exampleEmbed);
});
答案 1 :(得分:1)
您需要做的所有事情都在()
后面添加了.displayAvatarURL
所以这行看起来像这样:
.setThumbnail(member.user.displayAvatarURL())