mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 14:29:29 +01:00
report uses known users api functionality [#158]
This commit is contained in:
parent
e048780cfc
commit
8a66f5b9c6
@ -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;
|
||||
});
|
||||
|
@ -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}."
|
||||
|
@ -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);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -49,6 +49,7 @@ var users = function(dbot) {
|
||||
} else {
|
||||
knownUsers.users.push(nick);
|
||||
}
|
||||
|
||||
if(!_.include(channelUsers, nick)) {
|
||||
channelUsers.push(nick);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user