mirror of
https://github.com/reality/dbot.git
synced 2024-12-18 00:22:35 +01:00
users module now tracks current nick, appropriate output in ~alias
This commit is contained in:
parent
e9c44bf702
commit
e7be2f6b87
@ -13,11 +13,13 @@ var commands = function(dbot) {
|
||||
if(user.aliases.length != 0) {
|
||||
event.reply(dbot.t('primary', {
|
||||
'user': nick,
|
||||
'currentNick': user.currentNick,
|
||||
'count': user.aliases.length,
|
||||
}) + including);
|
||||
} else {
|
||||
event.reply(dbot.t('primary', {
|
||||
'user': nick,
|
||||
'currentNick': user.currentNick,
|
||||
'count': user.aliases.length
|
||||
}).slice(0, -2) + ".");
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
"na'vi": "ayfko syaw {user} {alias} nìteng"
|
||||
},
|
||||
"primary": {
|
||||
"en": "{user} is a primary user with {count} aliases, ",
|
||||
"en": "{user} is a primary user (currently {currentNick}) with {count} aliases, ",
|
||||
"na'vi": "{user} lu txin ulte {count}a stxo lu poru, "
|
||||
},
|
||||
"unknown_alias": {
|
||||
|
@ -73,20 +73,30 @@ var users = function(dbot) {
|
||||
if(!_.include(user.channels, event.channel)) { // User not yet channel user
|
||||
this.internalAPI.addChannelUser(user, event.channel.name);
|
||||
}
|
||||
|
||||
user.currentNick = event.user;
|
||||
this.db.save(users, user.id, user, function(err) {
|
||||
if(err) {
|
||||
// QQ
|
||||
}
|
||||
});
|
||||
}
|
||||
}.bind(this));
|
||||
} else if(event.action == 'NICK') {
|
||||
this.api.isKnownUser(event.server, event.newNick, function(isKnown) {
|
||||
if(!isKnown) {
|
||||
this.api.resolveUser(event.server, event.user, function(user) {
|
||||
this.api.resolveUser(event.server, event.user, function(user) {
|
||||
this.api.isKnownUser(event.server, event.newNick, function(isKnown) {
|
||||
user.currentNick = event.newNick;
|
||||
|
||||
if(!isKnown) {
|
||||
user.aliases.push(event.newNick);
|
||||
this.db.save('users', user.id, user, function(err) {
|
||||
if(!err) {
|
||||
dbot.api.event.emit('new_user_alias', [ user, event.newNick ]);
|
||||
}
|
||||
});
|
||||
}.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
this.db.save('users', user.id, user, function(err) {
|
||||
if(!err) {
|
||||
dbot.api.event.emit('new_user_alias', [ user, event.newNick ]);
|
||||
}
|
||||
});
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
}
|
||||
}.bind(this);
|
||||
|
Loading…
Reference in New Issue
Block a user