LoggeL / AutoVoiceChannelBot

A discord bot to automatically create & remove voice channels
MIT License
4 stars 3 forks source link

Cannot read properties of undefined (reading 'cache') #4

Open VoDACode opened 6 months ago

VoDACode commented 6 months ago

I don't know how, but here

/var/servers/AutoVoiceChannelBot/node_modules/discord.js/src/client/actions/MessageCreate.js:11
      const existing = channel.messages.cache.get(data.id);
                                        ^
TypeError: Cannot read properties of undefined (reading 'cache')
    at MessageCreateAction.handle (/var/servers/AutoVoiceChannelBot/node_modules/discord.js/src/client/actions/MessageCreate.js:11:41)
    at module.exports [as MESSAGE_CREATE] (/var/servers/AutoVoiceChannelBot/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/var/servers/AutoVoiceChannelBot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/var/servers/AutoVoiceChannelBot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/var/servers/AutoVoiceChannelBot/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/var/servers/AutoVoiceChannelBot/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (/var/servers/AutoVoiceChannelBot/node_modules/ws/lib/websocket.js:1068:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (/var/servers/AutoVoiceChannelBot/node_modules/ws/lib/receiver.js:517:14)
Node.js v18.14.2
LoggeL commented 6 months ago

Seems like the messages didn't get cached. Using messages for commands is bad practice now anyway. When I do a rewrite I'll have to use commands. Haven't been working with Discord in a while tho.