matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
810 stars 151 forks source link

Each message in a Discord voice channels crashes the bridge #906

Open schrmh opened 1 year ago

schrmh commented 1 year ago

Literally the title. It is reproducable, I tried it several times and it worked every time... My bridge is only a few days old and only active for one guild.

/home/user/matrix-appservice-discord/node_modules/@mx-puppet/better-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 (/home/user/matrix-appservice-discord/node_modules/@mx-puppet/better-discord.js/src/client/actions/MessageCreate.js:11:41)
    at Object.module.exports (/home/user/matrix-appservice-discord/node_modules/@mx-puppet/better-discord.js/src/client/websocket/handlers/MESSAGE_CREATE.js:4:32)
    at WebSocketManager.handlePacket (/home/user/matrix-appservice-discord/node_modules/@mx-puppet/better-discord.js/src/client/websocket/WebSocketManager.js:391:31)
    at WebSocketShard.onPacket (/home/user/matrix-appservice-discord/node_modules/@mx-puppet/better-discord.js/src/client/websocket/WebSocketShard.js:451:22)
    at WebSocketShard.onMessage (/home/user/matrix-appservice-discord/node_modules/@mx-puppet/better-discord.js/src/client/websocket/WebSocketShard.js:308:10)
    at WebSocket.onMessage (/home/user/matrix-appservice-discord/node_modules/ws/lib/event-target.js:132:16)
    at WebSocket.emit (node:events:514:28)
    at Receiver.receiverOnMessage (/home/user/matrix-appservice-discord/node_modules/ws/lib/websocket.js:1068:20)
    at Receiver.emit (node:events:514:28)
    at Receiver.dataMessage (/home/user/matrix-appservice-discord/node_modules/ws/lib/receiver.js:517:14)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Maybe a bit related to #883 but the difference is that it happens in channel.messages.cache.get for me and manager.cache.get there.

Any ideas for a workaround? Would using a newer discord.js help? (t2bot does that: https://github.com/t2bot/matrix-appservice-discord/commit/2603f94c5c306e43a77a0917490034acfb9664e0)

Mrs-Feathers commented 9 months ago

i know this isn't what you want to hear, but our server simply disabled messages in voice channels.