forked from GitHub/dbot
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)) {
|
if(_.has(event.allChannels, channelName)) {
|
||||||
var channel = 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) {
|
var ops = _.filter(channel.nicks, function(user) {
|
||||||
return user.op;
|
return user.op;
|
||||||
});
|
});
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
"english": "Thank you, {reported} has been reported to the channel administrators."
|
"english": "Thank you, {reported} has been reported to the channel administrators."
|
||||||
},
|
},
|
||||||
"user_not_found": {
|
"user_not_found": {
|
||||||
"english": "{reported} does not appear to be in {channel}."
|
"english": "{reported} isn't a known user in {channel}."
|
||||||
},
|
},
|
||||||
"not_in_channel": {
|
"not_in_channel": {
|
||||||
"english": "I am not present in {channel}."
|
"english": "I am not present in {channel}."
|
||||||
|
@ -65,6 +65,16 @@ var api = function(dbot) {
|
|||||||
nick = nick.name;
|
nick = nick.name;
|
||||||
return _.include(possiNicks, nick);
|
return _.include(possiNicks, nick);
|
||||||
}, this);
|
}, 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 {
|
} else {
|
||||||
knownUsers.users.push(nick);
|
knownUsers.users.push(nick);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_.include(channelUsers, nick)) {
|
if(!_.include(channelUsers, nick)) {
|
||||||
channelUsers.push(nick);
|
channelUsers.push(nick);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user