forked from GitHub/dbot
Enhancements to ~alias as per [#95]
This commit is contained in:
parent
67b2661e63
commit
51298b8362
@ -2,10 +2,13 @@
|
|||||||
"alias": {
|
"alias": {
|
||||||
"english": "{alias} is an alias of {user}"
|
"english": "{alias} is an alias of {user}"
|
||||||
},
|
},
|
||||||
|
"primary": {
|
||||||
|
"english": "{user} is a primary user with {count} aliases."
|
||||||
|
},
|
||||||
"unknown_alias": {
|
"unknown_alias": {
|
||||||
"english": "{alias} does not currently exist as an alias."
|
"english": "{alias} does not currently exist as an alias or known user."
|
||||||
},
|
},
|
||||||
"aliasparentset": {
|
"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."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,13 @@ var users = function(dbot) {
|
|||||||
'~alias': function(event) {
|
'~alias': function(event) {
|
||||||
var knownUsers = getServerUsers(event);
|
var knownUsers = getServerUsers(event);
|
||||||
var alias = event.params[1].trim();
|
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,
|
event.reply(dbot.t('alias', { 'alias': alias,
|
||||||
'user': knownUsers.aliases[alias] }));
|
'user': knownUsers.aliases[alias] }));
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user