@@ -23,9 +23,17 @@ function Bot(options) {
2323
2424 this . server = options . server ;
2525 this . nickname = options . nickname ;
26- this . channelMapping = validateChannelMapping ( options . channelMapping ) ;
26+ this . channels = _ . values ( options . channelMapping ) ;
27+
28+ this . channelMapping = { } ;
29+
30+ // Remove channel passwords from the mapping
31+ _ . forOwn ( options . channelMapping , function ( ircChan , slackChan ) {
32+ this . channelMapping [ slackChan ] = ircChan . split ( ' ' ) [ 0 ] ;
33+ } , this ) ;
34+
2735 this . invertedMapping = _ . invert ( this . channelMapping ) ;
28- this . channels = _ . values ( this . channelMapping ) ;
36+
2937 this . autoSendCommands = options . autoSendCommands || [ ] ;
3038}
3139
@@ -37,7 +45,6 @@ Bot.prototype.connect = function() {
3745 realName : this . nickname ,
3846 channels : this . channels
3947 } ) ;
40-
4148 this . attachListeners ( ) ;
4249} ;
4350
@@ -116,6 +123,8 @@ Bot.prototype.sendToIRC = function(message) {
116123
117124 var channelName = channel . is_channel ? '#' + channel . name : channel . name ;
118125 var ircChannel = this . channelMapping [ channelName ] ;
126+
127+ logger . debug ( 'chan' , channelName , this . channelMapping [ channelName ] ) ;
119128 if ( ircChannel ) {
120129 var user = this . slack . getUserByID ( message . user ) ;
121130 var text = '<' + user . name + '> ' + this . parseText ( message . getBody ( ) ) ;
@@ -141,7 +150,7 @@ Bot.prototype.sendToSlack = function(author, channel, text) {
141150 parse : 'full' ,
142151 icon_url : 'http://api.adorable.io/avatars/48/' + author + '.png'
143152 } ;
144- logger . debug ( 'Sending message to Slack' , message ) ;
153+ logger . debug ( 'Sending message to Slack' , message , channel , '->' , slackChannelName ) ;
145154 slackChannel . postMessage ( message ) ;
146155 }
147156} ;
0 commit comments