reactiflux / discord-irc

Connects Discord and IRC channels by sending messages back and forth.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sending any message in a voice channel text channel crashes this application

d223chen opened this issue · comments

Voice channels have accompanying text channels. It seems these do not have message caches, so sending a message in here crashes the discord.js module and thus the entire application. Would this be patchable here or does it need to be fixed in the discord.js module itself?

/usr/local/lib/node_modules/discord-irc/node_modules/discord.js/src/client/actions/MessageCreate.js:11
      const existing = channel.messages.cache.get(data.id);
                                        ^

TypeError: Cannot read property 'cache' of undefined
    at MessageCreateAction.handle (/usr/local/lib/node_modules/discord-irc/node_modules/discord.js/src/client/actions/MessageCreate.js:11:41)
    at Object.module.exports [as MESSAGE_CREATE] (/usr/local/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/usr/local/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/usr/local/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/usr/local/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/usr/local/lib/node_modules/discord-irc/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (/usr/local/lib/node_modules/discord-irc/node_modules/ws/lib/websocket.js:1068:20)
    at Receiver.emit (events.js:198:13)
    at Receiver.dataMessage (/usr/local/lib/node_modules/discord-irc/node_modules/ws/lib/receiver.js:517:14)
commented

Yep:

2023-02-20T05:28:58.866Z warn: Received warn event from Discord Discord sent a typing packet to a voice channel 848707213451067392
/usr/lib/node_modules/discord-irc/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 (/usr/lib/node_modules/discord-irc/node_modules/discord.js/src/client/actions/MessageCreate.js:11:41)
    at module.exports [as MESSAGE_CREATE] (/usr/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/usr/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/WebSocketManager.js:384:31)
    at WebSocketShard.onPacket (/usr/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/WebSocketShard.js:444:22)
    at WebSocketShard.onMessage (/usr/lib/node_modules/discord-irc/node_modules/discord.js/src/client/websocket/WebSocketShard.js:301:10)
    at WebSocket.onMessage (/usr/lib/node_modules/discord-irc/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (node:events:513:28)
    at Receiver.receiverOnMessage (/usr/lib/node_modules/discord-irc/node_modules/ws/lib/websocket.js:983:20)
    at Receiver.emit (node:events:513:28)
    at Receiver.dataMessage (/usr/lib/node_modules/discord-irc/node_modules/ws/lib/receiver.js:517:14)

Node.js v18.14.0

Looks like it's discord.js that's having the issue, so... probably update discord.js? I'll report back on this.

Edit: Reporting back -- still crashes after updating discord.js.

commented

I've posted an upstream issue in discord.js here so hopefully this'll get fixed relatively quickly since it seems to be a discord.js issue.

Edit: They said it was due to discord.js being a pinned version on discord-irc and so needs to be fixed here.

I upgraded it to v14
#632