mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 22:39:26 +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) {
|
if(user.aliases.length != 0) {
|
||||||
event.reply(dbot.t('primary', {
|
event.reply(dbot.t('primary', {
|
||||||
'user': nick,
|
'user': nick,
|
||||||
|
'currentNick': user.currentNick,
|
||||||
'count': user.aliases.length,
|
'count': user.aliases.length,
|
||||||
}) + including);
|
}) + including);
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('primary', {
|
event.reply(dbot.t('primary', {
|
||||||
'user': nick,
|
'user': nick,
|
||||||
|
'currentNick': user.currentNick,
|
||||||
'count': user.aliases.length
|
'count': user.aliases.length
|
||||||
}).slice(0, -2) + ".");
|
}).slice(0, -2) + ".");
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"na'vi": "ayfko syaw {user} {alias} nìteng"
|
"na'vi": "ayfko syaw {user} {alias} nìteng"
|
||||||
},
|
},
|
||||||
"primary": {
|
"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, "
|
"na'vi": "{user} lu txin ulte {count}a stxo lu poru, "
|
||||||
},
|
},
|
||||||
"unknown_alias": {
|
"unknown_alias": {
|
||||||
|
@ -73,20 +73,30 @@ var users = function(dbot) {
|
|||||||
if(!_.include(user.channels, event.channel)) { // User not yet channel user
|
if(!_.include(user.channels, event.channel)) { // User not yet channel user
|
||||||
this.internalAPI.addChannelUser(user, event.channel.name);
|
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));
|
}.bind(this));
|
||||||
} else if(event.action == 'NICK') {
|
} 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);
|
user.aliases.push(event.newNick);
|
||||||
|
}
|
||||||
|
|
||||||
this.db.save('users', user.id, user, function(err) {
|
this.db.save('users', user.id, user, function(err) {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
dbot.api.event.emit('new_user_alias', [ user, event.newNick ]);
|
dbot.api.event.emit('new_user_alias', [ user, event.newNick ]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user