我有一个欢迎消息机器人,它会在每次有人加入时发送欢迎消息,但有时,它会在控制台中抛出一条错误消息:
member.guild.channels.cache.find(ch => ch.name === "・𝘪𝘮𝘴𝘨").send(exampleEmbed).catch(e => co nsole.error(`Welcome Error in ${message.guild.name}`) | message.channel.send("__**ERROR:**__ ** Someone joined the server but I was
le to catch it.**"));
^
TypeError: Cannot read property 'send' of undefined
代码:
client.on('guildMemberAdd', member => {
const exampleEmbed = new Discord.MessageEmbed()
.setColor('RANDOM')
.setTitle(`Welcome to lovell <$, **${member.user.username}**`)
.setImage('https://images-ext-1.discordapp.net/external/Gy-micqoX7qrlivnytbmFgfTbxPx_CSvgChFLE3qC7g/https/media.discordapp.net/attachments/755425128635957348/758525058934767617/HaxzUWa46sK5CXKzIR.gif')
.setFooter('Boost Us');
member.guild.channels.cache.find(ch => ch.name === "・𝘪𝘮𝘴𝘨").send(exampleEmbed).catch(e => console.error(`Welcome Error in ${message.guild.name}`) | message.channel.send("__**ERROR:**__ ** Someone joined the server but I was unable to catch it.**"));
})
我将如何解决这个问题?
隔江千里
一只萌萌小番薯
慕码人2483693
相关分类