mirror of
https://github.com/reality/dbot.git
synced 2025-01-24 02:54:16 +01:00
fix up the nick before action fix. this should be more efficient (plus it is prettier)
This commit is contained in:
parent
023dafc4cb
commit
b9926a154c
2
jsbot
2
jsbot
@ -1 +1 @@
|
|||||||
Subproject commit d57af91f9d623c66eedcaccc8c6f6632d5e36755
|
Subproject commit 5a67080aedbf347252f0374fcfbae4992be80da2
|
@ -96,7 +96,6 @@ var users = function(dbot) {
|
|||||||
|
|
||||||
this.listener = function(event) {
|
this.listener = function(event) {
|
||||||
this.api.isKnownUser(event.server, event.newNick, function(isKnown) {
|
this.api.isKnownUser(event.server, event.newNick, function(isKnown) {
|
||||||
console.log(event.rUser);
|
|
||||||
event.rUser.currentNick = event.newNick;
|
event.rUser.currentNick = event.newNick;
|
||||||
dbot.api.event.emit('new_current_nick', [ event.rUser ]);
|
dbot.api.event.emit('new_current_nick', [ event.rUser ]);
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ var users = function(dbot) {
|
|||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
|
||||||
if(event.user && event.channel && _.include(['JOIN', 'MODE', 'PRIVMSG'], event.action)) {
|
if(event.user && event.channel && _.include(['JOIN', 'MODE', 'NICK', 'PRIVMSG'], event.action)) {
|
||||||
checkChannel(function(channel) {
|
checkChannel(function(channel) {
|
||||||
event.rChannel = channel;
|
event.rChannel = channel;
|
||||||
checkUser(function(user) {
|
checkUser(function(user) {
|
||||||
@ -202,24 +201,15 @@ var users = function(dbot) {
|
|||||||
this.userCache[event.server][event.rUser.currentNick] = event.rUser.id;
|
this.userCache[event.server][event.rUser.currentNick] = event.rUser.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkChannelUsers(function() {
|
if(event.channel) {
|
||||||
|
checkChannelUsers(function() {
|
||||||
|
callback();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
callback();
|
callback();
|
||||||
});
|
}
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
} else if(event.user) {
|
|
||||||
this.api.resolveUser(event.server, event.user, function(user) {
|
|
||||||
if(user) event.rUser = user;
|
|
||||||
|
|
||||||
if(event.channel) {
|
|
||||||
this.api.resolveChannel(event.server, event.channel.name, function(channel) {
|
|
||||||
if(channel) event.rChannel = channel;
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
callback();
|
|
||||||
}
|
|
||||||
}.bind(this));
|
|
||||||
} else {
|
} else {
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user