mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
that will soh wye
This commit is contained in:
parent
a4a6689d38
commit
2204c910b9
@ -24,12 +24,18 @@ var api = function(dbot) {
|
||||
}
|
||||
|
||||
if(result.primaryNick == nick || _.include(result.aliases, nick)) {
|
||||
this.userCache[server][nick] = result.id;
|
||||
user = result;
|
||||
}
|
||||
}.bind(this), function(err) {
|
||||
if(user) {
|
||||
if(!_.has(this.userCache[server], nick)) {
|
||||
this.userCache[server][nick] = user.id;
|
||||
} else if(this.userCache[server][nick] !== user.id) {
|
||||
this.userCache[server][nick] = user.id;
|
||||
}
|
||||
}
|
||||
callback(user);
|
||||
});
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -97,7 +97,6 @@ var users = function(dbot) {
|
||||
this.listener = function(event) {
|
||||
this.api.isKnownUser(event.server, event.newNick, function(isKnown) {
|
||||
event.rUser.currentNick = event.newNick;
|
||||
dbot.api.event.emit('new_current_nick', [ event.rUser ]);
|
||||
|
||||
if(!isKnown) {
|
||||
event.rUser.aliases.push(event.newNick);
|
||||
@ -120,6 +119,7 @@ var users = function(dbot) {
|
||||
// 6. Update staff channel lists
|
||||
|
||||
var checkChannel = function(done) {
|
||||
if(event.channel) {
|
||||
this.api.resolveChannel(event.server, event.channel.name, function(channel) {
|
||||
if(!channel) {
|
||||
this.internalAPI.createChannel(event.server, event.channel.name, done);
|
||||
@ -127,13 +127,16 @@ var users = function(dbot) {
|
||||
done(channel);
|
||||
}
|
||||
}.bind(this));
|
||||
} else {
|
||||
done(null);
|
||||
}
|
||||
}.bind(this);
|
||||
var checkUser = function(done) {
|
||||
this.api.resolveUser(event.server, event.user, function(user) {
|
||||
if(!user) {
|
||||
this.internalAPI.createUser(event.server, event.user, done);
|
||||
} else {
|
||||
if(event.user != user.currentNick) {
|
||||
if(event.user !== user.currentNick) {
|
||||
user.currentNick = event.user;
|
||||
this.db.save('users', user.id, user, function() {
|
||||
dbot.api.event.emit('new_current_nick', [ user ]);
|
||||
@ -189,18 +192,12 @@ var users = function(dbot) {
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
if(event.user && event.channel && _.include(['JOIN', 'MODE', 'NICK', 'PRIVMSG'], event.action)) {
|
||||
if(event.user && _.include(['JOIN', 'MODE', 'NICK', 'PRIVMSG'], event.action)) {
|
||||
checkChannel(function(channel) {
|
||||
event.rChannel = channel;
|
||||
checkUser(function(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) {
|
||||
checkChannelUsers(function() {
|
||||
callback();
|
||||
|
Loading…
Reference in New Issue
Block a user