类型错误:无法读取 ClientDataManager.newChannel ClientDataManager.js:81:36 处未定义的属性“id”

时间:2021-03-31 21:46:33

标签: javascript node.js discord

我的 node.js discord bot(基于 discord.js)在一小时前突然关闭,现在在启动时产生错误。

Bot started!

Found 3 commands, loading.

/var/www/bot/live/node_modules/discord.js/src/client/ClientDataManager.js:81
        guild.channels.set(channel.id, channel);
                                   ^

TypeError: Cannot read property 'id' of undefined
    at ClientDataManager.newChannel (/var/www/bot/live/node_modules/discord.js/src/client/ClientDataManager.js:81:36)
    at Guild.setup (/var/www/bot/live/node_modules/discord.js/src/structures/Guild.js:307:68)
    at GuildCreateHandler.handle (/var/www/bot/live/node_modules/discord.js/src/client/websocket/packets/handlers/GuildCreate.js:12:15)
    at WebSocketPacketManager.handle (/var/www/bot/live/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:108:65)
    at WebSocketConnection.onPacket (/var/www/bot/live/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:336:35)
    at WebSocketConnection.onMessage (/var/www/bot/live/node_modules/discord.js/src/client/websocket/WebSocketConnection.js:299:17)
    at WebSocket.onMessage (/var/www/bot/live/node_modules/ws/lib/event-target.js:120:16)
    at WebSocket.emit (events.js:315:20)
    at Receiver.receiverOnMessage (/var/www/bot/live/node_modules/ws/lib/websocket.js:789:20)
    at Receiver.emit (events.js:315:20)

这就是我所看到的。该脚本执行整个加载方法,然后就崩溃了。 而且我什至没有使用任何频道信息。

知道这可能是什么吗?

没有任何更新。服务器和机器人已经一个月没有动过了,而且工作完美。

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。

这个问题似乎是由新的“舞台频道”功能引起的,因为在我的服务器上删除它为我解决了这个问题,我的机器人开始正常。但我是新手,所以我不确定是否可以在代码中修复它。