Javascript TypeError:无法读取属性';发送';未定义discord bot的定义
有人知道如何解决这个问题吗Javascript TypeError:无法读取属性';发送';未定义discord bot的定义,javascript,typeerror,discord,send,Javascript,Typeerror,Discord,Send,有人知道如何解决这个问题吗 client.channels.get(config.logChannel).send(embed) ^ TypeError: Cannot read property 'send' of undefined at Client.client.once (/home/fynn/DiscordTickets/server.js:119:43) at Object
client.channels.get(config.logChannel).send(embed)
^
TypeError: Cannot read property 'send' of undefined
at Client.client.once (/home/fynn/DiscordTickets/server.js:119:43)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at Client.emit (events.js:208:7)
at WebSocketConnection.triggerReady (/home/fynn/DiscordTickets/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:128:17)
at WebSocketConnection.checkIfReady (/home/fynn/DiscordTickets/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:144:61)
at ReadyHandler.handle (/home/fynn/DiscordTickets/node_modules/discord.js/src/client/websocket/packets/handlers/Ready.js:80:8)
at WebSocketPacketManager.handle (/home/fynn/DiscordTickets/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
at WebSocketConnection.onPacket (/home/fynn/DiscordTickets/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
at WebSocketConnection.onMessage (/home/fynn/DiscordTickets/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
公共源代码:
您确定机器人可以访问该频道吗?
这是因为如果客户端无法看到通道,它将返回一个未定义的返回 您确定配置中频道的ID是字符串吗?
discord.js在
ChannelManager.get()方法中需要一个
也许可以试试这个,而不是.get()
client.channels.fetch(config.logChannel)
这是ChannelManager附带的一种方法,据我所知,它与Discord集合上的.get()
方法基本相同
对不起,我的英语不太好,我尽我所能回答你的问题与一些解释 您确定机器人可以访问该频道吗?
这是因为如果客户端无法看到通道,它将返回一个未定义的返回
您确定配置中频道的ID是字符串吗?
discord.js在ChannelManager.get()方法中需要一个
也许可以试试这个,而不是.get()
client.channels.fetch(config.logChannel)
这是ChannelManager附带的一种方法,据我所知,它与Discord集合上的.get()
方法基本相同
对不起,我的英语不太好,我尽我所能回答你的问题与一些解释!