diff --git a/modules/users/api.js b/modules/users/api.js index a5df678..19c62a6 100644 --- a/modules/users/api.js +++ b/modules/users/api.js @@ -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; },