forked from GitHub/dbot
fix ignore
This commit is contained in:
parent
0d2d00635c
commit
e22133d685
@ -116,35 +116,31 @@ var ignore = function(dbot) {
|
|||||||
if(module == '*' || _.include(dbot.config.moduleNames, item) || _.include(dbot.commands, item)) {
|
if(module == '*' || _.include(dbot.config.moduleNames, item) || _.include(dbot.commands, item)) {
|
||||||
dbot.api.users.resolveUser(event.server, nick, function(err, user) {
|
dbot.api.users.resolveUser(event.server, nick, function(err, user) {
|
||||||
this.api.getUserIgnores(user, function(err, ignores) {
|
this.api.getUserIgnores(user, function(err, ignores) {
|
||||||
if(!err) {
|
if(!ignores) {
|
||||||
if(!ignores) {
|
ignores = {
|
||||||
ignores = {
|
'id': user.id,
|
||||||
'id': user.id,
|
'ignores': [],
|
||||||
'ignores': [],
|
'bans': []
|
||||||
'bans': []
|
};
|
||||||
};
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(!_.include(ignores.bans, item)) {
|
if(!_.include(ignores.bans, item)) {
|
||||||
ignores.bans.push(item);
|
ignores.bans.push(item);
|
||||||
this.db.save('ignores', user.id, ignores, function(err) {
|
this.db.save('ignores', user.id, ignores, function(err) {
|
||||||
if(!err) {
|
if(!err) {
|
||||||
event.reply(dbot.t('banned_success', {
|
event.reply(dbot.t('banned_success', {
|
||||||
'user': event.user,
|
'user': event.user,
|
||||||
'banned': nick,
|
'banned': nick,
|
||||||
'module': item
|
'module': item
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('already_banned', {
|
event.reply(dbot.t('already_banned', {
|
||||||
'user': event.user,
|
'user': event.user,
|
||||||
'banned': nick
|
'banned': nick
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
event.reply(err);
|
|
||||||
}
|
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
} else {
|
} else {
|
||||||
@ -264,8 +260,8 @@ var ignore = function(dbot) {
|
|||||||
commands['~ignorechannel'].regex = [/^ignorechannel ([^ ]+) ([^ ]+)$/, 3];
|
commands['~ignorechannel'].regex = [/^ignorechannel ([^ ]+) ([^ ]+)$/, 3];
|
||||||
commands['~unignorechannel'].regex = [/^unignorechannel ([^ ]+) ([^ ]+)$/, 3];
|
commands['~unignorechannel'].regex = [/^unignorechannel ([^ ]+) ([^ ]+)$/, 3];
|
||||||
|
|
||||||
commands['~ban'].access = 'moderator';
|
commands['~ban'].access = 'power_user';
|
||||||
commands['~unban'].access = 'moderator';
|
commands['~unban'].access = 'power_user';
|
||||||
commands['~ignorechannel'].access = 'moderator';
|
commands['~ignorechannel'].access = 'moderator';
|
||||||
commands['~unignorechannel'].access = 'moderator';
|
commands['~unignorechannel'].access = 'moderator';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user