Closed shizofreniya closed 4 years ago
Hello, issues happens by itself.
TypeError: Cannot read property 'cache' of undefined
at Client.<anonymous> (/root/shiza/bot/node_modules/discord.js-light/client.js:545:43)
at Client.emit (events.js:327:22)
at WebSocketShard.onMessage (/root/shiza/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:287:27)
at WebSocket.onMessage (/root/shiza/bot/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (/root/shiza/bot/node_modules/ws/lib/websocket.js:800:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (/root/shiza/bot/node_modules/ws/lib/receiver.js:427:14)
at Receiver.getData (/root/shiza/bot/node_modules/ws/lib/receiver.js:366:17)
at Receiver.startLoop (/root/shiza/bot/node_modules/ws/lib/receiver.js:142:22)
TypeError: Cannot read property 'cache' of undefined
at Client.<anonymous> (/root/shiza/bot/node_modules/discord.js-light/client.js:527:43)
at Client.emit (events.js:327:22)
at WebSocketShard.onMessage (/root/shiza/bot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:287:27)
at WebSocket.onMessage (/root/shiza/bot/node_modules/ws/lib/event-target.js:125:16)
at WebSocket.emit (events.js:315:20)
at Receiver.receiverOnMessage (/root/shiza/bot/node_modules/ws/lib/websocket.js:800:20)
at Receiver.emit (events.js:315:20)
at Receiver.dataMessage (/root/shiza/bot/node_modules/ws/lib/receiver.js:427:14)
at Receiver.getData (/root/shiza/bot/node_modules/ws/lib/receiver.js:366:17)
at Receiver.startLoop (/root/shiza/bot/node_modules/ws/lib/receiver.js:142:22)
Are these two errors from two different versions? It appears they are both coming from channelDelete but in two different versions from what i can see, so the line of the error is different.
While your PR would most definitely work, it would be more appropriate to be consistent with discord.js's original code:
if(channel.messages && !(channel instanceof Discord.DMChannel)) {
for(let message of channel.messages.cache.values()) {
message.deleted = true;
}
}
If you remove the channelUpdate changes and make this change in channelDelete i will merge, otherwise i can update it myself if you prefer
Hello, could you provide some context? What issue does this fix and when/how does the issue happen?
I can understand the change in the channelDelete event, but i dont understand the change in the channelUpdate event, could you explain it? The only possible type change is between text channel and news channel, both of which contain messages.