所以当新成员加入Guild[不和谐服务器]时。机器人应该在某个频道(ID = 766716351007686696)发送消息,向他们发送直接消息,然后添加角色(Human Bean)。这是我现在拥有的代码,它不起作用,底部有错误
client.on('guildMemberAdd', member =>{
const channel = message.guild.channels.cache.find(c => c.id === "766716351007686696")
const channelwelcomeEmbed = new Discord.MessageEmbed()
.setColor('#ffd6d6')
.setTitle('Welcome!')
.setDescription(`${member} just joined the discord! Make sure to read #rules!`)
.setTimestamp();
channel.send(channelwelcomeEmbed);
const dmwelcomeEmbed = new Discord.MessageEmbed()
.setColor('#ffd6d6')
.setTitle('Welcome!')
.setDescription("For Help Using @Pro Bot#7903, Send The Command `!help` In Server")
.setTimestamp();
member.send(dmwelcomeEmbed);
let role6 = message.guild.roles.cache.find(role => role.name == "Human Bean"); //BASIC ROLE, EVERYONE GETS IT
if(!role6) return message.reply("Couldn't find that Role .")
member.roles.add(role6);
});
错误消息是;
const channel = message.guild.channels.cache.find(c => c.id === "766716351007686696")
^
ReferenceError: message is not defined
慕虎7371278
慕标琳琳
相关分类