mirror of
https://github.com/reality/dbot.git
synced 2024-12-24 11:42:36 +01:00
create ~removealias command [Close #549]
This commit is contained in:
parent
9d6b2cc3e1
commit
52d38aa1e7
@ -24,6 +24,12 @@ This command merges two nicks which are recorded as primary users into one user.
|
||||
The secondary user and all of their aliases will be merged under primaryuser.
|
||||
Requires moderator level access by default.
|
||||
|
||||
#### ~addalias [user] [alias]
|
||||
Manually add alias to user.
|
||||
|
||||
#### ~removealias [alias]
|
||||
Remove alias from user.
|
||||
|
||||
### API
|
||||
|
||||
#### resolveUser(server, nick, callback)
|
||||
|
@ -60,6 +60,24 @@ var commands = function(dbot) {
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
'~removealias': function(event) {
|
||||
var alias = event.params[1];
|
||||
|
||||
this.api.resolveUser(event.server, alias, function(user) {
|
||||
if(user) {
|
||||
user.aliases = _.without(user.aliases, alias);
|
||||
this.db.save('users', user.id, user, function(err) {
|
||||
event.reply(dbot.t('alias_removed', {
|
||||
'primary': user.primaryNick,
|
||||
'alias': alias
|
||||
}));
|
||||
});
|
||||
} else {
|
||||
event.reply(dbot.t('unknown_alias', { 'alias': nick }));
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
'~setaliasparent': function(event) {
|
||||
var newPrimary = event.params[1].trim();
|
||||
this.api.resolveUser(event.server, newPrimary, function(user) {
|
||||
@ -135,6 +153,7 @@ var commands = function(dbot) {
|
||||
commands['~setaliasparent'].access = 'moderator';
|
||||
commands['~mergeusers'].access = 'moderator';
|
||||
commands['~addalias'].access = 'moderator';
|
||||
commands['~removealias'].access = 'moderator';
|
||||
|
||||
return commands;
|
||||
};
|
||||
|
@ -26,6 +26,9 @@
|
||||
"fr": "{alias} n'existe pas actuellement en tant qu'alias ou utilisateur connu.",
|
||||
"it": "{alias} non esiste attualmente come alias o utente conosciuto."
|
||||
},
|
||||
"alias_removed": {
|
||||
"en": "Removed alias {alias} from {primary}."
|
||||
},
|
||||
"aliasparentset": {
|
||||
"en": "{newParent} is now the parent user, and {newAlias} is an alias.",
|
||||
"na'vi": "{newParent} lu sa'sem set ulte {newAlias} lu stxo set nìteng.",
|
||||
|
@ -1,5 +1,7 @@
|
||||
{
|
||||
"~alias": "~alias [nick]",
|
||||
"~setaliasparent": "~setaliasparent [nick]",
|
||||
"~mergeusers": "~mergeusers [primary] [secondary]"
|
||||
"~mergeusers": "~mergeusers [primary] [secondary]",
|
||||
"~addalias": "~addalias [user] [alias]",
|
||||
"~removealias": "~removealias [alias]"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user