forked from GitHub/dbot
fix report [#511]
This commit is contained in:
parent
08d5f15679
commit
6faedb59a8
@ -20,34 +20,35 @@ var report = function(dbot) {
|
|||||||
|
|
||||||
var commands = {
|
var commands = {
|
||||||
'~report': function(event) {
|
'~report': function(event) {
|
||||||
var channelName = event.input[1];
|
var channelName = event.input[1],
|
||||||
var nick = event.input[2];
|
nick = event.input[2];
|
||||||
var reason = event.input[3];
|
reason = event.input[3];
|
||||||
|
|
||||||
if(_.has(event.allChannels, channelName)) {
|
dbot.api.users.resolveUser(event.server, nick, function(reportee) {
|
||||||
if(dbot.api.users.isChannelUser(event.server, nick, channelName, true)) {
|
if(_.has(event.allChannels, channelName)) {
|
||||||
nick = dbot.api.users.resolveUser(event.server, nick, true);
|
if(reportee) {
|
||||||
this.api.notify(event.server, channelName, dbot.t('report', {
|
this.api.notify(event.server, channelName, dbot.t('report', {
|
||||||
'reporter': event.user,
|
'reporter': event.user,
|
||||||
'reported': nick,
|
'reported': nick,
|
||||||
'channel': channelName,
|
'channel': channelName,
|
||||||
'reason': reason
|
'reason': reason
|
||||||
}));
|
}));
|
||||||
event.reply(dbot.t('reported', { 'reported': nick }));
|
event.reply(dbot.t('reported', { 'reported': nick }));
|
||||||
|
} else {
|
||||||
|
event.reply(dbot.t('user_not_found', {
|
||||||
|
'reported': nick,
|
||||||
|
'channel': channelName
|
||||||
|
}));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event.reply(dbot.t('user_not_found', {
|
event.reply(dbot.t('not_in_channel', { 'channel': channelName }));
|
||||||
'reported': nick,
|
}
|
||||||
'channel': channelName
|
}.bind(this));
|
||||||
}));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
event.reply(dbot.t('not_in_channel', { 'channel': channelName }));
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'~notify': function(event) {
|
'~notify': function(event) {
|
||||||
var channelName = event.input[1];
|
var channelName = event.input[1],
|
||||||
var message = event.input[2];
|
message = event.input[2];
|
||||||
|
|
||||||
if(_.has(event.allChannels, channelName)) {
|
if(_.has(event.allChannels, channelName)) {
|
||||||
this.api.notify(event.server, channelName, dbot.t('notify', {
|
this.api.notify(event.server, channelName, dbot.t('notify', {
|
||||||
|
Loading…
Reference in New Issue
Block a user