Haiyn / xenon-the-antiquarian-bot

GNU General Public License v3.0
0 stars 0 forks source link

missing channel messages in MessageCreate crashes bot #180

Closed Haiyn closed 1 year ago

Haiyn commented 1 year ago
2023-02-15 15:04:32.512  INFO [Base Logger  undefined.<anonymous>] Interaction ID 1075432431227777044: Application Command qotd was  executed: Inserted one new question model. 
2023-02-15 15:05:10.850  DEBUG [Base Logger dist/controllers/interaction-controller.js:16  __awaiter] Matching command for command name: qotd... 
2023-02-15 15:05:10.851  INFO [Command Logger dist/commands/misc/qotd.js:31  Qotd.run] Saving new question to database. 
2023-02-15 15:05:11.222  INFO [Base Logger  undefined.<anonymous>] Interaction ID 1075432592947548250: Application Command qotd was  executed: Inserted one new question model. 
/usr/xenon/node_modules/discord.js/src/client/actions/MessageCreate.js:13
      const existing = channel.messages.cache.get(data.id);
                                        ^

TypeError: Cannot read properties of undefined (reading 'cache')
    at MessageCreateAction.handle (/usr/xenon/node_modules/discord.js/src/client/actions/MessageCreate.js:13:41)
    at Object.module.exports [as MESSAGE_CREATE] (/usr/xenon/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/usr/xenon/node_modules/discord.js/src/client/websocket/WebSocketManager.js:345:31)
    at WebSocketShard.onPacket (/usr/xenon/node_modules/discord.js/src/client/websocket/WebSocketShard.js:443:22)
    at WebSocketShard.onMessage (/usr/xenon/node_modules/discord.js/src/client/websocket/WebSocketShard.js:300:10)
    at WebSocket.onMessage (/usr/xenon/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (node:events:390:28)
    at Receiver.receiverOnMessage (/usr/xenon/node_modules/ws/lib/websocket.js:1068:20)
    at Receiver.emit (node:events:390:28)
    at Receiver.dataMessage (/usr/xenon/node_modules/ws/lib/receiver.js:517:14)
Haiyn commented 1 year ago