3
0
mirror of https://github.com/reality/dbot.git synced 2024-12-28 21:52:38 +01:00

users.api.getRandomChannelUser [#156]

This commit is contained in:
reality 2013-01-26 19:21:09 +00:00
parent 3103e84ddb
commit aa4a8b8527

View File

@ -36,6 +36,15 @@ var api = function(dbot) {
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) {
return dbot.db.knownUsers[server].users;
},