ekmartin / slack-irc

Connects Slack and IRC channels by sending messages back and forth.
MIT License
588 stars 155 forks source link

Crash when reading text in IRC channel #262

Closed nlfog closed 5 years ago

nlfog commented 5 years ago

I've had this bot going for about a year now without issue. Today, I stopped and re-started it, and now it no longer works. I originally ran this in docker (benramsey/slack-irc), but when i started having this issue, I tried to re-run using it right from this repository and got the exact same error.

The bot will start and join IRC, but as soon as it detects something in my IRC channel, it crashes out with this:

default@venezia:~/appdata/slackirc$ slack-irc --config config.json 
/usr/local/lib/node_modules/slack-irc/node_modules/irc/lib/irc.js:849
                        throw err;
                        ^

TypeError: Cannot read property 'map' of undefined
    at Bot.sendToSlack (/usr/local/lib/node_modules/slack-irc/dist/bot.js:295:60)
    at emitMany (events.js:147:13)
    at Client.emit (events.js:224:7)
    at Client.<anonymous> (/usr/local/lib/node_modules/slack-irc/node_modules/irc/lib/irc.js:557:22)
    at emitOne (events.js:116:13)
    at Client.emit (events.js:211:7)
    at iterator (/usr/local/lib/node_modules/slack-irc/node_modules/irc/lib/irc.js:846:26)
    at Array.forEach (<anonymous>)
    at Socket.handleData (/usr/local/lib/node_modules/slack-irc/node_modules/irc/lib/irc.js:841:15)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:246:13)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at TCP.onread (net.js:607:20)
default@venezia:~/appdata/slackirc$ 
nlfog commented 5 years ago

Looks like it was an issue with the bot joining a private channel for some reason. Once I deleted the channel, re-created it as public, and edited the config file to add the '#' to the channel mapping, it worked again.