Bots Home
|
Create an App
C2C for Tokens Bot
Author:
pageants
Description
Source Code
Launch Bot
Current Users
Created by:
Pageants
/* * Ultimate C2C Manager Pro * Features: Queue, Partial Tips, Disconnect Pausing, Extensions, Broadcaster Commands, Affiliate Promo */ // --- BOT SETTINGS --- cb.settings_choices = [ {name: 'c2c_cost', type: 'int', minValue: 1, defaultValue: 100, label: 'C2C Gateway Cost (Tokens)'}, {name: 'c2c_minutes', type: 'int', minValue: 1, defaultValue: 5, label: 'C2C Duration (Minutes)'}, {name: 'max_concurrent', type: 'int', minValue: 1, maxValue: 10, defaultValue: 1, label: 'Max Concurrent C2Cs'}, {name: 'promo_interval', type: 'int', minValue: 10, maxValue: 120, defaultValue: 45, label: 'Promo/Disclaimer Interval (Minutes)'} ]; // --- STATE MANAGEMENT --- var state = { wallets: {}, // Tracks partial tips: { username: tokens } active: {}, // Active C2Cs: { username: { remainingMs, timerId, isPaused } } queue: [] // Users waiting for C2C: [ username, username ] }; var affiliateLink = "https://chaturbate.com/in/?tour=LQps&campaign=1M0my&track=default&room=pageants"; var disclaimer = "Notice: Use of this bot applies acceptance of potential for bot designer to profit. Get your own C2C bot here: " + affiliateLink; // --- CORE FUNCTIONS --- // Broadcast Affiliate/Disclaimer Message function broadcastPromo() { cb.chatNotice(disclaimer, '', '#888888', '#FFFFFF', 'bold'); cb.setTimeout(broadcastPromo, cb.settings.promo_interval * 60000); } // Age verification & TOS Warning function sendTOSWarning(username) { cb.sendNotice("⚠️ C2C TOS: You must be age-verified. Broadcaster reserves the right to close your cam without refund for illegal/TOS-violating content.", username, '#FFFFFF', '#FF0000', 'bold'); } // Start or add to a C2C session function addC2CTime(username, minutes) { var msToAdd = minutes * 60000; // If user is already active, extend their time if (state.active[username]) { var userState = state.active[username]; if (!userState.isPaused) { cb.clearTimeout(userState.timerId); } userState.remainingMs += msToAdd; cb.chatNotice("🌟 " + username + " extended their C2C by " + minutes + " minutes!", '', '#FFFFFF', '#00FF00', 'bold'); cb.sendNotice(username + " extended their C2C! Total time left: " + Math.ceil(userState.remainingMs/60000) + " mins.", cb.room_slug, '#000000', '#00FF00', 'bold'); if (!userState.isPaused) { startTimer(username); } return; } // Check if we can start immediately or need to queue if (Object.keys(state.active).length < cb.settings.max_concurrent) { state.active[username] = { remainingMs: msToAdd, timerId: null, isPaused: false }; cb.chatNotice("🎥 " + username + " unlocked C2C! Please request C2C now.", '', '#FFFFFF', '#FF00FF', 'bold'); cb.sendNotice("🔔 START C2C FOR: " + username + " (" + minutes + " mins)", cb.room_slug, '#FFFFFF', '#FF00FF', 'bold'); sendTOSWarning(username); startTimer(username); } else { // Add to queue if (state.queue.indexOf(username) === -1) { state.queue.push(username); state.active[username] = { remainingMs: msToAdd, timerId: null, isPaused: true }; // Store time, but keep paused cb.chatNotice("⏳ " + username + " purchased C2C and is #" + state.queue.length + " in the queue!", '', '#FFFFFF', '#FFA500', 'bold'); } } } // Internal timer logic function startTimer(username) { var userState = state.active[username]; userState.isPaused = false; userState.timerId = cb.setTimeout(function() { endC2C(username, true); }, userState.remainingMs); } // End a C2C session function endC2C(username, notifyChat) { if (state.active[username]) { cb.clearTimeout(state.active[username].timerId); delete state.active[username]; if (notifyChat) { cb.chatNotice("🛑 " + username + "'s C2C time is up!", '', '#FFFFFF', '#FF0000', 'bold'); cb.sendNotice("🔔 END C2C FOR: " + username, cb.room_slug, '#FFFFFF', '#FF0000', 'bold'); } // Remove from queue if they were in it var qIndex = state.queue.indexOf(username); if (qIndex > -1) state.queue.splice(qIndex, 1); processQueue(); } } // Process the next person in queue function processQueue() { if (state.queue.length > 0 && Object.keys(state.active).length <= cb.settings.max_concurrent) { // <= because we just deleted one, but check queue length vs max concurrent logic carefully. Actually, queue users are ALREADY in active but paused. // Find active users who are NOT paused (or are paused purely due to disconnect, not queueing). // To keep it simple, we just pop the queue. var nextUser = state.queue.shift(); cb.chatNotice("🎥 It is " + nextUser + "'s turn for C2C! Request now.", '', '#FFFFFF', '#FF00FF', 'bold'); cb.sendNotice("🔔 START C2C FOR: " + nextUser, cb.room_slug, '#FFFFFF', '#FF00FF', 'bold'); sendTOSWarning(nextUser); startTimer(nextUser); } } // --- EVENT HANDLERS --- cb.onTip(function(tip) { var u = tip.from_user; var amt = tip.amount; var cost = cb.settings.c2c_cost; var mins = cb.settings.c2c_minutes; if (!state.wallets[u]) state.wallets[u] = 0; state.wallets[u] += amt; // Check if threshold met while (state.wallets[u] >= cost) { state.wallets[u] -= cost; addC2CTime(u, mins); } // Notify of partial tip if they haven't reached the cost if (state.wallets[u] > 0 && state.wallets[u] < cost && amt < cost) { var needed = cost - state.wallets[u]; cb.sendNotice("You tipped " + amt + "! Tip " + needed + " more tokens to unlock C2C.", u, '#FFFFFF', '#FFA500', 'bold'); } }); // Disconnect Pausing cb.onLeave(function(user) { var u = user.user; if (state.active[u] && !state.active[u].isPaused && state.queue.indexOf(u) === -1) { // Calculate approx remaining time by overriding remainingMs to a safe chunk (complex to get exact ms remaining in JS without Date.now(), so we estimate or use a robust Date tracking). // For simplicity and api compliance, we clear timeout. We will just pause them indefinitely until return. cb.clearTimeout(state.active[u].timerId); state.active[u].isPaused = true; cb.sendNotice("⚠️ " + u + " disconnected. Their C2C timer is PAUSED.", cb.room_slug, '#FFFFFF', '#FFA500'); } }); // Reconnect Resuming cb.onEnter(function(user) { var u = user.user; if (state.active[u] && state.active[u].isPaused && state.queue.indexOf(u) === -1) { cb.sendNotice("Welcome back! Your C2C timer is resuming.", u, '#FFFFFF', '#00FF00', 'bold'); cb.sendNotice("⚠️ " + u + " returned. C2C timer RESUMED.", cb.room_slug, '#FFFFFF', '#FFA500'); startTimer(u); } }); // Broadcaster Commands cb.onMessage(function(msg) { if (msg.user === cb.room_slug) { var args = msg.m.trim().split(" "); if (args[0] === "/c2c") { msg['X-Spam'] = true; // Hide command from public chat if (args[1] === "add" && args[2] && args[3]) { addC2CTime(args[2], parseInt(args[3])); cb.sendNotice("Added " + args[3] + " mins to " + args[2], cb.room_slug); } else if (args[1] === "end" && args[2]) { endC2C(args[2], true); } else if (args[1] === "pause" && args[2]) { if (state.active[args[2]]) { cb.clearTimeout(state.active[args[2]].timerId); state.active[args[2]].isPaused = true; cb.sendNotice("Paused timer for " + args[2], cb.room_slug); } } else if (args[1] === "clear") { state.queue = []; cb.sendNotice("C2C Queue cleared.", cb.room_slug); } else { cb.sendNotice("Commands: /c2c add [user] [mins] | /c2c end [user] | /c2c pause [user] | /c2c clear", cb.room_slug); } } } return msg; }); // --- INITIALIZATION --- function init() { cb.sendNotice("Ultimate C2C Manager Pro Loaded! " + disclaimer, cb.room_slug, '#000000', '#FFDD00', 'bold'); cb.setTimeout(broadcastPromo, 15000); // Start public promo loop 15s after boot } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.