Bots Home
|
Create an App
KyleBot2
Author:
kyle111111
Description
Source Code
Launch Bot
Current Users
Created by:
Kyle111111
/* Title: "codgod69bot2" bot Author: cb_kyle @ chaturbate Version: 0.9 (01/17/2018) Bots combined save bot spaces for codgot69bot2: * "Lush Settings" by samandthebeast * "Tip Menu Plus 20" by badbadbubba * "Welcome & Notify Bot" by johnnysub2 Modifications: 20181108: Added ability to handle 30 tip-menu items. 20180117: Added a multi line option to the Lush Settings to encorporate Special levels and free formed changes. Added cb.settings_choices, separator line */ cb.settings_choices = [ {name: 'tipmenuEnabled', type: 'choice', choice1: 'yes', choice2: 'no', required: true, label: "Enable Tip Menu*"}, {name: 'tipmenuBriefModeEnabled', type: 'choice', choice1: 'yes', choice2: 'no', required: true, label: "Enable Brief Mode*"}, // {name:'Separator', type:'str', minLength:1, maxLength:255, label:'********************', required:false}, // Tip Menu BEGIN ... {name: 'sepchar', type: 'choice', choice1: 'Vertical Bar', choice2: 'Hearts', choice3:'Glitter',choice4:'Flowers',choice5:'Bow',choice6:'Hearts2',choice7:'Smiley',choice8:'Text Heart', choice9:'Text Diamond', choice10:'Text Star', defaultValue: 'Vertical Bar', label: "Separator character"}, {name:'item1', type:'str', label:'Item 1 (eg 10--flash tits)',}, {name:'item2', type:'str', required: false, label:'Item 2',}, {name:'item3', type:'str', required: false, label:'Item 3',}, {name:'item4', type:'str', required: false, label:'Item 4',}, {name:'item5', type:'str', required: false, label:'Item 5',}, {name:'item6', type:'str', required: false, label:'Item 6',}, {name:'item7', type:'str', required: false, label:'Item 7',}, {name:'item8', type:'str', required: false, label:'Item 8',}, {name:'item9', type:'str', required: false, label:'Item 9',}, {name:'item10', type:'str', required: false, label:'Item 10',}, {name:'item11', type:'str', required: false, label:'Item 11',}, {name:'item12', type:'str', required: false, label:'Item 12',}, {name:'item13', type:'str', required: false, label:'Item 13',}, {name:'item14', type:'str', required: false, label:'Item 14',}, {name:'item15', type:'str', required: false, label:'Item 15',}, {name:'item16', type:'str', required: false, label:'Item 16',}, {name:'item17', type:'str', required: false, label:'Item 17',}, {name:'item18', type:'str', required: false, label:'Item 18',}, {name:'item19', type:'str', required: false, label:'Item 19',}, {name:'item20', type:'str', required: false, label:'Item 20',}, {name:'item21', type:'str', required: false, label:'Item 21',}, {name:'item22', type:'str', required: false, label:'Item 22',}, {name:'item23', type:'str', required: false, label:'Item 23',}, {name:'item24', type:'str', required: false, label:'Item 24',}, {name:'item25', type:'str', required: false, label:'Item 25',}, {name:'item26', type:'str', required: false, label:'Item 26',}, {name:'item27', type:'str', required: false, label:'Item 27',}, {name:'item28', type:'str', required: false, label:'Item 28',}, {name:'item29', type:'str', required: false, label:'Item 29',}, {name:'item30', type:'str', required: false, label:'Item 30',}, {name:'noticecolor', type:'str', label:'Notice color (html code default red #FF0000)', defaultValue: '#FF0000'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 1, label: 'Delay in minutes between notice being displayed (minimum 1)'}, // ... Tip Menu END {name:'Separator2', type:'str', minLength:1, maxLength:255, label:'********************', required:false}, // Roll The Dice by jeffreyvels1994 START { name: 'tokens', type: 'int', minValue: 1, maxValue: 100, label: 'How much do you want to charge per roll?', defaultValue: 25 }, { name: 'remove_winning_prize', type: 'choice', label: 'Remove prize from list after each roll?', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'die_type', type: 'choice', label: 'Use traditional (6-sided) or Chinese (10-sided) die? (NOTE: If you choose the ' + 'Chinese die, please set all of the 21 prizes. Otherwise, just set the first 13.)', choice1: 'Traditional', choice2: 'Chinese', default: 'Traditional' }, { name: 'minimum_rolls', type: 'choice', label: 'What is the minimum number of rolls before the rare dice can appear? (Keep this a secret!)', choice1: 10, choice2: 15, choice3: 20, choice4: 25, choice5: 30, choice6: 35, choice7: 40, choice8: 45, choice9: 50, defaultValue: 10 }, { name: 'notice_wait_time', type: 'choice', label: 'In minutes, how often should the app advertise itself?', choice1: 5, choice2: 10, choice3: 15, choice4: 20, choice5: 25, choice6: 30, choice7: 45, choice8: 60, defaultValue: 10 }, {name: 'prize_1', type: 'str', label: 'Prize for rolling 1'}, {name: 'prize_2', type: 'str', label: 'Prize for rolling 2 (2.8% @2)'}, {name: 'prize_3', type: 'str', label: 'Prize for rolling 3 (5.6% @2)'}, {name: 'prize_4', type: 'str', label: 'Prize for rolling 4 (8.3% @2)'}, {name: 'prize_5', type: 'str', label: 'Prize for rolling 5 (11.1% @2)'}, {name: 'prize_6', type: 'str', label: 'Prize for rolling 6 (13.9% @2)'}, {name: 'prize_7', type: 'str', label: 'Prize for rolling 7 (16.7% @2)'}, {name: 'prize_8', type: 'str', label: 'Prize for rolling 8 (13.9% @2)'}, {name: 'prize_9', type: 'str', label: 'Prize for rolling 9 (11.1% @2)'}, {name: 'prize_10', type: 'str', label: 'Prize for rolling 10 (8.3% @2)'}, {name: 'prize_11', type: 'str', label: 'Prize for rolling 11 (5.6% @2)'}, {name: 'prize_12', type: 'str', label: 'Prize for rolling 12 (2.8% @2)'}, { name: 'prize_13', type: 'str', default: 'A smile', label: 'Prize for rolling 13 (RARE if using traditional dice)' }, { name: 'prize_14', type: 'str', default: 'A smile', label: 'Prize for rolling 14 (only shown if using Chinese dice)' }, { name: 'prize_15', type: 'str', default: 'A smile', label: 'Prize for rolling 15 (only shown if using Chinese dice)' }, { name: 'prize_16', type: 'str', default: 'A smile', label: 'Prize for rolling 16 (only shown if using Chinese dice)' }, { name: 'prize_17', type: 'str', default: 'A smile', label: 'Prize for rolling 17 (only shown if using Chinese dice)' }, { name: 'prize_18', type: 'str', default: 'A smile', label: 'Prize for rolling 18 (only shown if using Chinese dice)' }, { name: 'prize_19', type: 'str', default: 'A smile', label: 'Prize for rolling 19 (only shown if using Chinese dice)' }, { name: 'prize_20', type: 'str', default: 'A smile', label: 'Prize for rolling 20 (only shown if using Chinese dice)' }, { name: 'prize_21', type: 'str', default: 'A smile', label: 'Prize for rolling 21 (RARE; only shown if using Chinese dice)' }, // Roll The Dice by jeffreyvels1994 END {name:'Separator3', type:'str', minLength:1, maxLength:255, label:'********************', required:false}, // Trick or Treat BEGIN { name: 'tt_tokens', type: 'int', minValue: 0, maxValue: 1000, label: 'How much do you want to charge per treat?', required:false, defaultValue: 85 }, { name: 'tt_treats', type: 'str', label: 'Treats (separate each by |)', required:false, default: 'Atomic Fireball Candy|Extreme Sour Warhead Candy|Boozled: Stinky Socks (or) Tutti-Fruitti|Boozled: Lawn Clippings (or) Lime|Boozled: Rotten Egg (or) Buttered Popcorn|Boozled: Toothpaste (or) Berry Blue|Boozled: Barf (or) Peach|Boozled: Canned Dog Food (or) Chocolate Pudding|Boozled: Booger (or) Juicy Pear|Boozled: Moldy Cheese (or) Caramel Corn|Boozled: Baby Wipes (or) Coconut|Boozled: Skunk Spray (or) Licorice'}, // Trick or Treat END {name:'Separator4', type:'str', minLength:1, maxLength:255, label:'******************** Random BOT ********************', required:false}, // Choice1 BEGIN { name: 'random1_tokens', type: 'int', minValue: 0, maxValue: 1000, label: 'Cost to randomly pick a choice?', required:false, defaultValue: 0 }, { name: 'random1_choices', type: 'str', label: 'Choices (separate each by |)', required:false, default: 'choice 1|choice 2'}, // Choice1 END {name:'Separator5', type:'str', minLength:1, maxLength:255, label:'******************** FanClub Icons ********************', required:false}, // Fanclub icons BEGIN { name: 'fc_choices', type: 'str', label: 'Choices (separate each by |)', required:false, default: ':greenHeart|:fanclub-lana2|:heart2|:greenlizard16|:smile|:diamondspin|:goldstar7|:clover66|:sparklesssss'}, // Fanclub icons END {name:'Separator6', type:'str', minLength:1, maxLength:255, label:'*************** Welcome and Notify Bot ***************', required:false}, // Welcome & Notify BEGIN // series of function / push commmand executed later. // Welcome & Notify END // {name:'Separator99', type:'str', minLength:1, maxLength:255, label:'******************** END ********************', required:false} ]; function helperTipMenuMsg() { return msg; } var WHISPER_BACKGROUND = '#ADDFFF'; //#FFFF00 - yellow; #95B9C7 - baby blue; #ADDFFF - light blue var IsWhisperOn = true; var IsSmallDiceOn = false; var IsTinyDiceOn = false; var IsTipMenuOn = false; var IsBriefTipMenuOn = false; var ArTipMenuLastItems = []; var meanBroadcasters = ['missilex']; /* cb.onEnter(function(user) { showAppAd(user['user']); // Code from Roll The Dice by jeffreyvels1994 }); */ /* Title: "Tip Menu Single Line Plus" bot Author: badbadbubba Version: 1.0.0 (03/07/2016) 1.0.1 (09/08/2016) Improved error checking and reporting 1.0.2 (09/09/2016) Added text character separators */ var HEART = '\u2665'; // ♥ BDIAMOND = '\u2666'; // ♦ BSTAR = '\u2605'; // ★ var tip_amt = 0; var separator_char = "| "; var msg; var MAXITEMS=30; var tipmenuprice = []; var tipmenuitem= []; var MAXSEP = 9; separators = [ {label:'Hearts',shortcut:':heart2'}, {label:'Glitter',shortcut:':pixelglitter'}, {label:'Flowers',shortcut:':tinyflower2'}, {label:'Bow',shortcut:':bluebow'}, {label:'Hearts2',shortcut:':pixelheart'}, {label:'Smiley',shortcut:':smile'}, {label:'Text Heart',shortcut:HEART}, {label:'Text Diamond',shortcut:BDIAMOND}, {label:'Text Star',shortcut:BSTAR}, ] cb.onTip(function (tip) { if (IsTipMenuOn) { tip_amt=parseInt(tip['amount']); for (var i = 1; i <= MAXITEMS; i++) { if (tip_amt == tipmenuprice[i]) { cb.sendNotice(tip['from_user'] + ' tipped for ' + tipmenuitem[i],'','',cb.settings['noticecolor'],'bold'); if (IsBriefTipMenuOn) { ArTipMenuLastItems.push(tipmenuitem[i] + ' (' + tipmenuprice[i] + ') '); if (ArTipMenuLastItems.length > 3) { ArTipMenuLastItems.splice(0,1); } } } } } if (IsRollTheDiceOn) { // Roll The Dice by jeffreyvels1994 START tipCounter += parseInt(tip['amount']); if (parseInt(tip['amount']) == cb.settings.tokens) { //kyle: changed to == to only exactly value // if (parseInt(tip['amount']) >= cb.settings.tokens) { var numberOfRolls = Math.floor(parseInt(tip['amount']) / cb.settings.tokens); for (var i = 0; i < numberOfRolls; i++) { roll(tip['from_user']); lastRoller = tip['from_user']; } } else { cb.drawPanel(); } // Roll The Dice by jeffreyvels1994 END } if (IsTreatsOn) { if (parseInt(tip['amount']) == cb.settings.tt_tokens) { var iRnd = Math.round(Math.random() * (arTreats.length - 1)); var msg = '*** Treat Picked: ' + arTreats[iRnd]; var textColor = '#000000'; var bgColor = '#D9FAD7'; cb.sendNotice(msg, '', bgColor, textColor, 'bold'); } } c_ayw.onTip(); }); function chatAd() { if (IsTipMenuOn) { if (IsBriefTipMenuOn) { var sMsg2 = 'Last Tipped: '; sMsg2 += ArTipMenuLastItems.join(' ' + separator_char); sMsg2 += ' ' + separator_char + '(Type /menu for a Full List)'; cb.sendNotice(sMsg2,'','',cb.settings['noticecolor'],'bold'); } else { if (msg!='Tip Menu: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } } function init2() { for (i=0;i<=MAXSEP-1;i++) { if (cb.settings['sepchar'] == separators[i].label) { separator_char = separators[i].shortcut + ' '; } } msg = 'Tip Menu: '; for (i=1;i<=MAXITEMS;i++) { var tmp; tmp=cb.settings['item' + i]; if (tmp) { var arr= tmp.split('--'); if (arr[1]===undefined) { cb.sendNotice('Error-You need two dashes to separate the tip amount and menu item for item no '+ i,'','',cb.settings['noticecolor'],'bold'); } else { var amt=parseInt(arr[0]); if (amt>0) { tipmenuprice[i]=amt; tipmenuitem[i]=arr[1]; if (i>=2) { msg += separator_char; } msg += arr[1] + '(' + amt + ') '; } } } } if (msg!= 'Tip Menu: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } else { cb.sendNotice('Error-No menu items found','','',cb.settings['noticecolor'],'bold'); } } init2(); var IsRollTheDiceOn = true; // Code from Roll The Dice by jeffreyvels1994 var langTokens = (cb.settings.tokens > 1) ? 'tokens' : 'token'; var numberOfSides = (cb.settings.die_type == 'Traditional') ? 6 : 10; var lastRoller = '--'; var lastPrizeWon = '--'; var rollCounter = 0; var tipCounter = 0; var winners = []; var prizes = []; var minimumRollsToGetRareDice = parseInt(cb.settings.minimum_rolls); var maxOutcome = (cb.settings.die_type == 'Traditional') ? 13 : 21; var dieImagePrefix = (cb.settings.die_type == 'Traditional') ? ':reddie' : ':cdie'; cb.onMessage(function (msg) { //adding a mod function to manually roll the dice. var iPowerUser = false; //consider doing poweruser check in profile creation. if (cb.room_slug === msg['user']) { iPowerUser = true; } else if (msg['is_mod']) { iPowerUser = true; } else if (msg['user'] === 'cb_kyle') { iPowerUser = true; } if (iPowerUser) { if (msg['m'].match(/\/cgrolldice/i)) { // roll the dice manually msg['X-Spam'] = true; var sTmp = msg['m'].substring(12); if (sTmp == '') { sTmp = '(Manual Roll)' } roll(sTmp); } else if (msg['m'].match(/\/cgstoprollthedice/i)) { msg['X-Spam'] = true; IsRollTheDiceOn = false; cb.sendNotice('Roll the Dice is now Stopped.', msg['user']); } else if (msg['m'].match(/\/cgstartrollthedice/i)) { msg['X-Spam'] = true; if (!IsRollTheDiceOn) { IsRollTheDiceOn = true; advertise(); } cb.sendNotice('Roll the Dice is now Started.', msg['user']); } else if (msg['m'].match(/\/cghelp/i)) { msg['X-Spam'] = true; cb.sendNotice('COMMANDS: cgHelp | cgStartRollTheDice | cgStopRollTheDice | cgRollDice | cgSmallDice | cgTinyDice ' + '| TipMenuAll | cgAutoYellowWallOnOff | cgAutoYelloWallSetText | cgBriefTipMenuOnOff | AllMenu', msg['user']); } else if (msg['m'].match(/\/cgsmalldice/i)) { msg['X-Spam'] = true; IsSmallDiceOn = !IsSmallDiceOn; cb.sendNotice('Small Dice now: ' + IsSmallDiceOn, msg['user']); } else if (msg['m'].match(/\/cgtinydice/i)) { msg['X-Spam'] = true; IsTinyDiceOn = !IsTinyDiceOn; cb.sendNotice('Tiny Dice now: ' + (IsTinyDiceOn ? 'On' : 'Off'), msg['user']); } else if (IsWhisperOn && (msg['m'].substring(0, 3) === "!w ")) { msg['X-Spam'] = true; var sUser = msg['user']; var sMsg = msg['m'].substring(3); cb.sendNotice('(' + sUser + ') ' + sMsg, cb.room_slug, WHISPER_BACKGROUND); cb.sendNotice('(' + sUser + ') ' + sMsg, '', WHISPER_BACKGROUND, '#000000', 'normal', 'red'); msg['m'] = '(whisper sent)'; } else if (msg['m'].match(/\/tipmenuall/i)) { msg['X-Spam'] = true; if (msg!='Tip Menu: ') { // code for repeating tip menu -- automatically shows the tip menu when people enter. cb.sendNotice(helperTipMenuMsg(), '','',cb.settings['noticecolor'],'bold'); } } else if (msg['m'].match(/\/cgautoyellowwallonoff/i)) { msg['X-Spam'] = true; c_ayw.isOn = !c_ayw.isOn; cb.sendNotice('Auto Yellow Wall is now: ' + (c_ayw.isOn ? 'On' : 'Off'), msg['user']); } else if (msg['m'].match(/\/cgautoyellowallsettext/i)) { msg['X-Spam'] = true; var sTmp1 = msg['m'].substring(24); c_ayw.messageYellowWall = sTmp1; cb.sendNotice('Auto Yellow Wall Text is now: ' + c_ayw.messageYellowWall, msg['user']); } else if (msg['m'].match(/\/cgbrieftipmenuonoff/i)) { msg['X-Spam'] = true; IsBriefTipMenuOn = !IsBriefTipMenuOn; cb.sendNotice('Brief Summary Tip Menu is now: ' + (IsBriefTipMenuOn ? 'On' : 'Off'), msg['user']); } else if (msg['m'].match(/\/allmenu/i)) { // code added for the brief mode in the tip menu. msg['X-Spam'] = true; cb.sendNotice(helperTipMenuMsg(), '', '',cb.settings['noticecolor'],'bold'); } } //code for the original dice game if (msg['m'].match(/\/winners/i)) { msg['X-Spam'] = true; showPrizesWon(msg['user']); } else if (msg['m'].match(/\/lol/i)) { msg['X-Spam'] = true; if (msg['m'].match(/all/i) && ((msg['is_mod'] == true) || (msg['user'] == cb.room_slug))) { showPrizes(); } else { showPrizes(msg['user']); } } else if (msg['m'].match(/\/menu/i)) { // code added for the brief mode in the tip menu. msg['X-Spam'] = true; cb.sendNotice(helperTipMenuMsg(), msg['user'],'',cb.settings['noticecolor'],'bold'); } if (IsFanClubIconOn) { if (msg['in_fanclub']) { checkAndAddFanClubUser(msg['user']); var sMsg = msg['m']; msg['m'] = '' + ((FanClubUsers[msg['user']].FanClubIcon === '') ? arFanClubIcons[0] : FanClubUsers[msg['user']].FanClubIcon) + ' ' + sMsg; } if (msg['m'].match(/\/fanclub/i)) { msg['X-Spam'] = true; var iPos = msg['m'].toLowerCase().indexOf('/fanclub'); var sTmp = ''; if (iPos > 0) { iPos += 9; sTmp = msg['m'].substring(iPos); } if (sTmp === '') { var sMsg = '*** Type /fanclub # (where # is the number listed below to optionally change your Fan Club icon):\n'; for (var i = 0; i < arFanClubIcons.length; i++) { sMsg += '' + (i+1) + ': ' + arFanClubIcons[i] + '\n'; } cb.sendNotice(sMsg, msg['user']); } else { var iTmp = parseInt(sTmp); if (!isNaN(iTmp)) { if (iTmp <= arFanClubIcons.length) FanClubUsers[msg['user']].FanClubIcon = arFanClubIcons[iTmp-1]; cb.sendNotice('Your Fan Club Icon has been updated.', msg['user']); } } } } return msg; }); // code for fanclub icon - BEGIN var IsFanClubIconOn = false; var arFanClubIcons = []; var FanClubUsers = {}; function checkAndAddFanClubUser(psUser) { if (!FanClubUsers.hasOwnProperty(psUser)) { var user = {}; user.FanClubIcon = ''; FanClubUsers[psUser] = user; } } function initFanClubIcon() { if (cb.settings.fc_choices != '') { IsFanClubIconOn = true; var sTmp = '' + cb.settings.fc_choices; arFanClubIcons = sTmp.split('|'); } } initFanClubIcon(); // code for fanclub icon - END cb.onDrawPanel(function (user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Last prize won:', 'row1_value': lastPrizeWon, 'row2_label': 'Last player:', 'row2_value': lastRoller, 'row3_value': tipCounter + ' ' + langTokens + ' received / rolled ' + rollCounter + ' time(s)' }; }); function roll(username) { rollCounter++; var die1 = Math.floor(Math.random() * numberOfSides+1); var die2 = Math.floor(Math.random() * numberOfSides+1); // convoluted logic to appease the dev gods on cb var randomNum = Math.ceil(Math.random() * (100 - minimumRollsToGetRareDice) + minimumRollsToGetRareDice); if (rollCounter == randomNum) { if ((die1 == 1) && (die2 != 1)) die1 = (cb.settings.die_type == 'Traditional') ? 7 : 11; if ((die2 == 1) && (die1 != 1)) die2 = (cb.settings.die_type == 'Traditional') ? 7 : 11; } var total = die1 + die2; var winner = false; if (total >= 1) { winner = true; var prize = cb.settings['prize_' + total]; } else { winner = false; var prize = 'A Thank You!'; } var prizeIndex = prizes.indexOf(prize); if (prizeIndex >= 0) { if (cb.settings.remove_winning_prize == 'Yes') prizes.splice(prizeIndex, 1); } else { prize = 'A Thank You!'; } var msg = ''; if (IsSmallDiceOn) { msg = ":RedDieSmall" + die1 + " " + ":RedDieSmall" + die2 + " "; msg += "#" + total + " " + username + " gets: " + prize; } else if (IsTinyDiceOn) { msg = ":pinkdie" + die1 + " " + ":pinkdie" + die2 + " "; msg += "#" + total + " " + username + " gets: " + prize; } else { msg = dieImagePrefix + die1 + " " + dieImagePrefix + die2 + " #" + total + "\n"; msg += username + " gets: " + prize; } // msg += username + " rolled a " + total + "! \n".toUpperCase(); // msg += "Roll #" + rollCounter + " | Prize: " + prize; var textColor = '#000000'; var bgColor = '#D9FAD7'; if (winner) textColor = '#067D00'; if (total == maxOutcome) { bgColor = '#FFDBF3'; textColor = '#A805A6'; } cb.sendNotice(msg, '', bgColor, textColor, 'bold'); lastPrizeWon = prize; winners.push("Roll #" + rollCounter + " (" + total + "): " + username + " - " + prize); cb.drawPanel(); } function setPrizes() { var rareText = ''; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = " (VERY RARE)"; prizes.push(cb.settings['prize_' + i] + rareText); } } function showPrizes(username) { if (prizes.length) { var rareText = ''; var msg = "##### POSSIBLE PRIZES #####"; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = " (VERY RARE)"; if (prizes.indexOf(cb.settings['prize_' + i] + rareText) >= 0) msg += "\nRoll " + i + " - " + cb.settings['prize_' + i] + rareText; } } else { var msg = "SORRY! There are no prizes left in the list, but thank you for the tip. :thumbsup"; } cb.sendNotice(msg, username, '#DBFBFF', '#008596', 'bold'); } function showPrizesWon(username) { var msg = "##### LAST 40 WINNERS #####"; msg += "\nList sorted in chronological order"; if (winners.length == 0) { cb.sendNotice('No one has won anything yet. Roll the dice to win a prize!', username, '', '', 'bold'); } else { var recentWinners = winners.slice(-40); for (var i = 0; i < recentWinners.length; i++) msg += "\n" + recentWinners[i]; cb.sendNotice(msg, username, '#FFF0DE', '#8A4900', 'bold'); } } function advertise() { showAppAd(); if (IsRollTheDiceOn) { //added by ksh cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } } function showAppAd(username) { var msg = ""; /* if (username != undefined) { msg += "Welcome, " + username + "! We are playing Roll The Dice. \n"; } else { msg += "Roll The Dice by jeffreyvels1994 \n"; } msg += "Tip " + cb.settings.tokens + " " + langTokens + " to roll the dice. \n"; msg += "Commands: \"/lol\", \"/lol all\", \"/winners\"."; */ // msg += "Tip " + cb.settings.tokens + " to Roll Dice by jeffreyvels1994\n"; // msg += "Commands: \"/lol\", \"/lol all\", \"/winners\"."; msg += "Tip " + cb.settings.tokens + " to Roll Dice (prize list: /lol)"; /* msg += "Each roll reveals a prize. There are " + prizes.length + " possible prizes. \n"; if (cb.settings.remove_winning_prize == 'Yes') { msg += "Each prize won will be removed from the list.\n"; } else { msg += "Each prize won will stay on the list.\n"; } msg += "Tip " + cb.settings.tokens + " " + `langTokens` + " to roll the dice. \n"; msg += "Type \"/lol\" to see the list of prizes. \n"; msg += "Type \"/lol all\" to send the list to all viewers if you're a mod or the broadcaster.\n"; msg += "Type \"/winners\" to see a list of the last 20 winners."; */ cb.sendNotice(msg, username, '', '#15A6B0', 'bold'); } function init3() { setPrizes(); // Code from Roll The Dice by jeffreyvels1994 advertise(); // Code from Roll The Dice by jeffreyvels1994 IsTinyDiceOn = true; // set to use tiny "pink" dice } init3(); // code for trick or treet var IsTreatsOn = false; var arTreats = []; function init4(){ if (cb.settings.tt_tokens > 0) { if (cb.settings.tt_treats != '') { IsTreatsOn = true; arTreats = cb.settings.tt_treats.split('|'); } } } init4(); // ****************************************************** /* Welcome & Notify Bot Automatically welcome users and periodically post notifications to the room. Features: - Send a welcome message to all users entering the room. - Regularly post notifications to the room (customizable interval). - Show enter/leave notifications for users that don't have tokens. (All features are optional.) */ /* ========= GLOBAL VARS ==================================== */ // Defaults var greetingEnabled = true; var greeting = 'Welcome to my room, $user!'; var MAX_MESSAGES = 5; var notifyEnabled = true; var notifyInterval = 3 * 60000; // ms var enterLeaveEnabled = false; var fgWelcome = '#800080'; var bgWelcome = ''; var fsWelcome = 'bold'; var fgNotify = '#800080'; var bgNotify = ''; var fsNotify = 'bold'; var fgEnterLeave = '#999999'; var bgEnterLeave = ''; var fsEnterLeave = ''; var msgList = []; var msgIndex = 0; /* ========= CHATURBATE SETTINGS ============================ */ // cb.settings_choices = []; // ksh commented out // 1. Greeting cb.settings_choices.push({ name: 'greetingEnabled', label: 'Welcome message enabled', type: 'choice', choice1: 'yes', choice2: 'no', required: true, defaultValue: greetingEnabled }); cb.settings_choices.push({ name: 'greeting', label: 'Welcome message ($user will be replace by the user\'s name)', type: 'str', required: false, defaultValue: greeting }); // 2. Room messages cb.settings_choices.push({ name: 'notifyEnabled', label: 'Room notifications enabled', type: 'choice', choice1: 'yes', choice2: 'no', required: true, defaultValue: (notifyEnabled ? 'yes' : 'no') }); for (var i = 1; i <= MAX_MESSAGES; i++) { cb.settings_choices.push({ name: 'msg' + i, label: 'Room message ' + i, type: 'str', required: false }); } cb.settings_choices.push({ name: 'notifyInterval', label: 'Delay in minutes between room notifications', type: 'int', minValue: 1, maxValue: 999, required: true, defaultValue: (notifyInterval / 60000) }); // 3. Enter/leave notifications cb.settings_choices.push({ name: 'enterLeaveEnabled', label: 'Display enter/leave notifications for users without tokens', type: 'choice', choice1: 'yes', choice2: 'no', required: true, defaultValue: (enterLeaveEnabled ? 'yes' : 'no') }); // Style "Welcome" cb.settings_choices.push({ name: 'fgWelcome', label: '[Advanced] Foreground color for welcome messages', type: 'str', required: false, defaultValue: fgWelcome }); cb.settings_choices.push({ name: 'bgWelcome', label: '[Advanced] Background color for welcome messages', type: 'str', required: false, defaultValue: bgWelcome }); cb.settings_choices.push({ name: 'fsWelcome', label: '[Advanced] Font style for welcome messages ("normal" or "bold")', type: 'str', required: false, defaultValue: fsWelcome }); // Style "Notifications" cb.settings_choices.push({ name: 'fgNotify', label: '[Advanced] Foreground color for notification messages', type: 'str', required: false, defaultValue: fgNotify }); cb.settings_choices.push({ name: 'bgNotify', label: '[Advanced] Background color for notification messages', type: 'str', required: false, defaultValue: bgNotify }); cb.settings_choices.push({ name: 'fsNotify', label: '[Advanced] Font style for notification messages ("normal" or "bold")', type: 'str', required: false, defaultValue: fsNotify }); /* ========= FUNCTIONS ====================================== */ cb.onEnter(function(user) { if (greetingEnabled && greeting) { var msg2 = greeting.replace('$user', user['user']); cb.sendNotice(msg2, user['user'], bgWelcome, fgWelcome, fsWelcome); } if (!user.has_tokens && enterLeaveEnabled) { cb.sendNotice('Grey user ' + user['user'] + ' has joined the room.', cb.room_slug, bgEnterLeave, fgEnterLeave, fsEnterLeave); } if (msg!='Tip Menu: ') { // code for repeating tip menu -- automatically shows the tip menu when people enter. cb.sendNotice(msg, user['user'],'',cb.settings['noticecolor'],'bold'); } showAppAd(user['user']); // Code from Roll The Dice by jeffreyvels1994 }); cb.onLeave(function(user) { if (!user.has_tokens && enterLeaveEnabled) { cb.sendNotice('Grey user ' + user['user'] + ' has left the room.', cb.room_slug, bgEnterLeave, fgEnterLeave, fsEnterLeave); } }); function notify() { var msg = msgList[msgIndex]; msgIndex++; if (msgIndex >= msgList.length) { msgIndex = 0; } cb.sendNotice(msg, '', bgNotify, fgNotify, fsNotify); cb.setTimeout(notify, notifyInterval); } /* ========= AutoYellowWall ================================= */ cb.settings_choices.push({ name:'Separator_AutoYellowWall', type:'str', minLength:1, maxLength:255, label:'********************', required:false }); cb.settings_choices.push({ name: 'autoYellowWallText', label: 'Enter the emoji or text to enter when yellow wall is trigger (nothing disables). Ex. :YellowWall1 :yellowwall1 ', type: 'str', required: false, defaultValue: '' }); // ************************************************** class AutoYellowWall { constructor() { this._isOn = false; this._count = 0; this._lastTipTime = 0; this._messageYellowWall = ':YellowWall2 '; } //constants get LAST_TIP_MIN_TIME() { return 3000; } // in MILLISECONDS -- 3 seconds get TRIGGER_THRESHOLD() { return 7; } //no spam wait time variable ? //variables get isOn() { return this._isOn; } set isOn(value) { this._isOn = value;} get count() { return this._count; } set count(value) { this._count = value;} get lastTipTime() { return this._lastTipTime; } set lastTipTime(value) { this._lastTipTime = value; } get messageYellowWall() { return this._messageYellowWall;} set messageYellowWall(value) { this._messageYellowWall = value; } //functions toggle() { this._isOn = ! this._isOn; } onTip() { if (this._isOn) { var currentTipTime = Date.now(); if ((currentTipTime - this._lastTipTime) > this.LAST_TIP_MIN_TIME) { this._count = 0; } else { this._count = this._count + 1; if (this._count > this.TRIGGER_THRESHOLD) { this._count = 0; cb.sendNotice(' ' + this._messageYellowWall); } } this._lastTipTime = currentTipTime; } } } // END -- class AutoYellowWall let c_ayw = new AutoYellowWall(); var sAutoYellowWall = cb.settings['autoYellowWallText']; if (sAutoYellowWall != '') { c_ayw.messageYellowWall = sAutoYellowWall; c_ayw.isOn = true; } /* ========= INITIALIZATION ================================= */ function init() { // Prepare settings greetingEnabled = (cb.settings['greetingEnabled'] === 'yes'); greeting = cb.settings['greeting']; notifyEnabled = (cb.settings['notifyEnabled'] === 'yes'); notifyInterval = cb.settings['notifyInterval'] * 60000; for (var i = 1; i <= MAX_MESSAGES; i++) { if (cb.settings['msg' + i]) { msgList.push(cb.settings['msg' + i]); } } enterLeaveEnabled = (cb.settings['enterLeaveEnabled'] === 'yes'); fgWelcome = cb.settings['fgWelcome']; bgWelcome = cb.settings['bgWelcome']; fsWelcome = cb.settings['fsWelcome']; fgNotify = cb.settings['fgNotify']; bgNotify = cb.settings['bgNotify']; fsNotify = cb.settings['fsNotify']; // Start notification loop if (notifyEnabled && msgList.length > 0 && notifyInterval > 0) { cb.setTimeout(notify, notifyInterval); } //check if tip menu is enabled or disabled if (cb.settings['tipmenuEnabled'] == 'yes') { IsTipMenuOn = true; } else { IsTipMenuOn = false; } if (cb.settings['tipmenuBriefModeEnabled'] == 'yes') { IsBriefTipMenuOn = true; } else { IsBriefTipMenuOn = false; } if (IsTipMenuOn) { cb.setTimeout(chatAd, (cb.settings.chat_ad * 30000)); //ksh changed from 60s to 30s at start. This line should prob be in the init2. } } init();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.