Bots Home
|
Create an App
List active tippers
Author:
alipaeillee
Description
Source Code
Launch Bot
Current Users
Created by:
Alipaeillee
users = {}; //limit = 10; //limit_i = limit; function registerTip(userID, value) { if (userID in users) { users[userID].Tips += value; users[userID].Active = true; } else { users[userID] = {}; users[userID].Name = userID; users[userID].Tips = value; users[userID].Active = true; } } function stringifyUsers() { msg = ""; for (var user in users) { /*if (limit_i == 0) { break; }*/ if (users[user].Active) { msg += users[user].Name + ',' + users[user].Tips + '|'; //limit_i -= 1; } } //limit_i = limit; return msg; } function heartbeat() { msg = "DATA:" + stringifyUsers(); cb.sendNotice(msg, cb.room_slug); cb.setTimeout(heartbeat, 5000); } cb.onTip(function(tip) { registerTip(tip['from_user'], parseInt(tip['amount'], 10)); }) cb.onLeave(function(o) { userID = o.user; if (userID in users) { users[userID].Active = false; } }); cb.onEnter(function(o) { userID = o.user; if (userID in users) { users[userID].Active = true; } }); cb.setTimeout(heartbeat, 5000);
© Copyright Chaturbate 2011- 2026. All Rights Reserved.