Discord.js TypeError:无法读取属性';获取';未定义的

Discord.js TypeError:无法读取属性';获取';未定义的,discord.js,Discord.js,收到一条消息“TypeError:无法读取未定义的属性'get'”无论我输入了什么通道id,这都是我的代码(非常简单的atm) 我做错了吗?我尝试了。find(“name”,“channel_name”)得到了相同的错误,并尝试了控制台日志作为“cache”,得到了awnser“undefined”,因为这是我的机器人的一个关键功能,可以缩写为在特定的频道发布,这很烦人…^^ 谢谢你的帮助,我会继续努力的^…^ 您需要使用.cache访问帮会频道,这样它将是user.guild.channels

收到一条消息“TypeError:无法读取未定义的属性'get'”无论我输入了什么通道id,这都是我的代码(非常简单的atm)

我做错了吗?我尝试了
。find(“name”,“channel_name”)
得到了相同的错误,并尝试了控制台日志作为“cache”,得到了awnser“undefined”,因为这是我的机器人的一个关键功能,可以缩写为在特定的频道发布,这很烦人…^^
谢谢你的帮助,我会继续努力的^…^

您需要使用
.cache
访问帮会频道,这样它将是
user.guild.channels.cache.get(“[existing channel ID]”)。发送(“SomeText”)

您可以测试:

bot.on('guildMemberAdd',user => {
     const channelWelcome = user.guild.channels.cache.get("[channel's ID]"
     channelWelcome.send("Your text")
});
bot.on('guildMemberAdd',user => {
     const channelWelcome = user.guild.channels.cache.get("[channel's ID]"
     channelWelcome.send("Your text")
});