Skip to content

Instantly share code, notes, and snippets.

Last active Dec 14, 2015
What would you like to do?
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) {
//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