forked from GitHub/dbot
users.api.getRandomChannelUser [#156]
This commit is contained in:
parent
3103e84ddb
commit
aa4a8b8527
@ -36,6 +36,15 @@ var api = function(dbot) {
|
|||||||
return user;
|
return user;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'getRandomChannelUser': function(server, channel) {
|
||||||
|
var channelUsers = this.getServerUsers(server).channelUsers[channel];
|
||||||
|
if(!_.isUndefined(channelUsers)) {
|
||||||
|
return channelUsers[_.random(0, channelUsers.length - 1)];
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
'getServerUsers': function(server) {
|
'getServerUsers': function(server) {
|
||||||
return dbot.db.knownUsers[server].users;
|
return dbot.db.knownUsers[server].users;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user