我正在尝试在我的不和谐音中创建一个" Welcome"消息,当新用户登录时,由于某种原因它不能工作,没有错误消息等。附上代码,我真的很想帮忙。
client.on('GulidMemberAdd', (member) => { console.error("work?")
let channelId = '814448374790225980';
let embed = new Discord.MessageEmbed()
.setTitle('member joined!')
.setDescription('${member.user.tag} join')
.setTimestamp()
client.channels.cache.get(channelId).send(embed)
})
你的代码中有两个错别字
client.on('gulidMemberAdd', (member) => {
// ~~~~~ should be guild
let channelId = '814448374790225980';
let embed = new Discord.MeesageEmbed()
// ~~~~~~~ should be Message
.setTitle('member joined!')
// ~ ~ Should be a template literal string
.setDescription('${member.user.tag} join')
.setTimestamp()
client.channels.cache.get(channelId).send(embed)
})
固定版本:
client.on('guildMemberAdd', (member) => {
let channelId = '814448374790225980';
let embed = new Discord.MessageEmbed()
.setTitle('member joined!')
.setDescription(`${member.user.tag} join`)
.setTimestamp()
client.channels.cache.get(channelId).send(embed)
})