Bots Home
|
Create an App
first test bot
Author:
testee1
Description
Source Code
Launch Bot
Current Users
Created by:
Testee1
function output(e) { cb.sendNotice(e) } function outputPrivate(e) { cb.sendNotice(e, cb.room_slug) } function outputImportant(e) { cb.sendNotice(e, "", "", "#ff0000", "bold") } function help() { var e = ["C4NDY Command list:", "", "/C4NDYStop to stop bot", "/C4NDYStart to start bot", "/C4NDYAdd [username] to manually let user see cam", "/C4NDYBlock [username] to block user from cam", "/C4NDYCheck [username] to check user cam status", "/C4NDYList to list everyone who can see cam", "/C4NDYHelp to see list again", "", "Contact me if something doesn't work, thanks."]; cb.sendNotice(e.join("\n"), cb.room_slug, "", "", "bold"); if (c4ndybot.running == true) { outputImportant("C4NDY bot currently running so viewers with no tokens are currently blocked.") } else { outputImportant("C4NDY bot not running so viewers with no tokens are not blocked.") } } function start() { cb.sendNotice("C4NDY Bot - Please type '/C4NDYHelp' for instructions. Use '/C4NDYStop' to stop the C4NDY bot.", cb.room_slug, "", "", "bold"); cb.sendNotice("NOTE: You must type /C4NDYStart to start blocking viewers. Nobody is currently blocked.", cb.room_slug, "", "#ff0000", "bold") } var c4ndybot = { running: false }; var tipperList = []; cb.settings_choices = [{ name: "hide_message", label: "Need Tokens Msg", type: "str", minLength: 1, maxLength: 256, defaultValue: "You need tokens to view this room, please buy some tokens!" }]; cb.onEnter(function(e) { var t = e["user"]; if (c4ndybot.running == true) { cb.sendNotice("Only viewers with tokens can view this room. If you have tokens but can't see anything, please try refreshing your browser.", t, "", "#ff0000", "bold"); if (e["has_tokens"]) { cb.limitCam_addUsers([t]); if (tipperList.indexOf(t) > -1) { cb.sendNotice("Welcome back, " + t + "!", t) } } else if (tipperList.indexOf(t) > -1) { cb.sendNotice("Welcome back, " + t + "!", t); cb.limitCam_addUsers([t]) } } }); cb.onLeave(function(e) { var t = e["user"]; if (c4ndybot.running == true && tipperList.indexOf(t) < 0) { cb.limitCam_removeUsers([t]) } }); cb.onTip(function(e) { var t = e["from_user"]; if (tipperList.indexOf(t) < 0) { tipperList.push(t) } if (c4ndybot.running == true) { cb.limitCam_addUsers([t]) } }); cb.onMessage(function(e) { var t = e["m"]; var n = e["user"]; var r = ""; t = t.replace(/\s+$/, ""); if (c4ndybot.running == true && !e["has_tokens"] && cb.room_slug != n && tipperList.indexOf(n) < 0) { cb.sendNotice(n + ", only users with tokens can view the cam. Please get some tokens now.", n, "", "", "bold"); e["X-Spam"] = true } if (cb.room_slug == n && (t == "/C4NDYHelp" || t == "/c4ndyhelp")) { help() } if (cb.room_slug == n && (t == "/C4NDYStart" || t == "/c4ndystart") && !cb.limitCam_isRunning()) { outputImportant("Only users with tokens can view the show. If you have tokens and cannot see anything, REFRESH your page!"); cb.limitCam_start(cb.settings.hide_message); c4ndybot.running = true } if (cb.room_slug == n && (t == "/C4NDYStop" || t == "/c4ndystop") && cb.limitCam_isRunning()) { output("All users can now view the show!"); cb.limitCam_stop(); c4ndybot.running = false } if (cb.room_slug == n && (t.substring(0, 9) == "/C4NDYBlock" || t.substring(0, 9) == "/c4ndyblock") && cb.limitCam_allUsersWithAccess().length > 0 && cb.limitCam_isRunning()) { r = t.substring(10, t.length); if (cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), r)) { cb.limitCam_removeUsers([r]); output(cb.room_slug + " was blocked " + r + " from the show!") } } if (cb.room_slug == n && (t.substring(0, 9) == "/C4NDYAdd" || t.substring(0, 9) == "/c4ndyadd") && cb.limitCam_isRunning()) { r = t.substring(10, t.length); if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), r)) { cb.limitCam_addUsers([r]); outputPrivate(r + " can now see the room.") } } if (cb.room_slug == n && (t.substring(0, 11) == "/C4NDYCheck" || t.substring(0, 11) == "/c4ndycheck") && cb.limitCam_isRunning()) { r = t.substring(12, t.length); if (cb.limitCam_userHasAccess(r)) { outputPrivate(r + " can view the room.") } else { outputPrivate(r + " cannot view the room.") } } if (cb.room_slug == n && (t == "/C4NDYList" || t == "/c4ndylist") && cb.limitCam_isRunning()) { var i = cb.limitCam_allUsersWithAccess(); if (i.length > 0) { outputPrivate("" + i.length + (i.length > 1 ? " users" : " user") + " can view the room: " + cbjs.arrayJoin(i, ", ")) } else { outputPrivate("Nobody can view the room.") } } if (t[0] == "/") { e["X-Spam"] = true } return e }); start()
© Copyright Chaturbate 2011- 2024. All Rights Reserved.