有人知道如何解决此问题吗?
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)
公共源代码:https://github.com/eartharoid/DiscordTickets
.setAuthor(`${client.user.username} / Ticket Log`, client.user.avatarURL)
.setColor("#2ECC71")
.setDescription(":white_check_mark: **Started succesfully**")
.setFooter(`DiscordTickets by Eartharoid`);
client.channels.get(config.logChannel).send(embed)
} else {
client.channels.get(config.logChannel).send(":white_check_mark: **Started succesfully**")
} ```
答案 0 :(得分:0)
您确定漫游器可以访问该频道吗?
这是因为,如果客户看不到频道,它将为您提供未定义的返回
您确定配置中的频道ID是字符串吗?
discord.js在ChannelManager.get()
方法中需要Snowflake
也许可以尝试使用此方法,而不是.get()
client.channels.fetch(config.logChannel)
这是ChannelManager附带的一种方法,据我所知,它基本上与Discord集合上的.get()
方法完全相同。
对不起,我的英语不太好,我竭尽所能地回答您的问题并提供一些解释! ?