mirror of
https://github.com/reality/dbot.git
synced 2024-11-27 22:39:26 +01:00
users.api.getRandomChannelUser [#156]
This commit is contained in:
parent
3103e84ddb
commit
aa4a8b8527
@ -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;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user