3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-25 04:02:39 +01:00

Enhancements to ~alias as per [#95]

This commit is contained in:
reality 2013-01-02 19:00:44 +00:00
parent 67b2661e63
commit 51298b8362
2 changed files with 12 additions and 3 deletions

View File

@ -2,10 +2,13 @@
"alias": {
"english": "{alias} is an alias of {user}"
},
"primary": {
"english": "{user} is a primary user with {count} aliases."
},
"unknown_alias": {
"english": "{alias} does not currently exist as an alias."
"english": "{alias} does not currently exist as an alias or known user."
},
"aliasparentset": {
"english": "{newParent} is now the parent user, and {newAlias} is an alias"
"english": "{newParent} is now the parent user, and {newAlias} is an alias."
}
}

View File

@ -25,7 +25,13 @@ var users = function(dbot) {
'~alias': function(event) {
var knownUsers = getServerUsers(event);
var alias = event.params[1].trim();
if(knownUsers.aliases.hasOwnProperty(alias)) {
if(knownUsers.users.include(alias)) {
var aliasCount = 0;
knownUsers.aliases.each(function(primaryUser) {
if(primaryUser == alias) aliasCount += 1;
}.bind(this));
event.reply(dbot.t('primary', { 'user': alias, 'count': aliasCount }));
} else if(knownUsers.aliases.hasOwnProperty(alias)) {
event.reply(dbot.t('alias', { 'alias': alias,
'user': knownUsers.aliases[alias] }));
} else {