if user JOIN channel with !currentNick, update [#532]

This commit is contained in:
reality 2013-07-14 09:29:22 +00:00
parent 68e0688e63
commit f90a1b97b4

View File

@ -95,7 +95,6 @@ var users = function(dbot) {
};
this.listener = function(event) {
// TODO: If user joins channel with alias
if(event.action == 'JOIN' && event.user != dbot.config.name) {
if(!event.rUser) {
this.internalAPI.createUser(event.server, event.user, function(user) {
@ -104,6 +103,11 @@ var users = function(dbot) {
} else if(!_.include(event.rUser.channels, event.rChannel.id)) {
this.internalAPI.addChannelUser(event.rChannel, event.rUser, function() {});
}
if(event.rUser.currentNick != event.user) {
event.rUser.currentNick = event.user;
this.db.save('users', event.rUser.id, event.rUser, function() {});
}
} else if(event.action == 'NICK') {
this.api.isKnownUser(event.server, event.newNick, function(isKnown) {
event.rUser.currentNick = event.newNick;