#Bot keeps crashing
26 messages · Page 1 of 1 (latest)
@honest apex posted:
My bot has started to crash a little bit after starting up, this is the error:
27.11 19:25:31 [Bot] /node_modules/discord.js/src/client/actions/MessageCreate.js:11
27.11 19:25:31 [Bot] const existing = channel.messages.cache.get(data.id);
27.11 19:25:31 [Bot] ^
27.11 19:25:31 [Bot] TypeError: Cannot read property 'cache' of undefined
27.11 19:25:31 [Bot] at MessageCreateAction.handle (/node_modules/discord.js/src/client/actions/MessageCreate.js:11:41)
27.11 19:25:31 [Bot] at Object.module.exports [as MESSAGE_CREATE] (/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
27.11 19:25:31 [Bot] at WebSocketManager.handlePacket (/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
27.11 19:25:31 [Bot] at WebSocketShard.onPacket (/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
27.11 19:25:31 [Bot] at WebSocketShard.onMessage (/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
27.11 19:25:31 [Bot] at WebSocket.onMessage (/node_modules/ws/lib/event-target.js:132:16)
27.11 19:25:31 [Bot] at WebSocket.emit (events.js:310:20)
27.11 19:25:31 [Bot] at Receiver.receiverOnMessage (/node_modules/ws/lib/websocket.js:835:20)
27.11 19:25:31 [Bot] at Receiver.emit (events.js:310:20)
27.11 19:25:31 [Bot] at Receiver.dataMessage (/node_modules/ws/lib/receiver.js:437:14)
27.11 19:25:31 [PebbleHost] Server shut down (running)
27.11 19:25:31 [PebbleHost] Server stopped
Any help is appreciated! Ive been using this bot for a good year or so without issue
send the code (this is not an hosting error)
The cache function is outdated and you shouldn’t use that
If you are on v14 of discord.js most likely your bot is coded for v13
what area would you like to see?
im unsure, it was a long time ago when i developed this bot, is there any specific way to check?
Then its most likely v13. Either recode your bot for v14 or switch to v13 of discord.js in the server
okay thank you! by switch to v13 in the server do you mean the actual discord server or in vsc?
i just checked, its discord.js 12.5.3
should I update it to 13?
yes try that
running "npm install discord.js" will update to v14 right? is there a way to only do 13?
No https://images.bas-tech.support/LvrQ on the package manager you need to select the correct version
Most likely the server has 14.* installed