Discord.JS-TypeError:无法读取未定义的属性“发送”

时间:2020-04-23 15:53:14

标签: node.js discord

bot.on('guildMemberAdd', member => { //message.guild.channels.find('name', 'logs')
    const embed = new MessageEmbed()
    //var channel = client.channels.cache.get("701096779990695977")
        .setColor('#0099ff')
        .setTitle('TEST')
        .addField('TESTOĞLU', member.nickname)
        .setImage(member.user.avatarURL)
    //channel.send(embed);
    //member.guild.channels.find('?whitelist-onay', 'logs').send({embed});
    //message.channel.send(embed);
    client.channels.cache.get('701096779990695977').send("embed");
})

请帮助我,我想在频道中发送欢迎消息(不一致)

1 个答案:

答案 0 :(得分:0)

是的,我做到了。这是代码。

bot.on('guildMemberAdd', member => { //message.guild.channels.find('name', 'logs')
    const channel = member.guild.channels.cache.find(ch => ch.name === '?whitelist-onay')
    const embed = new MessageEmbed()
        .setColor('#0099ff')
        .setTitle('TEST')
        .addField('TESTOĞLU', member.nickname)
        .setImage(member.user.avatarURL)
    //channel.send(embed);
    if (!channel) return;
    //member.guild.channels.find('?whitelist-onay', 'logs').send({embed});
    //message.channel.send(embed);
    channel.send(embed);
})