fix report [#511]

This commit is contained in:
reality 2013-06-27 19:16:18 +00:00
parent 08d5f15679
commit 6faedb59a8

View File

@ -20,13 +20,13 @@ 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];
dbot.api.users.resolveUser(event.server, nick, function(reportee) {
if(_.has(event.allChannels, channelName)) { if(_.has(event.allChannels, channelName)) {
if(dbot.api.users.isChannelUser(event.server, nick, channelName, true)) { if(reportee) {
nick = dbot.api.users.resolveUser(event.server, nick, true);
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,
@ -43,11 +43,12 @@ var report = function(dbot) {
} else { } else {
event.reply(dbot.t('not_in_channel', { 'channel': channelName })); event.reply(dbot.t('not_in_channel', { 'channel': channelName }));
} }
}.bind(this));
}, },
'~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', {