TypeError:无法读取未定义的属性“ send”不和谐

时间:2020-08-01 15:15:31

标签: javascript node.js discord discord.js

错误:

TypeError: Cannot read property 'send' of undefined

 let generalChannel = client.channels.cache.get("739065709132382261")
 generalChannel.send("Hello!")

我该如何解决?

1 个答案:

答案 0 :(得分:0)

据我所知,

client.channels.cache.get需要使用频道名称指定。因此,请尝试使用let generalChannel = client.channel.cache.get("ID")

来代替let generalChannel = client.channels.cache.find(channel => channel.name === "Name of the channel")