Bots Home
|
Create an App
Olivia'S Fortune Cookie
Author:
oliviaoncam
Description
Source Code
Launch Bot
Current Users
Created by:
Oliviaoncam
var Fortunes = []; var usedFortunes = []; cb.settings_choices = [ { name: "price", type: "int", minValue: 1, maxValue: 999999, defaultValue: 55, label: "This is the price of a fortune in tokens" }, { name: "fortune_color", type: "str", required: true, label: "Fortune's color (e.g. #FFF6FB)" }, { name: "fortune_background_color", type: "str", required: true, label: "Fortune's background color (e.g. #FFF6FB)" }, { name: "emergencyFortune", type: "str", required: true, label: "Emergency Fortune for when all fortunes are gone!" }, { name: "Fortune1", type: "str", required: true, label: "Fortune number 1" }, { name: "Fortune2", type: "str", required: false, label: "Fortune number 2" }, { name: "Fortune3", type: "str", required: false, label: "Fortune number 3" }, { name: "Fortune4", type: "str", required: false, label: "Fortune number 4" }, { name: "Fortune5", type: "str", required: false, label: "Fortune number 5" }, { name: "Fortune6", type: "str", required: false, label: "Fortune number 6" }, { name: "Fortune7", type: "str", required: false, label: "Fortune number 7" }, { name: "Fortune8", type: "str", required: false, label: "Fortune number 8" }, { name: "Fortune9", type: "str", required: false, label: "Fortune number 9" }, { name: "Fortune10", type: "str", required: false, label: "Fortune number 10" }, { name: "Fortune11", type: "str", required: false, label: "Fortune number 11" }, { name: "Fortune12", type: "str", required: false, label: "Fortune number 12" }, { name: "Fortune13", type: "str", required: false, label: "Fortune number 13" }, { name: "Fortune14", type: "str", required: false, label: "Fortune number 14" }, { name: "Fortune15", type: "str", required: false, label: "Fortune number 15" }, { name: "Fortune16", type: "str", required: false, label: "Fortune number 16" }, { name: "Fortune17", type: "str", required: false, label: "Fortune number 17" }, { name: "Fortune18", type: "str", required: false, label: "Fortune number 18" }, { name: "Fortune19", type: "str", required: false, label: "Fortune number 19" }, { name: "Fortune20", type: "str", required: false, label: "Fortune number 20" }, { name: "Fortune21", type: "str", required: false, label: "Fortune number 21" }, { name: "Fortune22", type: "str", required: false, label: "Fortune number 22" }, { name: "Fortune23", type: "str", required: false, label: "Fortune number 23" }, { name: "Fortune24", type: "str", required: false, label: "Fortune number 24" }, { name: "Fortune25", type: "str", required: false, label: "Fortune number 25" }, { name: "Fortune26", type: "str", required: false, label: "Fortune number 26" }, { name: "Fortune27", type: "str", required: false, label: "Fortune number 27" }, { name: "Fortune28", type: "str", required: false, label: "Fortune number 28" }, { name: "Fortune29", type: "str", required: false, label: "Fortune number 29" }, { name: "Fortune30", type: "str", required: false, label: "Fortune number 30" }, { name: "Fortune31", type: "str", required: false, label: "Fortune number 31" }, { name: "Fortune32", type: "str", required: false, label: "Fortune number 32" }, { name: "Fortune33", type: "str", required: false, label: "Fortune number 33" }, { name: "Fortune34", type: "str", required: false, label: "Fortune number 34" }, { name: "Fortune35", type: "str", required: false, label: "Fortune number 35" }, { name: "Fortune36", type: "str", required: false, label: "Fortune number 36" }, { name: "Fortune37", type: "str", required: false, label: "Fortune number 37" }, { name: "Fortune38", type: "str", required: false, label: "Fortune number 38" }, { name: "Fortune39", type: "str", required: false, label: "Fortune number 39" }, { name: "Fortune40", type: "str", required: false, label: "Fortune number 40" }, { name: "Fortune41", type: "str", required: false, label: "Fortune number 41" }, { name: "Fortune42", type: "str", required: false, label: "Fortune number 42" }, { name: "Fortune43", type: "str", required: false, label: "Fortune number 43" }, { name: "Fortune44", type: "str", required: false, label: "Fortune number 44" }, { name: "Fortune45", type: "str", required: false, label: "Fortune number 45" }, { name: "Fortune46", type: "str", required: false, label: "Fortune number 46" }, { name: "Fortune47", type: "str", required: false, label: "Fortune number 47" }, { name: "Fortune48", type: "str", required: false, label: "Fortune number 48" }, { name: "Fortune49", type: "str", required: false, label: "Fortune number 49" }, { name: "Fortune50", type: "str", required: false, label: "Fortune number 50" }, { name: "Fortune51", type: "str", required: false, label: "Fortune number 51" }, { name: "Fortune52", type: "str", required: false, label: "Fortune number 52" }, { name: "Fortune53", type: "str", required: false, label: "Fortune number 53" }, { name: "Fortune54", type: "str", required: false, label: "Fortune number 54" }, { name: "Fortune55", type: "str", required: false, label: "Fortune number 55" }, { name: "Fortune56", type: "str", required: false, label: "Fortune number 56" }, { name: "Fortune57", type: "str", required: false, label: "Fortune number 57" }, { name: "Fortune58", type: "str", required: false, label: "Fortune number 58" }, { name: "Fortune59", type: "str", required: false, label: "Fortune number 59" }, { name: "Fortune60", type: "str", required: false, label: "Fortune number 60" } ]; cb.onTip(function(tip) { var tempLength = Fortunes.length; var tempUser = tip["from_user"]; var randomVar = 999; if (tempLength != 0){ randomVar = Math.floor((Math.random() * tempLength) + 1); } var tempFortune = tempUser + "'s fortune says: " + returnFortune(randomVar); if(tip["amount"] == cb.settings["price"]){ cb.sendNotice(tempFortune,"",cb.settings["fortune_background_color"],cb.settings["fortune_color"],"bold"); } }); cb.onMessage(function(msg) { var tempUser = msg["user"]; var tempMessage = msg["m"]; var tempString = "The following fortunes have been used today: "; var tempLength = usedFortunes.length; var tempComma = ","; if(tempUser == cb.room_slug && tempMessage.match(/\/tippers/i)){ msg["X-Spam"] = true; for(var j = 0; j < tempLength; j++){ if (j == (tempLength - 1)){ tempComma = ""; } tempString += usedFortunes[j] + tempComma + " "; } cb.sendNotice(tempString,cb.room_slug,cb.settings["fortune_background_color"],cb.settings["fortune_color"],"bold"); } return msg; }); function returnFortune(fortuneID){ var fortune = ""; if(fortuneID != 999){ fortune += Fortunes[fortuneID - 1]; usedFortunes.push(fortuneID); cbjs.arrayRemove(Fortunes, fortune); } else { fortune += cb.settings["emergencyFortune"]; } return fortune; } function init(){ var tempString = ""; for(var i = 0; i < 60; i++){ tempString = cb.settings["Fortune" + (i + 1)] if(tempString != ""){ Fortunes.push(tempString); } } usedFortunes = []; } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.