Last active
December 14, 2015 13:39
-
-
Save lcharette/5095452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ape.registerCmd("channelsUserNb", false, function(params, infos) { | |
//Object to be returned | |
var reponse = new Object; | |
//List of channel, as an Array | |
var channelList = params.channelList; | |
//We loop for every channel in the Array | |
for (x in channelList) | |
{ | |
//Setup the counter to start at zero (O rly?) | |
var i = 0; | |
//Get the channel obj | |
var chan = Ape.getChannelByName(channelList[x]); | |
//If the channel doesn't exist, we skip | |
if ($defined(chan)) { | |
//We calculate how many user on the channel (Lenght could be used maybe?) | |
chan.userslist.each(function(user) { | |
i++; | |
}); | |
} | |
//Add to the return and | |
reponse[listeChannels[x]] = i; | |
} | |
//Return to InlinePush | |
return {"name":"pushed","data":{"value":"ok", "reponse":reponse}}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment