diff --git a/modules/report/report.js b/modules/report/report.js index cf463f0..2e9bbe9 100644 --- a/modules/report/report.js +++ b/modules/report/report.js @@ -9,7 +9,8 @@ var report = function(dbot) { if(_.has(event.allChannels, channelName)) { var channel = event.allChannels[channelName]; - if(_.has(channel.nicks, nick)) { + if(dbot.api.users.isChannelUser(event.server, nick, channelName, true)) { + var nick = dbot.api.users.resolveUser(event.server, nick, true); var ops = _.filter(channel.nicks, function(user) { return user.op; }); diff --git a/modules/report/strings.json b/modules/report/strings.json index 27f58d6..e5a467d 100644 --- a/modules/report/strings.json +++ b/modules/report/strings.json @@ -6,7 +6,7 @@ "english": "Thank you, {reported} has been reported to the channel administrators." }, "user_not_found": { - "english": "{reported} does not appear to be in {channel}." + "english": "{reported} isn't a known user in {channel}." }, "not_in_channel": { "english": "I am not present in {channel}." diff --git a/modules/users/api.js b/modules/users/api.js index c36e21e..f7571fc 100644 --- a/modules/users/api.js +++ b/modules/users/api.js @@ -65,6 +65,16 @@ var api = function(dbot) { nick = nick.name; return _.include(possiNicks, nick); }, this); + }, + + 'isChannelUser': function(server, user, channel, useLowerCase) { + var knownUsers = this.getServerUsers(server); + var user = this.api.resolveUser(server, user, useLowerCase); + + if(!_.has(knownUsers.channelUsers, channel)) { + return false; + } + return _.include(knownUsers.channelUsers[channel], user); } }; diff --git a/modules/users/users.js b/modules/users/users.js index c093cff..c480dd0 100644 --- a/modules/users/users.js +++ b/modules/users/users.js @@ -49,6 +49,7 @@ var users = function(dbot) { } else { knownUsers.users.push(nick); } + if(!_.include(channelUsers, nick)) { channelUsers.push(nick); }