3
0
mirror of https://github.com/reality/dbot.git synced 2024-11-27 14:29:29 +01:00

fix NICK without talking

This commit is contained in:
reality 2013-12-29 11:09:00 +00:00
parent 8e734d895f
commit 6d28aa272b

View File

@ -189,7 +189,7 @@ var users = function(dbot) {
} }
}.bind(this); }.bind(this);
if(event.user && event.channel && _.include(['JOIN', 'MODE', 'PRIVMSG', 'NICK'], event.action)) { if(event.user && event.channel && _.include(['JOIN', 'MODE', 'PRIVMSG'], event.action)) {
checkChannel(function(channel) { checkChannel(function(channel) {
event.rChannel = channel; event.rChannel = channel;
checkUser(function(user) { checkUser(function(user) {
@ -207,15 +207,20 @@ var users = function(dbot) {
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));
} else if(event.user) { } else if(event.user) {
this.api.resolveUser(event.server, event.user, function(user) { checkUser(function(user) { // TODO: remove code repeating (is there any reason we can't do this in the first place hmm)
if(user) event.rUser = user; event.rUser = user;
if(!_.has(this.userCache[event.server], event.rUser.currentNick)) {
this.userCache[event.server][event.rUser.currentNick] = event.rUser.id;
} else if(this.userCache[event.server][event.rUser.currentNick] != event.rUser.id) {
this.userCache[event.server][event.rUser.currentNick] = event.rUser.id;
}
if(event.channel) { if(event.channel) {
this.api.resolveChannel(event.server, event.channel.name, function(channel) { this.api.resolveChannel(event.server, event.channel.name, function(channel) {
if(channel) event.rChannel = channel; if(channel) event.rChannel = channel;
callback(); callback();
}); });
} else {
callback();
} }
}.bind(this)); }.bind(this));
} }