creesch / discordIRCd

A node.js script that allows you to connect to discord with your irc client.
Apache License 2.0
115 stars 21 forks source link

discordIRCd crashes when a channel it's on is renamed #29

Closed rctgamer3 closed 7 years ago

rctgamer3 commented 7 years ago

Title.

Scrxtchy commented 7 years ago

Could be handled with a SAJOIN I assume

creesch commented 7 years ago

Shouldn't do that, in fact doesn't for me. What it is supposed to do is leave a message in the current channel informing the user the channel has been renamed and then make the user leave the current channel and join the newly created channel.

Got any logging for me?

rctgamer3 commented 7 years ago
debug Sending heartbeat
debug Heartbeat acknowledged
channel updated
channel name changed from #shakespeare to #the-ballpit
/home/rctgamer3/discordIRCd/server.js:625
            if (socket.discordid === discordServerId && ircDetails[discordServerId].channels[oldChannel.name].joined.indexOf(socket.ircid) > -1) {
                                                                                                             ^

TypeError: Cannot read property 'joined' of undefined
    at /home/rctgamer3/discordIRCd/server.js:625:110
    at Array.forEach (native)
    at Client.<anonymous> (/home/rctgamer3/discordIRCd/server.js:624:20)
    at emitTwo (events.js:106:13)
    at Client.emit (events.js:194:7)
    at ChannelUpdateAction.handle (/home/rctgamer3/discordIRCd/node_modules/discord.js/src/client/actions/ChannelUpdate.js:13:14)
    at ChannelUpdateHandler.handle (/home/rctgamer3/discordIRCd/node_modules/discord.js/src/client/websocket/packets/handlers/ChannelUpdate.js:7:34)
    at WebSocketPacketManager.handle (/home/rctgamer3/discordIRCd/node_modules/discord.js/src/client/websocket/packets/WebSocketPacketManager.js:120:65)
    at WebSocketManager.eventMessage (/home/rctgamer3/discordIRCd/node_modules/discord.js/src/client/websocket/WebSocketManager.js:273:31)
    at WebSocket.onMessage (/home/rctgamer3/discordIRCd/node_modules/ws/lib/WebSocket.js:442:14)
creesch commented 7 years ago

Hrm.... That would be this line.

https://github.com/creesch/discordIRCd/blob/master/server.js#L625

It seems that in this instance both the channel name changed and the topic a situation I didn't think about but can obviously occur.