Bots Home
|
Create an App
fjngvjdfnvn
Author:
mistressadelle
Description
Source Code
Launch Bot
Current Users
Created by:
Mistressadelle
/** Name: Taylor's Squirt Bot Author: butter_my_toast Created: 11/24/2021 See Change Log on bot description page for revision history **/ //** Enable for ESLINT syntax check, Disable for CB compile //var cb = ''; //var cbjs = ''; let t01brightrainbow = 'linear-gradient(to right, #ff6767, #ffdb9a, #ffff9d, #5fd85f, #9f9fff, #ff9bff)'; let t02pastelrainbow = 'linear-gradient(to right, #ff9a9a, #ffe4b4, #ffffb4, #bfd9bf, #add8e6, #e0d6f4)'; let t03valentines = 'linear-gradient(to right bottom, #ff7373, #ffe1f1)'; let t04christmas = 'linear-gradient(to right bottom, #6bdb6b, #ff9a9a)'; let t05halloween = 'linear-gradient(to right bottom, #ffba67, #ffffb4)'; let t06blue = 'linear-gradient(to right bottom, #a9c4f5, #d4ebf2)'; let t07green = 'linear-gradient(to right bottom, #9fc69f, #cfe3cf)'; let t08pink = 'linear-gradient(to right bottom, #ffb6da, #ffe9ec)'; let t09purple = 'linear-gradient(to right bottom, #c1adea, #dfd5f5)'; let t10blackgray = 'linear-gradient(to right bottom, #c6c6c6, #ececec)'; let t11sunset = 'linear-gradient(to right, #9489c2, #c600fb, #ffa200, #c600fb, #9489c2)'; let t12abv = 'linear-gradient(to right bottom, #00e0ff, #c600fb, #9489c2)'; let t13rwb = 'linear-gradient(to right bottom, #ff0000, #ffffff, #0027c1)'; let t14stpat = 'linear-gradient(to right bottom, #0e7312, #c0e6c3, #0e7312)'; var themeArray = { name: ['Custom', 'Bright Rainbow', 'Pastel Rainbow', 'Valentines', 'Christmas', 'Halloween', 'Shades of Blue', 'Shades of Green', 'Shades of Pink', 'Shades of Purple', 'Black and Gray', 'Sunset', 'Aqua/Blue/Violet', 'Red/White/Blue', 'St Patrick\'s Day' ], shortcut: ['custom', 'brightrainbow', 'pastelrainbow', 'valentines', 'christmas', 'halloween', 'shadesblue', 'shadesgreen', 'shadespink', 'shadespurple', 'blackgray', 'sunset', 'aquablue', 'redwhiteblue', 'stpat' ], colorID: ['custom', t01brightrainbow, t02pastelrainbow, t03valentines, t04christmas, t05halloween, t06blue, t07green, t08pink, t09purple, t10blackgray, t11sunset, t12abv, t13rwb, t14stpat ], textcolor: ['#000000', '#00008b', '#00008b', '#c7006b', '#ffffff', '#000000', '#00008b', '#006400', '#d00068', '#663399', '#000000', '#000000', '#d4ebf2', '#000000', '#024604' ]}; if (cb.room_slug == 'mistressadelle') { //if (cb.room_slug == 'dorothy') { cb.settings_choices = [ {name: 'dummy0', label: '---------------------------------------------------------------------------------------------------- Latest Updt: Nov 24, 2021 (version 1.0) See Change Log for details ----------------------------------------------------------------------------------------------------', type: 'choice',required: false}, {name: 'dummy00', label: 'Welcome Taylor! Enjoy your bot! - chelsea & butter', type: 'choice',required: false}, {name: 'enableEntryMessage', label: 'Enable a "Welcome" message?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'entryMessage', label: '"Welcome" message text -- Note that you can include the substitution text {username} within your welcome text to have the username of the person joining the room show in the welcome message. Just make sure there is a space on either side of {username} so that it is recognized (a comma immediately following is ok). The substitution identifier {n} can also be inserted into the message to force a break to a new line (must also be separated from other text and punctuation by a space)', type: 'str', required: false, minLength: 1, maxLength: 1000, defaultValue: 'Welcome {username} to my room! {n} You can help me try to break my record for squirts in a show! {n} Squirts are done at each goal, and there are also instant squirt tips.'}, {name: 'noticeCurrCount', label: 'Enable Current Show Squirt Count notice?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'noticeCurrCountInt', label: 'Current Show Squirt Count notice display interval -- Defined in minutes. Decimals are ok as long as they are greater than 1. For example, 1.5 = one minute 30 second intervals.', type: 'str', defaultValue: 5.1, required: false}, {name: 'noticeAllTimeCount', label: 'Enable All-time Squirt Count Record notice?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'allTimeSquirtRecord', label: 'All-time Single Show Squirt Record', type: 'int', minValue: 1, maxValue: 999, defaultValue: 1}, {name: 'noticeAllTimeCountInt', label: 'All-time Squirt Count Record notice display interval -- Defined in minutes. Decimals are ok as long as they are greater than 1. For example, 1.5 = one minute 30 second intervals.', type: 'str', defaultValue: 7.3, required: false}, {name: 'alltimeCountText', label: 'All-time Record Notice text -- Note that you can include the substitution text {alltime} within your recurring notice text to have the All-time Record Count display in its place. The substitution text {n} can also be inserted into the message to force a break to a new line. Once the current show count is within 10 of the All-time record, a countdown will automatically be added to the end of the message', type: 'str', required: false, minLength: 1, maxLength: 1000, defaultValue: 'My all-time record for squirts in a show is {alltime} !!!'}, {name: 'colorTheme', label: 'Color theme to use in recurring notice text backgrounds?', type: 'choice', choice1: themeArray.name[0], choice2: themeArray.name[1], choice3: themeArray.name[2], choice4: themeArray.name[3], choice5: themeArray.name[4], choice6: themeArray.name[5], choice7: themeArray.name[6], choice8: themeArray.name[7], choice9: themeArray.name[8], choice10: themeArray.name[9], choice11: themeArray.name[10], choice12: themeArray.name[11], choice13: themeArray.name[12], choice14: themeArray.name[13], choice15: themeArray.name[14], choice16: themeArray.name[15], defaultValue: themeArray.name[6]}, {name: 'colorThemeCustBg1', label: 'Custom Color 1 - If you chose to create a "Custom" color theme above in setting, enter the hex color code for background color 1 ("#" prefix plus the 6 character hex color codes, such #ffffff)', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'colorThemeCustBg2', label: '4B2. Custom Color 2 - If you chose to create a "Custom" color theme above in setting, enter the hex color code for background color 2, it will default to white (#ffffff) if none is chosen as two colors are required', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'colorThemeCustBg3', label: '4B3. Custom Color 3 - If you chose to create a "Custom" color theme above in setting, enter the hex color code for background color 3 (optional)', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'colorThemeCustText', label: '4B4. Custom Text Color - If you chose to create a "Custom" color theme above in setting, enter the hex color code for text - it will default to white if none is chosen', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'colorsGradientDirection', label: '4C. Use a color gradient (gradual fade from one color to another) in all recurring notice backgrounds? -- This will trigger all background highlighting in the different recurring notices to follow a similar gradient pattern. If choosing "Linear" for the gradual color change (from the defined color to white), you can also choose the direction of the fade - left right, top to bottom, or diagonal. Note that the gradient setting only affects the shading pattern, the actual colors used are defined either in the individual bot feature sections or overriden above in setting "4A" or "4B1-3". Also note that if a pre-configured color theme is used above, the gradient direction is unique to the theme and this gradient setting will be ignored', type: 'choice', choice1: 'No', choice2: 'Linear, left to right', choice3: 'Linear, top to bottom', choice4: 'Linear, diagonally', defaultValue: 'Linear, diagonally'}, {name: 'noticeSepStyle', label: '4D1. Notice Border Style -- This control how the top and bottom border of several of the recurring notices is displayed. You can choose from the defined options here, or use the below setting for "4D2" to define your own emoji or other character. Depending on the type you choose, the spacing of the border will be different, so be sure to select the matching type here for the emoji or character you set below.', type: 'choice', choice1: 'No Border', choice2: 'Light Dashed Line', choice3: 'Heavy Dashed Line', choice4: 'Custom Emoji Below', choice5: 'Custom Unicode Character Below', defaultValue: 'Light Dashed Line'}, {name: 'borderChar', label: '4D2. Notice Border emoji or text/unicode character -- For an emoji or unicode character, paste the actual emoji/image here, not the code (not \u2580 for example). Note that most unicode characters have the benfit of being the same color as your text. The borders are currently used for leaderboard, media info, room rules, dice game, and icon tip notices. Do NOT use a CB icon here, if you do, it will default to "Heavy Dashed Line". You can use the command /setbrdsep to update the emoji separator during your show and play around with them to find one that has the color and spacing you are looking for.', type: 'str', minLength: 0, maxLength: 2, required: false}, {name: 'textWrapLength', label: '4E. Set the number of characters at which to wrap a long line of text to next line. Same setting is used in the welcome message, notifier, room rules, and media list intro. Default is 80 as that typically fits the width of the border for recurring notices, and must be at least 25 or set to zero to disable automatic line wrapping. Values from 1-24 will default to 25', type: 'int', minValue: 0, maxValue: 120, defaultValue: 80} ]; } else { cb.settings_choices = [ {name: 'dummy0', label: 'Sorry, this bot can only be used by Taylor Love.', type: 'choice',required: false}, ]; } // *********************************** Variables and Arrays ************************************** var initialize = 0; var BC = cb.room_slug; var botName = 'Squirt Bot: '; var borderChar = cb.settings.borderChar; var borderCharSpacing = ''; var currCountToggle = false; var alltimeCountToggle = false; var recBrokeThisShow = false; var colorTheme = cb.settings.colorTheme; var wrapMaxLength = cb.settings.textWrapLength; var currentSquirtCount = 0; var currCntInt = 5.1; var alltimeCntInt = 7.3; var alltimeSquirtCount = cb.settings.allTimeSquirtRecord; var noticeBgColor = ''; var noticeTextColor = ''; var appNoticeColor = '#a2dfac'; var appWarningColor = '#f4d599'; var borderNotifierTop = ''; var borderNotifierBottom = ''; var borderWelcomeTop = ''; var borderWelcomeBottom = ''; var noticeOnlyBC = botName + ' Only broadcasters are able to use that command.'; var noticeOnlyBCMod1 = botName + ' Only broadcasters and moderators are able to use that command.'; var noticeEmoji = '\uD83D\uDCA6 '; // *********************************** Initialize ************************************** if (initialize == 0) { cb.sendNotice('Taylor\'s Squirt Bot v1.0 updated November 24, 2021'); if (wrapMaxLength > 0 && wrapMaxLength < 25) { wrapMaxLength = 25; cb.sendNotice(botName + ' The Word Wrap width is too small, must be at least 25 if not set to zero, defaulting to 25.', BC, appNoticeColor); } noticeBgColor = setThemeBgColor(BC); noticeTextColor = setThemeTextColor(BC); noticeBorderChar(); if (cb.settings.noticeSepStyle == 'Custom Emoji Below' && cb.settings.borderChar) { noticeEmoji = cb.settings.borderChar + ' '; } if (cb.settings.noticeCurrCount == 'Yes') { initCurrCountTimer(); } if (cb.settings.noticeAllTimeCount == 'Yes') { initAlltimeCountTimer(); } initialize = 1; } // Generic functions to set the color or separator characters function customizeColorTheme(newcolortheme,newthemesendto) { if (cbjs.arrayContains(themeArray.shortcut,newcolortheme)) { var themeindex = themeArray.shortcut.indexOf(newcolortheme); if (newcolortheme == 'custom') { if (cb.settings.colorThemeCustBg1) { if (cb.settings.colorThemeCustText) { colorTheme = 'Custom'; cb.sendNotice('You have updated the color theme to "Custom".', newthemesendto, appNoticeColor, ''); setThemeBgColor(newthemesendto); setThemeTextColor(newthemesendto); } else { cb.sendNotice('You have requested a custom color theme, but a custom text color is not defined in setting "4B4".', newthemesendto, appNoticeColor, ''); } } else { cb.sendNotice('You have requested a custom color theme, but at least one custom color is not defined in setting "4B1".', newthemesendto, appNoticeColor, ''); } } else { colorTheme = themeArray.name[themeindex]; setThemeBgColor(newthemesendto); setThemeTextColor(newthemesendto); cb.sendNotice('You have updated the color theme to "' + colorTheme + '".', newthemesendto, appNoticeColor, ''); } } else { cb.sendNotice('Invalid color theme name. The valid names are: \n' + cbjs.arrayJoin(themeArray.shortcut, ', '), newthemesendto, appNoticeColor, ''); } } function setThemeTextColor(sttcsendto) { var selectedthemetextcolor = '#000000'; if (colorTheme == 'Custom') { var temptextcolor = cb.settings.colorThemeCustText; if (/^#[0-9A-F]{6}$/i.test(temptextcolor)) { selectedthemetextcolor = temptextcolor; } else if (/^[0-9A-F]{6}$/i.test(temptextcolor)) { selectedthemetextcolor = '#' + temptextcolor; } else { cb.sendNotice(botName + ' ' + temptextcolor + ' - Error while setting the text color. It must be in a HEX code format. Using default value of black text.', sttcsendto, appNoticeColor); } } else { if (cbjs.arrayContains(themeArray.name,colorTheme)) { let themeidx = themeArray.name.indexOf(colorTheme); return themeArray.textcolor[themeidx]; } else { cb.sendNotice(botName + ' Warning! Invalid theme setting of "' + colorTheme + '". \nDefaulting to no theme used.', sttcsendto, appWarningColor); colorTheme = 'None'; } } return selectedthemetextcolor; } function setThemeBgColor(setthemeby) { var selectedthemebgcolor = '#FFFFFF'; if (colorTheme == 'Custom') { var graddir = ''; if (cb.settings.colorsGradientDirection == 'Linear, left to right') { graddir = 'to right'; } else if (cb.settings.colorsGradientDirection == 'Linear, top to bottom') { graddir = 'to bottom'; } else if (cb.settings.colorsGradientDirection == 'Linear, diagonally') { graddir = 'to right bottom'; } else if (cb.settings.colorsGradientDirection == 'No') { graddir = 'to right bottom'; } var themecustbg1 = ''; var themecustbg2 = ''; var themecustbg3 = ''; if (cb.settings.colorThemeCustBg1) { if (/^#[0-9A-F]{6}$/i.test(cb.settings.colorThemeCustBg1)) { themecustbg1 = cb.settings.colorThemeCustBg1; } else if (/^[0-9A-F]{6}$/i.test(cb.settings.colorThemeCustBg1)) { themecustbg1 = '#' + cb.settings.colorThemeCustBg1; } else { cb.sendNotice(botName + ' Warning! Custom color theme selected but Background 1 is not in the correct hex color code format. \nDefaulting to no theme used.', setthemeby, appWarningColor); colorTheme = 'None'; } } else { cb.sendNotice(botName + ' Warning! Custom color theme selected but Background 1 is not configured. \nDefaulting to no theme used.', setthemeby, appWarningColor); colorTheme = 'None'; } if (cb.settings.colorThemeCustBg2) { if (/^#[0-9A-F]{6}$/i.test(cb.settings.colorThemeCustBg2)) { themecustbg2 = cb.settings.colorThemeCustBg2; } else if (/^[0-9A-F]{6}$/i.test(cb.settings.colorThemeCustBg2)) { themecustbg2 = '#' + cb.settings.colorThemeCustBg2; } else { themecustbg2 = '#FFFFFF'; cb.sendNotice(botName + ' Warning! Custom color theme selected but Background 2 is not configured with a proper hex color code. \nDefaulting second color to white.', setthemeby, appWarningColor); } } else { themecustbg2 = '#FFFFFF'; cb.sendNotice(botName + ' Warning! Custom color theme selected but Background 2 is not configured. \nAt least two colors are required, defaulting second color to white.', setthemeby, appWarningColor); } var numbercustcolors = 2; if (cb.settings.colorThemeCustBg3) { numbercustcolors = 3; if (/^#[0-9A-F]{6}$/i.test(cb.settings.colorThemeCustBg3)) { themecustbg3 = cb.settings.colorThemeCustBg3; } else if (/^[0-9A-F]{6}$/i.test(cb.settings.colorThemeCustBg3)) { themecustbg3 = '#' + cb.settings.colorThemeCustBg3; } else { themecustbg3 = '#FFFFFF'; } } if (colorTheme != 'None') { if (numbercustcolors == 2) { selectedthemebgcolor = 'linear-gradient(' + graddir + ', ' + themecustbg1 + ', ' + themecustbg2 + ')'; } else { selectedthemebgcolor = 'linear-gradient(' + graddir + ', ' + themecustbg1 + ', ' + themecustbg2 + ', ' + themecustbg3 + ')'; } } } else { if (cbjs.arrayContains(themeArray.name,colorTheme)) { let themeidx = themeArray.name.indexOf(colorTheme); selectedthemebgcolor = themeArray.colorID[themeidx]; } else { cb.sendNotice(botName + ' Warning! Invalid theme setting of "' + colorTheme + '". \nDefaulting to no theme used.', setthemeby, appWarningColor); colorTheme = 'None'; } } return selectedthemebgcolor; } //********** Word Wrap and Next Line Functions ************** function checkNextLine(nlmessage) { var nlmessagearray = nlmessage.split(' '); var nllinearray = []; var templinearray = []; var lineidx = 0; var currlineidx = 0; var nlreplace = false; var nlsubfound = true; while (nlsubfound) { if (cbjs.arrayContains(nlmessagearray,'{n}')) { let nlmsgindex = nlmessagearray.indexOf('{n}'); nlmessagearray[nlmsgindex] = '\n'; templinearray = nlmessagearray.slice(currlineidx,nlmsgindex); nllinearray[lineidx] = wordWrap(cbjs.arrayJoin(templinearray,' ')); templinearray = nlmessagearray.slice(nlmsgindex+1); nllinearray[lineidx+1] = wordWrap(cbjs.arrayJoin(templinearray,' ')); lineidx++; currlineidx = nlmsgindex+1; nlreplace = true; } else { nlsubfound = false; } } if (nlreplace) { return cbjs.arrayJoin(nllinearray,'\n'); } else { return wordWrap(nlmessage); } } function wordWrap(wrapstring) { if (wrapMaxLength > 0) { let newlinechar = '\n'; let splitstring = ''; while (wrapstring.length > wrapMaxLength) { let spacefound = false; for (var wwidx = wrapMaxLength - 1; wwidx >= 0; wwidx--) { if (testWhite(wrapstring.charAt(wwidx))) { splitstring = splitstring + [wrapstring.slice(0, wwidx), newlinechar].join(''); wrapstring = wrapstring.slice(wwidx + 1); spacefound = true; break; } } if (!spacefound) { splitstring += [wrapstring.slice(0, wrapMaxLength), newlinechar].join(''); wrapstring = wrapstring.slice(wrapMaxLength); } } return splitstring + wrapstring; } else { return wrapstring; } } function testWhite(whitestring) { var white = new RegExp(/^\s$/); return white.test(whitestring.charAt(0)); } //********** Check Username Function ************** function checkUsername(chkusrmessage,chkuser) { let responsemessagearray = chkusrmessage.split(' '); let chkusrreplace = false; if (cbjs.arrayContains(responsemessagearray,'{username}')) { let chkusrmsgindex = responsemessagearray.indexOf('{username}'); responsemessagearray[chkusrmsgindex] = chkuser; chkusrreplace = true; } else if (cbjs.arrayContains(responsemessagearray,'{username},')) { let chkusrmsgindex = responsemessagearray.indexOf('{username},'); responsemessagearray[chkusrmsgindex] = chkuser + ','; chkusrreplace = true; } else if (cbjs.arrayContains(responsemessagearray,'{username}!')) { let chkusrmsgindex = responsemessagearray.indexOf('{username}!'); responsemessagearray[chkusrmsgindex] = chkuser + '!'; chkusrreplace = true; } else if (cbjs.arrayContains(responsemessagearray,'{username}:')) { let chkusrmsgindex = responsemessagearray.indexOf('{username}:'); responsemessagearray[chkusrmsgindex] = chkuser + ':'; chkusrreplace = true; } else if (cbjs.arrayContains(responsemessagearray,'{username}.')) { let chkusrmsgindex = responsemessagearray.indexOf('{username}.'); responsemessagearray[chkusrmsgindex] = chkuser + '.'; chkusrreplace = true; } if (chkusrreplace) { return cbjs.arrayJoin(responsemessagearray,' '); } else { return chkusrmessage; } } //********** Build Repeating Char Lines ************** function noticeBorderChar() { if (cb.settings.noticeSepStyle == 'Custom Emoji Below') { borderCharSpacing = 'emoji'; if (borderChar) { if (borderChar.includes(':') || borderChar.includes('\\')) { cb.sendNotice(botName + ' You have configured configured the notice border style as "Custom Emoji" but the value contains ":" or "\\" (CB gifs are not allowed). Defaulting to an emoji of Heavy Dashed Line " \u2796 ".', BC, appWarningColor); borderChar = '\u2796'; } } else { borderChar = '\u2796'; cb.sendNotice(botName + ' You have configured configured the notice border style as "Custom Emoji" but an emoji is not defined. Defaulting to an emoji of Heavy Dashed Line " \u2796 ".', BC, appWarningColor); } } else if (cb.settings.noticeSepStyle == 'Custom Unicode Character Below') { borderCharSpacing = 'unicode'; if (borderChar) { if (borderChar.includes(':')) { cb.sendNotice(botName + ' You have configured configured the notice border style as "Custom Unicode Character" but the value contains ":" (CB gifs are not allowed). Defaulting to a character of Heavy Dashed Line " \u268A ".', BC, appWarningColor); borderChar = '\u268A'; } } else { borderChar = '\u268A'; cb.sendNotice(botName + ' You have configured configured the notice border style as "Custom Unicode Character" but a character is not defined. Defaulting to a character of Heavy Dashed Line " \u268A ".', BC, appWarningColor); } } else if (cb.settings.noticeSepStyle == 'Heavy Dashed Line') { borderCharSpacing = 'unicode'; borderChar = '\u268A'; } else if (cb.settings.noticeSepStyle == 'Light Dashed Line') { borderCharSpacing = 'light'; borderChar = '-'; } else { borderCharSpacing = 'none'; } switch (borderCharSpacing) { case 'emoji': borderNotifierTop = noticeBorder('top','',12,false,true); borderNotifierBottom = noticeBorder('bottom','',12,false,true); borderWelcomeTop = noticeBorder('top','WELCOME',10,true,true); borderWelcomeBottom = noticeBorder('bottom','',12,false,true); break; case 'unicode': borderNotifierTop = noticeBorder('top','\u2666',21,false,false); borderNotifierBottom = noticeBorder('bottom','',21,false,false); borderWelcomeTop = noticeBorder('top','WELCOME',19,true,false); borderWelcomeBottom = noticeBorder('bottom','',22,false,false); break; case 'light': borderNotifierTop = noticeBorder('top','\u2666',48,false,false); borderNotifierBottom = noticeBorder('bottom','',48,false,false); borderWelcomeTop = noticeBorder('top','WELCOME',42,true,false); borderWelcomeBottom = noticeBorder('bottom','',48,false,false); break; case 'none': borderNotifierTop = ''; borderWelcomeTop = noticeBorder('top','WELCOME:',0,false,false); break; } } function noticeBorder(bordertopbtm,bordertext,bordernumchar,bordernumaddone,borderdispspace) { let outcharstring = ''; let halfcharstring = ''; let midchar = '\u2666'; let dispnumber = 0; if (borderCharSpacing == 'none') { if (bordertopbtm == 'top') { outcharstring = bordertext; } } else { for (let charidx = 1; charidx <= bordernumchar; charidx++) { if (borderdispspace) { halfcharstring += borderChar + ' '; } else { halfcharstring += borderChar; } } if (bordertopbtm == 'top') { outcharstring += halfcharstring + ' ' + bordertext + ' ' + halfcharstring; if (bordernumaddone) { outcharstring += borderChar; } } else if (bordertopbtm == 'bottom') { if (borderdispspace) { outcharstring += halfcharstring + halfcharstring; } else { outcharstring += halfcharstring + ' ' + midchar + ' ' + halfcharstring; } } } return outcharstring; } //********** Chat Notice Functions ************** function initCurrCountTimer() { if (isNaN(parseFloat(cb.settings.noticeCurrCountInt))) { cb.sendNotice(botName + ' Current Show Count Notice interval is not set with a valid number so the Notice is not enabled.', BC, appWarningColor); currCntInt = 0; } else { currCntInt = parseFloat(cb.settings.noticeCurrCountInt); } if (currCntInt != 0) { if (currCntInt < 1) { cb.sendNotice(botName + ' Current Show Count Notice interval is too short, it must be at least 1 min. Using a default value of 5.1 minutes.', BC, appNoticeColor); currCntInt = 5.1; } currCntInt = parseInt(currCntInt * 60000) cb.setTimeout(displayCurrentCount,currCntInt); } } function displayCurrentCount() { let currcntmsg = ''; if (cb.settings.noticeSepStyle != 'No Border') { currcntmsg += borderNotifierTop + '\n'; } currcntmsg += noticeEmoji + 'Squirt count for this show: ' + currentSquirtCount + '\n' + noticeEmoji + 'Squirts are performed at goals and also for specific tip amounts!'; if (cb.settings.noticeSepStyle != 'No Border') { currcntmsg += '\n' + borderNotifierBottom; } cb.sendNotice(currcntmsg, '', noticeBgColor, noticeTextColor, 'bold'); cb.setTimeout(displayCurrentCount,currCntInt); } function initAlltimeCountTimer() { if (isNaN(parseFloat(cb.settings.noticeAllTimeCountInt))) { cb.sendNotice(botName + 'All-time Record Notice interval is not set with a valid number so the Notice is not enabled.', BC, appWarningColor); alltimeCntInt = 0; } else { alltimeCntInt = parseFloat(cb.settings.noticeAllTimeCountInt); } if (alltimeCntInt != 0) { if (alltimeCntInt < 1) { cb.sendNotice(botName + 'All-time Record Notice interval is too short, it must be at least 1 min. Using a default value of 7.3 minutes.', BC, appNoticeColor); alltimeCntInt = 7.3; } alltimeCntInt = parseInt(alltimeCntInt * 60000) cb.setTimeout(displayAlltimeCount,alltimeCntInt); } } function displayAlltimeCount() { let alltimecntmsg = ''; if (cb.settings.noticeSepStyle != 'No Border') { alltimecntmsg += borderNotifierTop + '\n'; } let squirtsleft = (alltimeSquirtCount - currentSquirtCount) + 1; let countdowntext = ''; if (recBrokeThisShow) { alltimecntmsg += noticeEmoji + noticeEmoji + '\uD83C\uDFC6 We have broken my record for squirts in one show !! \uD83C\uDFC6 ' + noticeEmoji + noticeEmoji; alltimecntmsg += '\n' + noticeEmoji + noticeEmoji + noticeEmoji + noticeEmoji + noticeEmoji + '\uD83C\uDFC6 My new all-time record is now ' + alltimeSquirtCount + ' !! \uD83C\uDFC6 ' + noticeEmoji + noticeEmoji + noticeEmoji + noticeEmoji + noticeEmoji; } else { if (squirtsleft == 0) { alltimecntmsg += noticeEmoji + 'We have tied my all-time record!' + noticeEmoji + '\nOne more squirt will break my record for a show!\n'; } else if (squirtsleft <= 10) { alltimecntmsg += noticeEmoji + 'Only ' + squirtsleft + (squirtsleft == 1 ? ' squirt' : ' squirts') + ' away from breaking my all-time record for a show!\n'; } alltimecntmsg += noticeEmoji + 'My all-time record for squirts in a show is ' + alltimeSquirtCount + ' !'; } if (cb.settings.noticeSepStyle != 'No Border') { alltimecntmsg += '\n' + borderNotifierBottom; } cb.sendNotice(alltimecntmsg, '', noticeBgColor, noticeTextColor, 'bold'); cb.setTimeout(displayAlltimeCount,alltimeCntInt); } // ******************************* Upon user entry of a Message ************************************** if (cb.room_slug == 'taylor_love_303') { //if (cb.room_slug == 'dorothy') { cb.onMessage(function (msg) { let rawmsg = msg.m; let messagearray = msg.m.split(' '); let msguser = msg.user; let msgismod = msg.is_mod; let msgisbc = (msguser === BC); let command = messagearray[0]; if (messagearray[0].charAt(0) == '/') { msg['X-Spam'] = true; switch(command) { case '/chgtheme': { if (msgisbc || msgismod) { if (messagearray[1]) { let newtheme = messagearray[1].toLowerCase(); customizeColorTheme(newtheme,msguser); } else { cb.sendNotice(botName + 'The /chgtheme command requires the entry of a parameter following the command, such as "/chgtheme pastelrainbow". The valid formats are: \n' + cbjs.arrayJoin(themeArray.shortcut, ', '), msguser, appNoticeColor); } } else { cb.sendNotice(noticeOnlyBCMod1, msguser, appNoticeColor); } break; } case '/setbrdsep': { if (msgismod || msgisbc) { if (cb.settings.noticeSepStyle == 'Heavy Dashed Line' || cb.settings.noticeSepStyle == 'Light Dashed Line' || cb.settings.noticeSepStyle == 'No Border') { cb.sendNotice(botName + ' The notice border character can only be updated if the bot is configured for a custom emoji or custom unicode character.', msguser, appNoticeColor); } else if (!messagearray[1]) { cb.sendNotice(botName + ' Parameter for new border separator is not specified.', msguser, appNoticeColor); } else { borderChar = messagearray[1]; noticeBorderChar(); cb.sendNotice(botName + ' Separator has been updated to " ' + borderChar + ' ".', msguser, appNoticeColor); } } else { cb.sendNotice(noticeOnlyBCMod1, msguser, appNoticeColor); } break; } case '/squirt': { if (msgismod || msgisbc) { currentSquirtCount++; if (!recBrokeThisShow) { if (currentSquirtCount == alltimeSquirtCount) { let squirtmsg = ''; if (cb.settings.noticeSepStyle != 'No Border') { squirtmsg += borderNotifierTop + '\n'; } squirtmsg += noticeEmoji + 'We have tied my all-time record for squirts in a single show (' + currentSquirtCount + ')! ' + noticeEmoji; if (cb.settings.noticeSepStyle != 'No Border') { squirtmsg += '\n' + borderNotifierBottom; } cb.sendNotice(squirtmsg, '', noticeBgColor, noticeTextColor, 'bold'); } else if (currentSquirtCount > alltimeSquirtCount) { let squirtmsg2 = ''; if (cb.settings.noticeSepStyle != 'No Border') { squirtmsg2 += borderNotifierTop + '\n'; } squirtmsg2 += noticeEmoji + '\uD83C\uDFC6 ' + noticeEmoji + 'We have broken my record for squirts in a show !!!!! ' + noticeEmoji + '\uD83C\uDFC6 ' + noticeEmoji; if (cb.settings.noticeSepStyle != 'No Border') { squirtmsg2 += '\n' + borderNotifierBottom; } cb.sendNotice(squirtmsg2, '', noticeBgColor, noticeTextColor, 'bold'); alltimeSquirtCount = currentSquirtCount; recBrokeThisShow = true; } else { cb.sendNotice(' \uD83D\uDCA6 One Squirt Added! Current count: ' + currentSquirtCount + ' \uD83D\uDCA6', '', noticeBgColor, noticeTextColor, 'bold'); } } else { cb.sendNotice(' \uD83D\uDCA6 One Squirt Added! Current count: ' + currentSquirtCount + ' \uD83D\uDCA6', '', noticeBgColor, noticeTextColor, 'bold'); } } else { cb.sendNotice(noticeOnlyBCMod1,msguser,appNoticeColor); } break; } case '/squirttotal': { if (msgismod || msgisbc) { if (messagearray[1]) { let newtotal = parseInt(messagearray[1]); if (isNaN(newtotal)) { cb.sendNotice(botName + 'The new value for the squirt count total must be an intger from 1 to 999.', msguser, appNoticeColor); } else if (newtotal < 1 || newtotal > 999) { cb.sendNotice(botName + 'The new value for the squirt count total must be an intger from 1 to 999.', msguser, appNoticeColor); } else { currentSquirtCount = newtotal; if (!recBrokeThisShow) { if (currentSquirtCount == alltimeSquirtCount) { let squirttotalmsg = ''; if (cb.settings.noticeSepStyle != 'No Border') { squirttotalmsg += borderNotifierTop + '\n'; } squirttotalmsg += noticeEmoji + 'We have tied my all-time record for squirts in a single show (' + currentSquirtCount + ')! ' + noticeEmoji; if (cb.settings.noticeSepStyle != 'No Border') { squirttotalmsg += '\n' + borderNotifierBottom; } cb.sendNotice(squirttotalmsg, '', noticeBgColor, noticeTextColor, 'bold'); } else if (currentSquirtCount > alltimeSquirtCount) { let squirttotalmsg2 = ''; if (cb.settings.noticeSepStyle != 'No Border') { squirttotalmsg2 += borderNotifierTop + '\n'; } squirttotalmsg2 += noticeEmoji + '\uD83C\uDFC6 ' + noticeEmoji + 'We have broken my record for squirts in a show (' + currentSquirtCount + ')!!! ' + noticeEmoji + '\uD83C\uDFC6 ' + noticeEmoji; if (cb.settings.noticeSepStyle != 'No Border') { squirttotalmsg2 += '\n' + borderNotifierBottom; } cb.sendNotice(squirttotalmsg2, '', noticeBgColor, noticeTextColor, 'bold'); alltimeSquirtCount = currentSquirtCount; recBrokeThisShow = true; } else { cb.sendNotice(botName + 'You have updated the squirt count total to ' + currentSquirtCount + '.', msguser, appNoticeColor); if (msguser != BC) { cb.sendNotice(botName + 'The squirt count total has been updated to ' + currentSquirtCount + '.', BC, appNoticeColor); } } } else { cb.sendNotice(botName + 'You have updated the squirt count total to ' + currentSquirtCount + '.', msguser, appNoticeColor); if (msguser != BC) { cb.sendNotice(botName + 'The squirt count total has been updated to ' + currentSquirtCount + '.', BC, appNoticeColor); } } } } else { cb.sendNotice(botName + ' This command requires a parameter to define the new squirt total, for example to update the count to five, the command would be: /squirttotal 5', msguser, appNoticeColor); } } else { cb.sendNotice(noticeOnlyBCMod1,msguser,appNoticeColor); } break; } } } return msg; }); } // *********************************** Actions on user entering ************************************** if (cb.room_slug == 'taylor_love_303') { //if (cb.room_slug == 'dorothy') { cb.onEnter(function(user) { let enteruser = user.user; let enterisbc = (enteruser == BC); let enterisgray = true; if (user.has_tokens) { enterisgray = false; } if (cb.settings.enableEntryMessage == 'Yes' && !enterisgray && !enterisbc) { let entryMessage = borderWelcomeTop; entryMessage += '\n' + checkUsername(checkNextLine(cb.settings.entryMessage),enteruser); if (cb.settings.noticeSepStyle != 'No Border') { entryMessage += '\n' + borderWelcomeBottom; } cb.sendNotice(entryMessage, enteruser, noticeBgColor, noticeTextColor, 'bold'); } }); } // *********************************** Actions upon leaving ************************************** cb.onLeave(function(user) { }); // ******************************* Actions upon following ************************************** cb.onFollow(function(user) { }); // *********************************** Actions upon tipping ************************************** cb.onTip(function (tip) { });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.