Skip to content

Commit

Permalink
small fix for multiple 353
Browse files Browse the repository at this point in the history
  • Loading branch information
reality committed Jul 18, 2017
1 parent 7af6b74 commit 4e6af64
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions jsbot.js
Expand Up @@ -424,7 +424,7 @@ JSBot.prototype.addDefaultListeners = function() {
// QUIT
this.addListener('QUIT', 'quitname', function(event) {
_.each(event.allChannels, function(channel) {
delete event.channel.nicks[event.user];
delete event.allChannels[channel].nicks[event.user];
});
});

Expand Down Expand Up @@ -472,17 +472,20 @@ JSBot.prototype.addDefaultListeners = function() {

// 353 replies
this.addListener('353', 'names', function(event) {
if(_.has(this.connections[event.server].channels, event.channel) == false) {

if(!_.has(this.connections[event.server].channels, event.channel)) {
this.connections[event.server].channels[event.channel] = {
'name': event.channel,
'nicks': {},
'toString': function() {
return this.name;
}
};
event.channel = this.connections[event.server].channels[event.channel];

}

event.channel = this.connections[event.server].channels[event.channel];

for(var i=0; i < event.params.length; ++i) {
var hasFlag = '~&@%+'.indexOf(event.params[i][0]) != -1,
name = hasFlag ? event.params[i].slice(1) : event.params[i];
Expand Down

0 comments on commit 4e6af64

Please sign in to comment.