Bots Home
|
Create an App
Insy Spy Show Fixed
Author:
harypotter
Description
Source Code
Launch Bot
Current Users
Created by:
Harypotter
/** * Title: Insy Spy Show v.3.1.3 * Author: insidioso77 * Version: 3.1.3 January 9, 2022 * Description: All in One Bot including hidden show - The cam is only visible to those who tips for minutes or for the whole Hidden Spy Show. */ var EMOJI_FANS = '\u2657', EMOJI_KING = '\ud83c\udfc6', //'\u2654', EMOJI_NOENTRY = '\u26D4', EMOJI_EXCLAMATION = '\u2757', EMOJI_CROSS = '\ud83d\udeab', //'\u274C', EMOJI_CHECK = '\ud83c\udd97', //'\u2714', EMOJI_SPARKLES = '\u2728', EMOJI_VICTORY = '\u270C', EMOJI_HEART = '\u2764', EMOJI_HEART_LB = '\ud83d\udc97', EMOJI_EQUALS = '\u003D', EMOJI_PLUS = '\u002B', EMOJI_LOCK = '\ud83d\udd12', EMOJI_UNLOCK = '\ud83d\udd13', EMOJI_ARROW = '\u2192', // → EMOJI_RIGHT_POINTING = '\u21dd', // '\ud83d\udc49', EMOJI_LEFT_POINTING = '\u21dc', //'\ud83d\udc48', EMOJI_BOT = '\u2728', EMOJI_LOW_BRIGHTNESS = '\ud83d\udd05', EMOJI_HIGH_BRIGHTNESS = '\ud83d\udd06'; var COLOR_YELLOW = '#FFFF33', COLOR_BLACK = '#000000', COLOR_WHITE = '#FFFFFF', COLOR_ORANGE = '#F47321', COLOR_GREEN = '#00FF00', COLOR_NEON_PURPLE = '#BC13FE'; var usersspam = [cb.room_slug]; //var pass=Math.floor((Math.random() * 9000) + 1001); var imin = Math.ceil(0); var imax = Math.floor(10); var number1 = Math.floor(Math.random() * (imax - imin) + imin); var number2 = Math.floor(Math.random() * (imax - imin) + imin); var number3 = Math.floor(Math.random() * (imax - imin) + imin); var number4 = Math.floor(Math.random() * (imax - imin) + imin); var number5 = Math.floor(Math.random() * (imax - imin) + imin); var number6 = Math.floor(Math.random() * (imax - imin) + imin); var number = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; var pass = number1 + "" + number2 + "" + number3 + "" + number4 + "" + number5 + "" + number6; var usernotice1 = "To prevent spambots users without tokens please enter the following number to be able to chat.\n"; var usernotice2 = number[number1] + " " + number[number2] + " " + number[number3] + " " + number[number4] + " " + number[number5] + " " + number[number6] + " (enter as a number , e.g. 423697)"; var usernotice3 = usernotice1 + usernotice2; var insyrainsymbol = [ '\ud83d\udc8e',//U+1F48E: GEM STONE '\ud83c\udf4c',//U+1F34C: BANANA '\ud83d\udc93',//U+1F493: BEATING HEART '\ud83d\udc96',//U+1F496: SPARKLING HEART '\ud83d\udcab',//U+1F4AB: DIZZY SYMBOL '\ud83c\udf8a',//U+1F38A: CONFETTI BALL '\ud83d\udd25',//U+1F525: FIRE '\ud83d\udcb2',//U+1F4B2: HEAVY DOLLAR SIGN '\ud83d\ude0d',//U+1F60D: SMILING FACE WITH HEART-SHAPED EYES '\ud83d\udc9d',//U+1F49D: HEART WITH RIBBON '\ud83d\udc8b',//U+1F48B: KISS MARK '\ud83c\udfb6',//U+1F3B6: MULTIPLE MUSICAL NOTES '\ud83d\udc98',//U+1F498: HEART WITH ARROW '\ud83c\udf38',//U+1F338: CHERRY BLOSSOM '\ud83c\udf1f',//U+1F31F: GLOWING STAR '\ud83c\udf00',//U+1F300: CYCLONE '\ud83d\ude18' //U+1F618: FACE THROWING A ]; var insyraintext = '000000000000000000000000000000000000000000000000000000000000000000000'; var insydividerTop = '0 00 000 00 0 ' + EMOJI_EXCLAMATION + ' 0 00 000 00 0'; var insydividerBottom = '0 00 000 0000 ' + EMOJI_EXCLAMATION + ' 0000 000 00 0'; var tipMenuSize = 40; var insycircledigit = ['\u2460', '\u2461', '\u2462', '\u2463', '\u2464', '\u2465', '\u2466', '\u2467', '\u2468', '\u2469', '\u246a', '\u246b', '\u246c', '\u246d', '\u246e']; var sRoomStatus = ''; var iRoomStatus = 0; var bIsAlreadyCancelled = false; /** * Prototypes */ String.prototype.getLastChar = function () { var str = this.toString(); return str[str.length - 1]; }; Date.prototype.addMinutes = function (minutes) { this.setTime(this.getTime() + (minutes * 60000)); return this; } Date.prototype.addSeconds = function (seconds) { this.setTime(this.getTime() + (seconds * 1000)); return this; } /** * Main app object */ var insyShow = { // General properties modelName: cb.room_slug, botName: 'Insy Spy Show', botOriginalName: 'Insy Spy Show', botVersion: '3.1.3', botDate: 'January 9, 2022', botTextColor: COLOR_NEON_PURPLE, botBgColor: COLOR_BLACK, botTextColorBak: COLOR_NEON_PURPLE, botBgColorBak: COLOR_BLACK, botTextWeight: 'bold', botWarningColor: COLOR_ORANGE, botNoticeDelay: 500, botAnnounce: true, botIcon: '\u2728', timeLeftColor: COLOR_GREEN, // Properties botMode: 0, showPrice: 100, minutePrice: 15, minMinutes: 1, chatLevel: 0, noticeMessage: '', noticeTimer: 0, timeoutID: 0, timeoutRefresh: 0, refreshInterval: 3500, camMessage: '', autoClean: true, modsAdmin: false, freeMods: false, freeFans: false, freeDarkPurple: false, freeFriends: [], freeForTokens: 0, startTime: 0, tippersList: [], tippersHiddenList: [], userTimes: {}, bannedList: [], viewerList: new Set(), modsList: [], fansList: [], darkPurpleList: [], antiSpam: true, welcomeMessage: '', autoThankYou: true, autoThankYouMinTks: 1, autoThankYouMsg: [], advertisingMessageNumber: 0, advertisingColorScheme: '', advertisingColorForeground: '', advertisingColorBackground: '', advertisingColorForegroundBak: '', advertisingColorBackgroundBak: '', advertisingMessage1: '', advertisingMessage2: '', advertisingMessage3: '', advertisingMessage4: '', advertisingMessage5: '', advertisingMessage6: '', advertisingMessage7: '', advertisingMessage8: '', advertisingHiddenMessage: '', advertisingInterval: 0, advertisingHiddenInterval: 0, leaderBoard: false, leaderBoardInterval: 0, freeShowRewardInterval: 0, followerMessage: false, newFollowersList: new Set(), newFollowersCount: 0, rain: false, rainSymbol: 0, yellowWall: false, isYellowWall: false, userCounter: 0, messageCounter: 0, messageLimit: 50, isAway: false, isBrb: false, isTipMenu: false, tipMenuDivider: '', tipMenuDividerCustom: '', tipMenuStyle: '', tipMenuSortBy: '', tipMenuItem: [], tipMenuItemPrice: [], tipMenuInterval: 0, tipMenuText: '', tipMenuDividerInUse: '', toy: false, toyName: '', toyColorScheme: '', toyColorForeground: '', toyColorBackground: '', toyColorForegroundBak: '', toyColorBackgroundBak: '', toyNotice: '', toyLevelsInterval: 0, tipCounter: 0, modeList: { '1 - Pay per Minute': 'TIME', '2 - Full Show - Single Tip': 'FULL', }, levelList: { 'All users': 'ALL', 'Users with tokens': 'BLUES', 'Users that tipped': 'TIPPERS', 'Users in Insy Spy Show': 'INSY', }, botEmojiList: { 'INSY DEFAULT': '\u2728', 'CHRISTMAS TREE': '\ud83c\udf84', 'CONFETTI BALL': '\ud83c\udf8a', 'FATHER CHRISTMAS': '\ud83c\udf85', 'GHOST': '\ud83d\udc7b', 'HATCHING CHICK': '\ud83d\udc23', 'JACK-O-LANTERN': '\ud83c\udf83', 'PARTY POPPER': '\ud83c\udf89', 'WRAPPED PRESENT': '\ud83c\udf81', 'BIRTHDAY CAKE': '\ud83c\udf82', 'BALLOON': '\ud83c\udf88', 'RIBBON': '\ud83c\udf80' }, dividerList: { 'INSY DEFAULT': '\u2728', 'CUSTOM DIVIDER': '---', 'ALIEN MONSTER': '\ud83d\udc7e', 'ARTIST PALETTE': '\ud83c\udfa8', 'BALLOON': '\ud83c\udf88', 'BANANA': '\ud83c\udf4c', 'BARBER POLE': '\ud83d\udc88', 'BEATING HEART': '\ud83d\udc93', 'BEER MUG': '\ud83c\udf7a', 'BILLIARDS': '\ud83c\udfb1', 'BLOSSOM': '\ud83c\udf3c', 'BLUE HEART': '\ud83d\udc99', 'BOMB': '\ud83d\udca3', 'BOUQUET': '\ud83d\udc90', 'BUG': '\ud83d\udc1b', 'CANDY': '\ud83c\udf6c', 'CHERRIES': '\ud83c\udf52', 'CHRISTMAS TREE': '\ud83c\udf84', 'CLINKING BEER MUGS': '\ud83c\udf7b', 'COLLISION SYMBOL': '\ud83d\udca5', 'CONFETTI BALL': '\ud83c\udf8a', 'CRYSTAL BALL': '\ud83d\udd2e', 'DANCER': '\ud83d\udc83', 'DIRECT HIT': '\ud83c\udfaf', 'DIZZY SYMBOL': '\ud83d\udcab', 'DOUGHNUT': '\ud83c\udf69', 'EXTRATERRESTRIAL ALIEN': '\ud83d\udc7d', 'FATHER CHRISTMAS': '\ud83c\udf85', 'FIRE': '\ud83d\udd25', 'FIREWORK SPARKLER': '\ud83c\udf87', 'FIREWORKS': '\ud83c\udf86', 'FISH': '\ud83d\udc1f', 'FISTED HAND SIGN': '\ud83d\udc4a', 'FOUR LEAF CLOVER': '\ud83c\udf40', 'GEM STONE': '\ud83d\udc8e', 'GHOST': '\ud83d\udc7b', 'GREEN APPLE': '\ud83c\udf4f', 'GREEN HEART': '\ud83d\udc9a', 'GROWING HEART': '\ud83d\udc97', 'HATCHING CHICK': '\ud83d\udc23', 'HEART DECORATION': '\ud83d\udc9f', 'HEART WITH ARROW': '\ud83d\udc98', 'HEART WITH RIBBON': '\ud83d\udc9d', 'HEAVY DOLLAR SIGN': '\ud83d\udcb2', 'HIGH VOLTAGE SIGN': '\u26a1', 'HONEYBEE': '\ud83d\udc1d', 'JACK-O-LANTERN': '\ud83c\udf83', 'KISS MARK': '\ud83d\udc8b', 'LADY BEETLE': '\ud83d\udc1e', 'LIPSTICK': '\ud83d\udc84', 'LOLLIPOP': '\ud83c\udf6d', 'MONEY BAG': '\ud83d\udcb0', 'MOYAI': '\ud83d\uddff', 'MUSHROOM': '\ud83c\udf44', 'NO ONE UNDER EIGHTEEN SYMBOL': '\ud83d\udd1e', 'PARTY POPPER': '\ud83c\udf89', 'PEACH': '\ud83c\udf51', 'PEAR': '\ud83c\udf50', 'PILE OF POO': '\ud83d\udca9', 'PINEAPPLE': '\ud83c\udf4d', 'PURPLE HEART': '\ud83d\udc9c', 'RAINBOW': '\ud83c\udf08', 'RED APPLE': '\ud83c\udf4e', 'REVOLVING HEARTS': '\ud83d\udc9e', 'RIBBON': '\ud83c\udf80', 'SOCCER BALL': '\u26bd', 'SPARKLING HEART': '\ud83d\udc96', 'STRAWBERRY': '\ud83c\udf53', 'THOUGHT BALLOON': '\ud83d\udcad', 'THUMBS UP SIGN': '\ud83d\udc4d', 'TROPICAL FISH': '\ud83d\udc20', 'TULIP': '\ud83c\udf37', 'TURTLE': '\ud83d\udc22', 'TWO HEARTS': '\ud83d\udc95', 'VERTICAL BAR': '|', 'WATER WAVE': '\ud83c\udf0a', 'WRAPPED PRESENT': '\ud83c\udf81', 'YELLOW HEART': '\ud83d\udc9b' }, settings_choices: [ { name: 'insy_color', type: 'choice', label: 'Color scheme.........................................', defaultValue: 'DarkViolet', required: false }, { name: 'insy_emoji', type: 'choice', label: 'Bot Icon.............................................', defaultValue: 'INSY DEFAULT', required: true }, { name: 'insy_mode', type: 'choice', label: 'Insy Spy Show Mode...................................', defaultValue: '1 - Pay per Minute', required: false }, { name: 'insy_tokens_minute', type: 'int', label: 'Pay per Minute / Full Show.....................Tokens', minValue: 1, maxValue: 9999, defaultValue: 15 }, { name: 'insy_mods_admin', type: 'choice', label: 'Moderators can execute commands......................', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false }, { name: 'insy_free_mods', type: 'choice', label: 'Moderators have free access..........................', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false }, { name: 'insy_free_fans', type: 'choice', label: 'Fan Club Members have free access....................', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false }, { name: 'insy_free_dark_purple', type: 'choice', label: 'Dark Purple Members have free access.................', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false }, { name: 'insy_free_friends', type: 'str', label: 'Friends Members have free access (comma separated)...', defaultValue: '', required: false }, { name: 'insy_free_for_tokens', type: 'int', label: 'Free access - tipped at least (0 disabled).....Tokens', minValue: 0, maxValue: 9999, defaultValue: 0 }, { name: 'insy_anti_spam', type: 'choice', label: 'Activate AntiSpam for grey users.....................', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'insy_thank_you', type: 'choice', label: 'Activate Auto ThankYou on Tip........................', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'insy_thank_you_min_tokens', type: 'int', label: 'Auto ThankYou minimum..........................Tokens', minValue: 1, maxValue: 9999, defaultValue: 1 }, { name: 'insy_thank_you_msg1', type: 'str', label: 'Auto ThankYou on Tip Message 1 ([u] for nickname)....', defaultValue: 'Thank you for tipping [u]!', required: true }, { name: 'insy_thank_you_msg2', type: 'str', label: 'Auto ThankYou on Tip Message 2 ([u] for nickname)....', defaultValue: 'I love it [u], thank you!', required: true }, { name: 'insy_thank_you_msg3', type: 'str', label: 'Auto ThankYou on Tip Message 3 ([u] for nickname)....', defaultValue: 'Oh yes! Thank you [u], I like it!', required: true }, { name: 'insy_thank_you_msg4', type: 'str', label: 'Auto ThankYou on Tip Message 4 ([u] for nickname)....', defaultValue: '[u] just Tipped! Thanks!!!', required: true }, { name: 'insy_thank_you_msg5', type: 'str', label: 'Auto ThankYou on Tip Message 5 ([u] for nickname)....', defaultValue: 'Good Job [u], I really appreciate it!', required: true }, { name: 'insy_leader_board', type: 'choice', label: 'Activate LeaderBoard.................................', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'insy_new_follower', type: 'choice', label: 'Activate New Follower Message........................', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'insy_rain', type: 'choice', label: 'Activate Insy Rain...................................', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'insy_yellow_wall', type: 'choice', label: 'Activate Yellow Wall.................................', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'insy_adv_msg_color', type: 'choice', label: 'Advertising Message background color.................', choice1: 'Color scheme - Dark', choice2: 'Color scheme - Light', choice3: 'White', choice4: 'Black', defaultValue: 'Color scheme - Dark', required: false }, { name: 'insy_adv_msg', type: 'str', label: 'Advertising Message #1 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_2', type: 'str', label: 'Advertising Message #2 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_3', type: 'str', label: 'Advertising Message #3 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_4', type: 'str', label: 'Advertising Message #4 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_5', type: 'str', label: 'Advertising Message #5 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_6', type: 'str', label: 'Advertising Message #6 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_7', type: 'str', label: 'Advertising Message #7 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_8', type: 'str', label: 'Advertising Message #8 in Free.....(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_adv_msg_hidden', type: 'str', label: 'Advertising Message in Spy.........(skipped if empty)', defaultValue: '', required: false }, { name: 'insy_welcome_msg', type: 'str', label: 'Welcome Message ([u] for nickname).(skipped if empty)', defaultValue: 'Welcome to my room, [u]', required: false }, { name: 'insy_toy', type: 'choice', label: 'Activate Toy Levels..................................', choice1: 'Yes', choice2: 'No', defaultValue: 'No', required: false }, { name: 'insy_toy_color', type: 'choice', label: 'Toy Levels background color..........................', choice1: 'Color scheme - Dark', choice2: 'Color scheme - Light', choice3: 'White', choice4: 'Black', defaultValue: 'Color scheme - Light', required: false }, { name: 'insy_toy_name', type:'str', label: 'Toy Name.............................................', minLength:1, maxLength:255, defaultValue:'Lovense Lush', required:false}, { name: 'insy_toy_level_1', type:'str', label: 'Toy (i.e. Lush) Level #1.............................', minLength:1, maxLength:255, defaultValue:'Tip 1-14 - LOW - 1 second', required:false}, { name: 'insy_toy_level_2', type:'str', label: 'Toy (i.e. Lush) Level #2.............................', minLength:1, maxLength:255, defaultValue:'Tip 15-49 - MEDIUM - 3 seconds', required:false}, { name: 'insy_toy_level_3', type:'str', label: 'Toy (i.e. Lush) Level #3.............................', minLength:1, maxLength:255, defaultValue:'Tip 50-99 - HIGH - 5 seconds', required:false}, { name: 'insy_toy_level_4', type:'str', label: 'Toy (i.e. Lush) Level #4.............................', minLength:1, maxLength:255, defaultValue:'Tip 100-499 - HIGH - 20 seconds', required:false}, { name: 'insy_toy_level_5', type:'str', label: 'Toy (i.e. Lush) Level #5.............................', minLength:1, maxLength:255, defaultValue:'Tip 500-999 - ULTRA HIGH - 45 seconds', required:false}, { name: 'insy_toy_level_6', type:'str', label: 'Toy (i.e. Lush) Level #6.............................', minLength:1, maxLength:255, defaultValue:'Tip 1000+ - ULTRA HIGH - 100 seconds', required:false}, { name: 'insy_toy_level_7', type:'str', label: 'Toy (i.e. Lush) Level #7.............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_8', type:'str', label: 'Toy (i.e. Lush) Level #8.............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_9', type:'str', label: 'Toy (i.e. Lush) Level #9.............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_10', type:'str', label: 'Toy (i.e. Lush) Level #10............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_11', type:'str', label: 'Toy (i.e. Lush) Level #11............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_12', type:'str', label: 'Toy (i.e. Lush) Level #12............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_13', type:'str', label: 'Toy (i.e. Lush) Level #13............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_14', type:'str', label: 'Toy (i.e. Lush) Level #14............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_level_15', type:'str', label: 'Toy (i.e. Lush) Level #15............................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_1', type:'str', label: 'Toy (i.e. Lush) Special Command #1...................', minLength:1, maxLength:255, defaultValue:'Tip 77 - RANDOM Level Response', required:false}, { name: 'insy_toy_special_2', type:'str', label: 'Toy (i.e. Lush) Special Command #2...................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_3', type:'str', label: 'Toy (i.e. Lush) Special Command #3...................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_4', type:'str', label: 'Toy (i.e. Lush) Special Command #4...................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_5', type:'str', label: 'Toy (i.e. Lush) Special Command #5...................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_6', type:'str', label: 'Toy (i.e. Lush) Special Command #6...................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_7', type:'str', label: 'Toy (i.e. Lush) Special Command #7...................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_8', type:'str', label: 'Toy (i.e. Lush) Special Command #8...................', minLength:1, maxLength:255, required:false}, { name: 'insy_toy_special_9', type:'str', label: 'Toy (i.e. Lush) Special Command #9...................', minLength:1, maxLength:255, required:false}, { name: 'insy_tip_menu', type: 'choice', label: 'Activate Tip Menu....................................', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: false }, { name: 'insy_tip_menu_divider', type: 'choice', label: 'Tip Menu Divider.....................................', defaultValue: 'INSY DEFAULT', required: false }, { name: 'insy_tip_menu_custom_divider', type: 'str', label: 'Tip Menu Custom Divider (GIF or text)................', defaultValue: ':insyheartsmall', required: false }, { name: 'insy_tip_menu_style', type: 'choice', label: 'Tip Menu Style.......................................', choice1: 'Single Line', choice2: 'List', choice3: 'List (No Spaces)', defaultValue: 'Single Line' }, { name: 'insy_tip_menu_sort_by', type: 'choice', label: 'Sort Tip Menu by.....................................', choice1: 'Do not sort the list', choice2: 'Price Ascending', choice3: 'Price Descending', defaultValue: 'Price Ascending' } ], /** * Builds user vars and arrays based on settings */ parseSettings: function () { // General bot settings if (cb.settings.insy_color) { this.botTextColor = utils.getColorCode(cb.settings.insy_color); this.botBgColor = utils.getBgColorCode(cb.settings.insy_color); this.botTextColorBak = this.botTextColor; this.botBgColorBak = this.botBgColor; } // Bot Mode settings this.botIcon = this.botEmojiList[cb.settings.insy_emoji]; EMOJI_BOT = this.botIcon; this.botMode = this.modeList[cb.settings.insy_mode]; this.showPrice = parseInt(cb.settings.insy_tokens_minute); this.minutePrice = parseInt(cb.settings.insy_tokens_minute); this.chatLevel = 'ALL'; this.autoClean = true; this.minMinutes = 1; // Cam message this.camMessage = 'Insy Spy Show in progress!'; // Notifier this.noticeMessage = this.botName + ' is running [ {time} ]'; this.botAnnounce = true; this.noticeTimer = 2; // Privileges & special users this.modsAdmin = (cb.settings.insy_mods_admin == 'Yes'); this.freeMods = (cb.settings.insy_free_mods == 'Yes'); this.freeFans = (cb.settings.insy_free_fans == 'Yes'); this.freeDarkPurple = (cb.settings.insy_free_dark_purple == 'Yes'); this.freeForTokens = parseInt(cb.settings.insy_free_for_tokens); if (cb.settings.insy_free_friends) { this.freeFriends = utils.settingsListToArray(cb.settings.insy_free_friends); } this.antiSpam = (cb.settings.insy_anti_spam == 'Yes'); this.autoThankYou = (cb.settings.insy_thank_you == 'Yes'); this.autoThankYouMinTks = parseInt(cb.settings.insy_thank_you_min_tokens); this.autoThankYouMsg.push(cb.settings.insy_thank_you_msg1); this.autoThankYouMsg.push(cb.settings.insy_thank_you_msg2); this.autoThankYouMsg.push(cb.settings.insy_thank_you_msg3); this.autoThankYouMsg.push(cb.settings.insy_thank_you_msg4); this.autoThankYouMsg.push(cb.settings.insy_thank_you_msg5); this.advertisingColorScheme = cb.settings.insy_adv_msg_color; if (this.advertisingColorScheme == 'Color scheme - Dark'){ this.advertisingColorBackground = this.botTextColor; this.advertisingColorForeground = this.botBgColor; } else if (this.advertisingColorScheme == 'Color scheme - Light'){ this.advertisingColorBackground = this.botBgColor; this.advertisingColorForeground = this.botTextColor; } else if (this.advertisingColorScheme == 'White'){ this.advertisingColorBackground = COLOR_WHITE; this.advertisingColorForeground = this.botTextColor; } else if (this.advertisingColorScheme == 'Black'){ this.advertisingColorBackground = COLOR_BLACK; this.advertisingColorForeground = this.botBgColor; } else { this.advertisingColorBackground = this.botTextColor; this.advertisingColorForeground = this.botBgColor; } this.advertisingColorBackgroundBak = this.advertisingColorBackground; this.advertisingColorForegroundBak = this.advertisingColorForeground; this.advertisingMessage1 = cb.settings.insy_adv_msg; this.advertisingMessage2 = cb.settings.insy_adv_msg_2; this.advertisingMessage3 = cb.settings.insy_adv_msg_3; this.advertisingMessage4 = cb.settings.insy_adv_msg_4; this.advertisingMessage5 = cb.settings.insy_adv_msg_5; this.advertisingMessage6 = cb.settings.insy_adv_msg_6; this.advertisingMessage7 = cb.settings.insy_adv_msg_7; this.advertisingMessage8 = cb.settings.insy_adv_msg_8; this.advertisingHiddenMessage = cb.settings.insy_adv_msg_hidden; this.leaderBoard = (cb.settings.insy_leader_board == 'Yes'); this.followerMessage = (cb.settings.insy_new_follower == 'Yes'); this.rain = (cb.settings.insy_rain == 'Yes'); this.yellowWall = (cb.settings.insy_yellow_wall == 'Yes'); this.welcomeMessage = cb.settings.insy_welcome_msg; //this.bannedList = utils.settingsListToArray(''); //TOY this.toy = (cb.settings.insy_toy == 'Yes'); this.toyName = cb.settings.insy_toy_name; this.toyColorScheme = cb.settings.insy_toy_color; if (this.toyColorScheme == 'Color scheme - Dark'){ this.toyColorBackground = this.botTextColor; this.toyColorForeground = this.botBgColor; } else if (this.toyColorScheme == 'Color scheme - Light'){ this.toyColorBackground = this.botBgColor; this.toyColorForeground = this.botTextColor; } else if (this.toyColorScheme == 'White'){ this.toyColorBackground = COLOR_WHITE; this.toyColorForeground = this.botTextColor; } else if (this.toyColorScheme == 'Black'){ this.toyColorBackground = COLOR_BLACK; this.toyColorForeground = this.botBgColor; } else { this.toyColorBackground = this.botTextColor; this.toyColorForeground = this.botBgColor; } this.toyColorBackgroundBak = this.toyColorBackground; this.toyColorForegroundBak = this.toyColorForeground; //TIP MENU this.isTipMenu = (cb.settings.insy_tip_menu == 'Yes'); this.tipMenuDivider = this.dividerList[cb.settings.insy_tip_menu_divider]; this.tipMenuDividerCustom = cb.settings.insy_tip_menu_custom_divider; this.tipMenuStyle = cb.settings.insy_tip_menu_style; this.tipMenuSortBy = cb.settings.insy_tip_menu_sort_by; this.tipMenuItem = []; this.tipMenuItemPrice = []; // model, modadmin and user help var prefix = '/'; modelHelp = prefix + 'insyhelp ' + EMOJI_ARROW + ' Shows a list with all ' + this.botName + ' commands\n' + prefix + 'start ' + EMOJI_ARROW + ' Starts an ' + this.botName + ' (hidden)\n' + prefix + 'start [price] ' + EMOJI_ARROW + ' Starts an ' + this.botName + ' (hidden) with a custom price - replace [price] with the price amount\n' + prefix + 'away ' + EMOJI_ARROW + ' Stops an ' + this.botName + ' keeping the hidden without viewers until a stop\n' + prefix + 'brb ' + EMOJI_ARROW + ' Start an ' + this.botName + ' keeping the hidden without viewers for the Be Right Back until a stop\n' + prefix + 'stop ' + EMOJI_ARROW + ' Stops an ' + this.botName + ' (hidden)\n' + prefix + 'add [username] ' + EMOJI_ARROW + ' Adds user to the ' + this.botName + ' viewers list - replace [username] with the user nickname\n' + prefix + 'remove [username] ' + EMOJI_ARROW + ' Removes user from the ' + this.botName + ' viewers list - replace [username] with the user nickname\n' + prefix + 'check [username] ' + EMOJI_ARROW + ' Checks if a certain user is in the ' + this.botName + ' viewers list - replace [username] with the user nickname\n' + prefix + 'list ' + EMOJI_ARROW + ' Shows all the users in the ' + this.botName + ' viewers list\n' + prefix + 'ticket ' + EMOJI_ARROW + ' Shows all the users in the ' + this.botName + ' gift ticket list as tip reward\n' + prefix + 'note [message] ' + EMOJI_ARROW + ' Send a Notice in the room - replace [message] with the message text\n' + prefix + 'board ' + EMOJI_ARROW + ' Show the full list of Lovers\n' + prefix + 'menu ' + EMOJI_ARROW + ' Show the Tip Menu\n' + prefix + 'levels ' + EMOJI_ARROW + ' Show the Toy Levels\n' + prefix + 'ALL THE COMMANDS with /i[command] to avoid conflicts with other bots'; modHelp = prefix + 'insyhelp ' + EMOJI_ARROW + ' Shows a list with all ' + this.botName + ' commands\n' + prefix + 'start ' + EMOJI_ARROW + ' Starts an ' + this.botName + ' (hidden)\n' + prefix + 'start [price] ' + EMOJI_ARROW + ' Starts an ' + this.botName + ' (hidden) with a custom price - replace [price] with the price amount\n' + prefix + 'stop ' + EMOJI_ARROW + ' Stops an ' + this.botName + ' (hidden)\n' + prefix + 'add [username] ' + EMOJI_ARROW + ' Adds user to the ' + this.botName + ' viewers list - replace [username] with the user nickname\n' + prefix + 'remove [username] ' + EMOJI_ARROW + ' Removes user from the ' + this.botName + ' viewers list - replace [username] with the user nickname\n' + prefix + 'check [username] ' + EMOJI_ARROW + ' Checks if a certain user is in the ' + this.botName + ' viewers list - replace [username] with the user nickname\n' + prefix + 'list ' + EMOJI_ARROW + ' Shows all the users in the ' + this.botName + ' viewers list\n' + prefix + 'ticket ' + EMOJI_ARROW + ' Shows all the users in the ' + this.botName + ' gift ticket list as tip reward\n' + prefix + 'note [message] ' + EMOJI_ARROW + ' Send a Notice in the room - replace [message] with the message text\n' + prefix + 'board ' + EMOJI_ARROW + ' Show the full list of Lovers\n' + prefix + 'menu ' + EMOJI_ARROW + ' Show the Tip Menu\n' + prefix + 'levels ' + EMOJI_ARROW + ' Show the Toy Levels\n' + prefix + 'ALL THE COMMANDS with /i[command] to avoid conflicts with other bots'; userHelp = prefix + 'insyhelp ' + EMOJI_ARROW + ' Shows a list with all ' + this.botName + ' commands\n' + prefix + 'ticket ' + EMOJI_ARROW + ' Shows all the users in the ' + this.botName + ' gift ticket list as tip reward\n' + prefix + 'board ' + EMOJI_ARROW + ' Show the full list of Lovers\n' + prefix + 'menu ' + EMOJI_ARROW + ' Show the Tip Menu\n' + prefix + 'levels ' + EMOJI_ARROW + ' Show the Toy Levels\n' + prefix + 'ALL THE COMMANDS with /i[command] to avoid conflicts with other bots'; }, onMessage: function (msg) { // Some variables var name = msg['user']; var isModel = (name == cb.room_slug); var isDarkPurple = this.isDarkPurpleUser(name); var isFriend = this.isFriendUser(name); var isBanned = this.isBannedUser(name); var isMod = msg['is_mod']; var isFan = msg['in_fanclub']; var hasTokens = msg['has_tokens']; var hasTipped = (msg['tipped_recently'] || msg['tipped_alot_recently'] || msg['tipped_tons_recently']); var isGrey = !(hasTokens || isMod || isModel || isFan); var botPrefix = '/'; // Increment message counter this.messageCounter++; if (this.messageCounter == this.messageLimit) { this.messageCounter = 0; this.sendAd(); } if (this.startTime && this.startTime!='XXX' && !isModel && !this.isAway) { var userInShow = this.userInHiddenShow(name); // Grant free access if (!userInShow && (this.freeMods && isMod || this.freeFans && isFan || this.freeDarkPurple && isDarkPurple || isFriend)) { this.addUserToShow(name, false); } } // If command then process if (msg.m.indexOf('/') == 0 || msg.m.indexOf('!') == 0 || msg.m.indexOf('-') == 0 || msg.m.indexOf('\\') == 0) { // Handling commands var message = msg['m'].substr(1); var userParam = utils.getParam(message, 0); // command var userParam2 = utils.getParam(message, 1); // parameter 1 var userMessage = msg['m'].substr(userParam.length + 2); if (userParam2) { userParam2 = userParam2.replace(/@/g, ''); } switch (userParam.toLowerCase()) { case 'insyhelp': msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; if (isModel) { this.sendHelp(name, modelHelp); } else if (isMod && this.modsAdmin) { this.sendHelp(name, modHelp); } else { this.sendHelp(name, userHelp); } break; case 'add': case 'iadd': case 'remove': case 'iremove': case 'check': case 'icheck': if (isModel || (isMod && this.modsAdmin)) { msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; if (!userParam2) { utils.userNotice(name, 'You need to type the user you want to ' + userParam + '.'); break; } switch (userParam) { case 'add': case 'iadd': if (isMod && name.toLowerCase() == userParam2.replace(/@/g, '').toLowerCase()) { utils.userNotice(name, 'Don\'t cheat: you can\'t add yourself!'); } else if (!this.addUserToShow(userParam2, false)) { utils.userNotice(name, 'User @' + userParam2 + ' is already in the viewers list or can\'t be added to it.'); } break; case 'remove': case 'iremove': if (!this.removeUserFromShow(userParam2)) { utils.userNotice(name, 'User @' + userParam2 + ' is not in the viewers list.'); } break; case 'check': case 'icheck': if (this.userInHiddenShow(userParam2)) { utils.userNotice(name, 'User @' + userParam2 + ' is in the viewers list.'); } else { utils.userNotice(name, 'User @' + userParam2 + ' is not in the viewers list.'); } break; } } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; case 'list': case 'ilist': if (isModel || (isMod && this.modsAdmin)) { msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; var userList = cb.limitCam_allUsersWithAccess(); var userListMessage = []; for (var i = 0; i < userList.length; i++) { userListMessage.push('@' + userList[i]); } if (userListMessage.length > 0) { utils.userNotice(name, userListMessage.length + (userListMessage.length > 1 ? " users" : " user") + " in " + this.botName + ": " + cbjs.arrayJoin(userListMessage, ", ")); } else { utils.userNotice(name, 'There are no users added to the ' + this.botName + '.'); } } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; case 'start': case 'istart': case 'i': if (isModel || (isMod && this.modsAdmin)) { msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; if (userParam2) { // Parameter is Integer to start a Insy Spy Show? if (!(userParam2 && Number.isInteger(parseInt(userParam2)))) { utils.userNotice(name, 'You need to type a valid parameter (e.g. ' + botPrefix + userParam + ' 25).'); break; } // Show running? if (cb.limitCam_isRunning() || this.isAway) { utils.userNotice(name, this.botName + ' is already running!'); break; } // Price range userParam2 = parseInt(userParam2); if (userParam2 < 1 || userParam2 > 1000) { utils.userNotice(name, this.botName + ' price must be between 1 and 1000.'); break; } // Start Show this.showPrice = userParam2; this.minutePrice = userParam2; this.isAway = false; this.isBrb = false; this.tippersHiddenList = []; iRoomStatus = 0; bIsAlreadyCancelled = false; this.startHiddenShow(); } // No price given: use default else { if (cb.limitCam_isRunning() || this.isAway) { utils.userNotice(name, this.botName + ' is already running!'); break; } this.isAway = false; this.isBrb = false; this.tippersHiddenList = []; this.startHiddenShow(); } } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; case 'stop': case 'istop': if (isModel || (isMod && this.modsAdmin)) { msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; if (!cb.limitCam_isRunning()) { utils.userNotice(name, this.botName + ' is not running at the moment.'); try { cb.limitCam_stop(); } catch (e) { //utils.handleException("onStop", e); var ex = e; } break; } cb.limitCam_stop(); if (this.isBrb) { utils.roomInfoNotice(EMOJI_BOT + ' ' + this.botName + ' - Performer is back! ' + EMOJI_BOT); } else if (this.isAway) { utils.roomInfoNotice(EMOJI_BOT + ' ' + this.botName + ' - Performer is back from hidden show ' + EMOJI_BOT); } else { utils.roomInfoNotice(EMOJI_BOT + ' ' + this.botName + ' has finished! Duration time: ' + utils.getElapsedTime(this.startTime) + ' ' + EMOJI_BOT); } this.startTime = 0; // Reset default prices this.showPrice = parseInt(cb.settings.insy_tokens_minute); this.minutePrice = parseInt(cb.settings.insy_tokens_minute); // Remove full show users if (this.autoClean) { if (this.removeFullShowUsers()) { utils.modelNotice('Users have been removed from the ' + this.botName + '.'); } } // Remove remaining times this.removePayPerMinuteUsers(); this.userTimes = {}; // Cancel notifier if (this.timeoutID) { cb.cancelTimeout(this.timeoutID); this.timeoutID = 0; } if (!this.isBrb) { this.sendFullLBHidden(cb.room_slug); } this.isAway = false; this.isBrb = false; this.tippersHiddenList = []; this.viewerList.clear(); iRoomStatus = 0; bIsAlreadyCancelled = false; break; } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; case 'away': case 'iaway': if (isModel) { var emoji_icon = EMOJI_BOT; msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; if (this.isAway || this.isBrb) { utils.userNotice(name, this.botName + ' is running at the moment. You can\'t set the AWAY.'); break; } this.isAway = true; this.isBrb = false; this.viewerList.clear(); cb.limitCam_stop(); setTimeout(function () { cb.limitCam_start(emoji_icon + ' Insy Spy Show ' + emoji_icon + '\nPerformer Is Away\n' + '\u2757' + ' You may continue chatting while you wait for the broadcaster to return ' + '\u2757'); }, 3000); utils.roomInfoNotice(EMOJI_BOT + ' ' + this.botName + ' has finished! Duration time: ' + utils.getElapsedTime(this.startTime) + ' ' + EMOJI_BOT); utils.roomInfoNotice(EMOJI_EXCLAMATION + ' Performer Is Away - You may continue chatting while you wait for the broadcaster to return ' + EMOJI_EXCLAMATION); // Reset default prices this.showPrice = parseInt(cb.settings.insy_tokens_minute); this.minutePrice = parseInt(cb.settings.insy_tokens_minute); // Remove full show users if (this.autoClean) { if (this.removeFullShowUsers()) { utils.modelNotice('Users have been removed from the ' + this.botName + '.'); } } // Remove remaining times this.removePayPerMinuteUsers(); this.userTimes = {}; // Cancel notifier if (this.timeoutID) { cb.cancelTimeout(this.timeoutID); this.timeoutID = 0; } iRoomStatus = 0; bIsAlreadyCancelled = false; } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; case 'brb': case 'ibrb': if (isModel) { var emoji_icon = EMOJI_BOT; msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; if (cb.limitCam_isRunning() || this.isAway) { utils.userNotice(name, this.botName + ' is running at the moment. You can\'t set the BRB.'); break; } this.isAway = true; this.isBrb = true; this.viewerList.clear(); cb.limitCam_stop(); setTimeout(function () { cb.limitCam_start(emoji_icon + ' Insy Spy Show ' + emoji_icon + '\nBe Right Back\n' + '\u2757' + ' You may continue chatting while you wait for the broadcaster to return ' + '\u2757'); }, 3000); utils.roomInfoNotice(EMOJI_BOT + ' Be Right Back - You may continue chatting while you wait for the broadcaster to return ' + EMOJI_BOT); this.startTime = new Date(); // Reset default prices this.showPrice = parseInt(cb.settings.insy_tokens_minute); this.minutePrice = parseInt(cb.settings.insy_tokens_minute); // Remove full show users if (this.autoClean) { if (this.removeFullShowUsers()) { utils.modelNotice('Users have been removed from the ' + this.botName + '.'); } } // Remove remaining times this.removePayPerMinuteUsers(); this.userTimes = {}; this.tippersHiddenList = []; iRoomStatus = 0; bIsAlreadyCancelled = false; // Cancel notifier if (this.timeoutID) { cb.cancelTimeout(this.timeoutID); this.timeoutID = 0; } } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; case 'note': case 'inote': if (isModel || isMod) { msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; if (userMessage) { utils.roomInfoNotice(userMessage, this.advertisingColorForeground, this.advertisingColorBackground); } } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; case 'board': case 'iboard': msg['X-Spam'] = true; if (this.leaderBoard) { this.sendFullLB(name); } else { utils.userNotice(name, 'Top Lovers Leaderboard is not active.'); } break; case 'menu': case 'imenu': msg['X-Spam'] = true; if (this.isTipMenu) { this.sendTipMenuUser(name); } else { utils.userNotice(name, 'Tip Menu is not active.'); } break; case 'levels': case 'ilevels': msg['X-Spam'] = true; if (this.toy) { this.sendToyLevelsUser(name); } else { utils.userNotice(name, 'Toy Levels is not active.'); } break; case 'ticket': case 'iticket': msg['X-Spam'] = true; var userListMessage = []; if (this.freeForTokens > 0) { for (var i = 0; i < this.tippersList.length; i++) { if (this.tippersList[i].tokens >= this.freeForTokens) { if (!this.isBannedUser(this.tippersList[i].name)) { userListMessage.push('@' + this.tippersList[i].name); } } } if (userListMessage.length > 0) { utils.userNotice(name, userListMessage.length + (userListMessage.length > 1 ? " Gift Ticket owners" : " Gift Ticket owner") + " for " + this.botName + ": " + cbjs.arrayJoin(userListMessage, ", ")); } else { utils.userNotice(name, 'There are no Gift Ticket owners for ' + this.botName + '.'); } } else { utils.userNotice(name, this.botName + ' Gift Ticket is not active.'); } break; case 'ver': case 'iver': if (isModel) { msg['X-Spam'] = true; msg['m'] = 'Command [' + msg['m'] + '] received.'; var messageDetail = ''; messageDetail += '\n insy_color: ' + cb.settings.insy_color; messageDetail += '\n insy_emoji: ' + cb.settings.insy_emoji; messageDetail += '\n insy_mode: ' + this.botMode; messageDetail += '\n insy_tokens_minute: ' + this.showPrice; messageDetail += '\n insy_mods_admin: ' + this.modsAdmin; messageDetail += '\n insy_free_mods: ' + this.freeMods; messageDetail += '\n insy_free_fans: ' + this.freeFans; messageDetail += '\n insy_free_dark_purple: ' + this.freeDarkPurple; messageDetail += '\n insy_free_for_tokens: ' + this.freeForTokens; messageDetail += '\n insy_free_friends: ' + cbjs.arrayJoin(this.freeFriends, ", "); messageDetail += '\n insy_anti_spam: ' + this.antiSpam; messageDetail += '\n insy_thank_you: ' + this.autoThankYou; messageDetail += '\n insy_thank_you_min_tokens: ' + this.autoThankYouMinTks; messageDetail += '\n insy_thank_you_msg1: ' + this.autoThankYouMsg[0]; messageDetail += '\n insy_thank_you_msg2: ' + this.autoThankYouMsg[1]; messageDetail += '\n insy_thank_you_msg3: ' + this.autoThankYouMsg[2]; messageDetail += '\n insy_thank_you_msg4: ' + this.autoThankYouMsg[3]; messageDetail += '\n insy_thank_you_msg5: ' + this.autoThankYouMsg[4]; messageDetail += '\n insy_leader_board: ' + this.leaderBoard; messageDetail += '\n insy_new_follower: ' + this.followerMessage; messageDetail += '\n insy_rain: ' + this.rain; messageDetail += '\n insy_yellow_wall: ' + this.yellowWall; messageDetail += '\n insy_adv_msg_color: ' + this.advertisingColorScheme; messageDetail += '\n insy_adv_msg: ' + this.advertisingMessage1; messageDetail += '\n insy_adv_msg_2: ' + this.advertisingMessage2; messageDetail += '\n insy_adv_msg_3: ' + this.advertisingMessage3; messageDetail += '\n insy_adv_msg_4: ' + this.advertisingMessage4; messageDetail += '\n insy_adv_msg_5: ' + this.advertisingMessage5; messageDetail += '\n insy_adv_msg_6: ' + this.advertisingMessage6; messageDetail += '\n insy_adv_msg_7: ' + this.advertisingMessage7; messageDetail += '\n insy_adv_msg_8: ' + this.advertisingMessage8; messageDetail += '\n insy_adv_msg_hidden: ' + this.advertisingHiddenMessage; messageDetail += '\n insy_welcome_msg: ' + this.welcomeMessage; messageDetail += '\n insy_toy: ' + this.toy; messageDetail += '\n insy_toy_color: ' + this.toyColorScheme; messageDetail += '\n insy_toy_name: ' + this.toyName; messageDetail += '\n insy_tip_menu: ' + this.isTipMenu; messageDetail += '\n insy_tip_menu_divider: ' + this.tipMenuDivider; messageDetail += '\n insy_tip_menu_custom_divider: ' + this.tipMenuDividerCustom; messageDetail += '\n insy_tip_menu_style: ' + this.tipMenuStyle; messageDetail += '\n insy_tip_menu_sort_by: ' + this.tipMenuSortBy; utils.userNotice(name, insyShow.botName + ' Release ' + insyShow.botVersion + ' - ' + insyShow.botDate + messageDetail); } else { utils.userNotice(name, 'Only the broadcaster can use this command.'); } break; default: if (isBanned) { msg['X-Spam'] = true; } } } else if (!hasTokens && this.antiSpam) { if (isBanned) { msg['X-Spam'] = true; } else { if (msg['m'] == pass.toString()) { usersspam.push(name); msg['X-Spam'] = true; msg['m'] = "Thank you. You can now text in the room."; } if (!(usersspam.indexOf(msg['user']) != -1)) { setTimeout(function () { utils.userNotice(name, usernotice3); }, 500); msg['m'] = 'Please read the instructions and enter the correct number.'; msg['X-Spam'] = true; } } } else if (isBanned) { msg['X-Spam'] = true; } return msg; }, onEnter: function (user) { var name = user['user']; var isMod = user['is_mod']; var isFan = user['in_fanclub']; var isDarkPurple = user['tipped_tons_recently']; var isFriend = this.isFriendUser(name); var isModel = (name == cb.room_slug); var hasTokens = user['has_tokens']; var hasTipped = user['tipped_recently']; var isGrey = !(hasTokens || isMod || isModel || isFan); if (this.welcomeMessage != '') { var msg = this.welcomeMessage.replace('[u]', name); utils.userNotice(name, EMOJI_BOT + ' ' + msg + ' ' + EMOJI_BOT, this.botTextColor, this.botBgColor, 'bold'); } // Bot announcement if (this.botAnnounce) { // Announce running show if (this.startTime && this.startTime!='XXX' && !this.isAway) { utils.userNotice(name, this.botName + ' is running [ ' + utils.getElapsedTime(this.startTime) + ' ] \n' + EMOJI_RIGHT_POINTING + ' ' + this.getPriceText() + ' ' + EMOJI_LEFT_POINTING, '', this.botBgColor); } else if (this.isAway) { if (this.isBrb) { utils.userNotice(name, EMOJI_BOT + ' Be Right Back - You may continue chatting while you wait for the broadcaster to return ' + EMOJI_BOT, '', this.botBgColor); } else { utils.userNotice(name, EMOJI_EXCLAMATION + ' Performer Is Away - You may continue chatting while you wait for the broadcaster to return ' + EMOJI_EXCLAMATION, '', this.botBgColor); } } } if (!hasTokens && this.antiSpam) { utils.userNotice(name, 'Insy Anti Spam is active!', '', this.botBgColor); } else { if (this.isTipMenu) { this.sendTipMenuUser(name); } } // Grant free access if (!this.isAway) { if (this.startTime && this.startTime != 'XXX' && !cb.limitCam_userHasAccess(name) && (this.freeMods && isMod || this.freeFans && isFan || this.freeDarkPurple && isDarkPurple || isFriend)) { this.addUserToShow(name, false); } } }, onFollow: function (user) { var name = user['user']; if (this.followerMessage) { this.newFollowersCount++; if (!this.newFollowersList.has(name)) { this.newFollowersList.add(name); var iNewCount = this.newFollowersCount; sNewCount = ' '; if (iNewCount > 0) { sNewCount = ' [ +' + iNewCount + ' ] '; } //else if (iNewCount<0) // {sNewCount = ' [ ' + iNewCount + ' ] ';} var msg = EMOJI_BOT + ' New Follower ' + EMOJI_HEART + ' Thank you @' + name + ' ' + EMOJI_HEART + sNewCount + EMOJI_BOT; if (this.yellowWall && this.isYellowWall) { utils.roomNotice(msg); } else { utils.roomInfoNotice(msg); } } } }, onUnFollow: function (user) { var name = user['user']; if (this.followerMessage) { this.newFollowersCount--; } }, onStart: function (user) { cb.limitCam_stop(); this.isAway = false; this.isBrb = false; this.startTime = 'XXX'; }, getUserConnected() { if (utils.allUserCounter > 0) { this.userCounter = utils.allUserCounter; } var GAL = cb.setTimeout(this.getUserConnected.bind(this), 5000); }, onUserCounter: function () { utils.allUserCounter = 0; this.modsList = []; this.fansList = []; this.darkPurpleList = []; cb.getRoomUsersData(usersData => { if (usersData['success']) { for (user of usersData['data']['room_owner']) { utils.addUserCounter(); } for (user of usersData['data']['moderator']) { utils.addUserCounter(); } for (user of usersData['data']['fanclub']) { utils.addUserCounter(); } for (user of usersData['data']['dark_purple']) { utils.addUserCounter(); } for (user of usersData['data']['light_purple']) { utils.addUserCounter(); } for (user of usersData['data']['dark_blue']) { utils.addUserCounter(); } for (user of usersData['data']['light_blue']) { utils.addUserCounter(); } for (user of usersData['data']['grey']) { utils.addUserCounter(); } for (user of usersData['data']['moderator']) { this.modsList.push(user); } for (user of usersData['data']['fanclub']) { this.fansList.push(user); } for (user of usersData['data']['dark_purple']) { this.darkPurpleList.push(user); } } }); if (!cb.limitCam_isRunning()){ if ((this.startTime && this.startTime!='XXX') || (this.startTime && this.startTime!='XXX' && (!this.isAway || !this.isBrb))) { iRoomStatus++; if (iRoomStatus > 3) { this.stopHiddenShow(); iRoomStatus = 0; } } else { iRoomStatus = 0; bIsAlreadyCancelled = false; } } else { iRoomStatus = 0; bIsAlreadyCancelled = false; } this.onYellowWall(); if (this.yellowWall && this.isYellowWall) { this.tipCounter = 2; } else { this.tipCounter = 0; } var UC = cb.setTimeout(this.onUserCounter.bind(this), 15000); }, onTip: function (tip) { var username = tip.from_user; var amount = parseInt(tip.amount); var found = false; var isMVP = false; var isAnon = tip.is_anon_tip; var userMessage = 'Thank you!'; var isBanned = this.isBannedUser(username); this.tipCounter++; this.onYellowWall(); // Handle Lovers List: if (this.tippersList.length > 0) { isMVP = (username == this.tippersList[0].name); } // Update tipper for (var i = 0; i < this.tippersList.length; i++) { if (this.tippersList[i].name == username) { this.tippersList[i].tokens += amount; found = true; break; } } // Add a new one if (!found) this.tippersList.push({ name: username, tokens: amount }); // Sort the array this.tippersList.sort(function (a, b) { return b.tokens - a.tokens; }); if (!isMVP && (username == this.tippersList[0].name) && this.leaderBoard) { var msg = EMOJI_BOT + ' @' + username + ' is the New ' + cb.room_slug + ' Top Lover! ' + EMOJI_KING; if (this.yellowWall && this.isYellowWall) { utils.delayedNotice(this.botNoticeDelay + 2000, msg, '', COLOR_YELLOW, COLOR_BLACK, 'bold'); } else { utils.delayedNotice(this.botNoticeDelay + 2000, msg, '', this.botTextColor, this.botBgColor, 'bold'); } } // Handle Tippers during Insy Spy Show if (cb.limitCam_isRunning() && !this.isAway) { found = false; for (var i = 0; i < this.tippersHiddenList.length; i++) { if (this.tippersHiddenList[i].name == username) { this.tippersHiddenList[i].tokens += amount; found = true; break; } } if (!found) this.tippersHiddenList.push({ name: username, tokens: amount }); this.tippersHiddenList.sort(function (a, b) { return b.tokens - a.tokens; }); } // Handle Insy Spy Show viewers // Full Show Mode if (cb.limitCam_isRunning() && this.botMode == 'FULL' && !this.isAway) { if (!this.userInHiddenShow(username)) { if (cb.limitCam_isRunning() && (amount >= this.showPrice)) { // Check possible ban if (!this.isBannedUser(username)) { this.addUserToShow(username, isAnon); } else { utils.userNotice(username, 'You are not allowed to watch hidden shows in this room.'); } } } } // Pay per Minute Mode else if (cb.limitCam_isRunning() && this.botMode == 'TIME' && !this.isAway) { var minutesBought = parseInt(amount / this.minutePrice); if (minutesBought > 0) { // Check possible ban if (!this.isBannedUser(username)) { this.addMinutesToUser(username, minutesBought, isAnon); } else { utils.userNotice(username, 'You are not allowed to watch hidden shows in this room.'); } } else { if (this.userInHiddenShow(username)) { utils.userNotice(username, 'You must tip at least ' + this.minutePrice + 'tk to get more minutes of show viewing.', this.botWarningColor); } } } else if (!cb.limitCam_isRunning() || (this.isAway && this.autoThankYou)) { if (this.autoThankYou) { username = tip.from_user; var iN = 0; userMessage = null; if (amount >= this.autoThankYouMinTks) { iN = utils.randomNumber(0, 5); userMessage = EMOJI_BOT + ' ' + this.autoThankYouMsg[iN] + ' ' + EMOJI_BOT; } if (isAnon) { username = "anonymous"; // override output for cb's new anonymous tip option } else { username = '@' + username; } if (userMessage) { var msg = userMessage.replace('[u]', username); if (this.yellowWall && this.isYellowWall) {utils.roomNotice(msg);} else {utils.roomInfoNotice(msg);} } } if (this.rain && amount >= 50) { username = tip.from_user; var iN = 0; var iRows = 7; var sSymbol = EMOJI_BOT; iN = ((utils.randomNumber(0, 17) + this.rainSymbol) % 17); sSymbol = insyrainsymbol[iN]; userMessage = null; var iN = 0; if (amount < 60) { iRows += 0; } else if (amount < 70) { iRows += 2; } else if (amount < 80) { iRows += 4; } else if (amount < 90) { iRows += 6; } else if (amount < 100) { iRows += 8; } else if (amount < 1000) { iRows += 10; } else if (amount >= 1000) { iRows += 18; } userMessage = EMOJI_BOT + ' [tipper] made The Insy Rain ' + EMOJI_BOT; if (isAnon) { username = "anonymous"; // override output for cb's new anonymous tip option } else { username = '@' + username; } if (userMessage) { var msg = userMessage.replace('[tipper]', username); if (this.yellowWall && this.isYellowWall) {utils.roomNotice(msg);} else {utils.roomInfoNotice(msg);} for (var i = 0; i < iRows; i++) { msg = insyraintext.substr(utils.randomNumber(0, 3), utils.randomNumber(3, 26)).replace(/0/g, sSymbol); utils.roomNotice(msg, this.botBgColor, this.botBgColor); } } this.rainSymbol++; } if (this.isTipMenu) { username = tip.from_user; if (isAnon) { username = "anonymous"; // override output for cb's new anonymous tip option } else { username = '@' + username; } userMessage = this.tipMenuDividerInUse + ' [tipper] tipped for [menuitem] ' + this.tipMenuDividerInUse; for (let i = 0; i < this.tipMenuItemPrice.length; i++) { if (amount === this.tipMenuItemPrice[i]) { if (userMessage) { var msg = userMessage.replace('[tipper]', username); msg = msg.replace('[menuitem]', this.tipMenuItem[i]); utils.roomNotice(msg); } } } } } }, onYellowWall: function () { this.isYellowWall = (this.tipCounter>2); if (this.yellowWall && this.isYellowWall) { this.botBgColor = COLOR_YELLOW; this.botTextColor = COLOR_BLACK; this.advertisingColorBackground = COLOR_YELLOW; this.advertisingColorForeground = COLOR_BLACK; this.toyColorBackground = COLOR_YELLOW; this.toyColorForeground = COLOR_BLACK; } else { this.botBgColor = this.botBgColorBak; this.botTextColor = this.botTextColorBak; this.advertisingColorBackground = this.advertisingColorBackgroundBak; this.advertisingColorForeground = this.advertisingColorForegroundBak; this.toyColorBackground = this.toyColorBackgroundBak; this.toyColorForeground = this.toyColorForegroundBak; } return; }, isBannedUser: function (name) { return this.bannedList.includes(name); }, isDarkPurpleUser: function (name) { return this.darkPurpleList.includes(name); }, isFriendUser: function (name) { return this.freeFriends.includes(name); }, isTipper: function (name) { for (var i = 0; i < this.tippersList.length; i++) { if (this.tippersList[i].name == name) { return true; } } return false; }, userInHiddenShow: function (name) { if (name.length > 0) { name = name.replace(/@/g, ''); } return cb.limitCam_userHasAccess(name); }, addUserToShow: function (name, is_anon) { var isViewer = false; if (name.length > 0) { name = name.replace(/@/g, ''); if (!this.userInHiddenShow(name) && !this.isBannedUser(name)) { cb.limitCam_addUsers(name); utils.roomInfoNotice(EMOJI_BOT + ' ' + (is_anon ? 'anonymous user' : '@' + name) + ' has been granted access to the ' + this.botName + ' ' + EMOJI_UNLOCK); return true; } return false; } return false; }, removeUserFromShow: function (name) { if (name.length > 0) { name = name.replace(/@/g, ''); if (cb.limitCam_userHasAccess(name)) { cb.limitCam_removeUsers(name); delete this.userTimes[name]; utils.roomNotice(EMOJI_BOT + ' @' + name + ' is no longer granted access to the ' + this.botName + ' ' + EMOJI_LOCK); return true; } else { return false; } } return false; }, /** * Starts the show and takes care of everything */ startHiddenShow: function () { var emoji_icon = EMOJI_BOT; // Start Show this.startTime = new Date(); var msg = emoji_icon + ' ' + this.camMessage + ' ' + emoji_icon + '\n' + '\u2192' + ' ' + this.getPriceText(); cb.limitCam_start(msg); // Notify Mods & Fans if needed this.notifyFreeAccessUsers(); //Add Mods for free if (this.freeMods) { this.addModsToShow(); } //Add Fans for free if (this.freeFans) { this.addFansToShow(); } //Add Friends if (this.freeFriends.length > 0) { this.addFriendsToShow(); } //Add Dark Purple for free if (this.freeDarkPurple) { this.addDarkPurpleToShow(); } //Add Tippers at least min value if (this.freeForTokens > 0) { this.addRewardForTokensShow(); } // Notify room utils.roomInfoNotice(EMOJI_BOT + ' ' + this.botName + ' has started. ' + this.getPriceText().replace(/ *\([^)]*\) */g, "") + ' ' + EMOJI_BOT); // Launch refresh & notifier timers if (this.botMode == 'TIME') this.timeoutRefresh = cb.setTimeout(this.refreshUsers.bind(this), this.refreshInterval); this.timeoutID = cb.setTimeout(this.displayShowNotice.bind(this), (Math.floor(Math.random() * 60) + 15) * 1000); // RunHiddenAdvertising cb.setTimeout(this.sendAd.bind(this), 3000); }, stopHiddenShow: function () { if (!bIsAlreadyCancelled) { try { bIsAlreadyCancelled = true; iRoomStatus = 0; var warningMessage = EMOJI_BOT + ' ' + this.botName + ' has been stopped due to a chaturbate technical issue ' + EMOJI_BOT + '\n'; warningMessage += '000000000Cam visible even if ' + this.botName + ' was running 0000000000'; warningMessage = warningMessage.replace(/0/g, '\u2007'); utils.modelNotice(warningMessage, COLOR_WHITE, COLOR_ORANGE, 'bold'); this.startTime = 0; // Reset default prices this.showPrice = parseInt(cb.settings.insy_tokens_minute); this.minutePrice = parseInt(cb.settings.insy_tokens_minute); // Remove remaining times this.removePayPerMinuteUsers(); this.userTimes = {}; // Cancel notifier if (this.timeoutID) { cb.cancelTimeout(this.timeoutID); this.timeoutID = 0; } this.isAway = false; this.isBrb = false; this.tippersHiddenList = []; this.viewerList.clear(); cb.limitCam_stop(); } catch (e) { //utils.handleException("onStop", e); var ex = e; } } }, /** * Send command help to the user */ sendHelp: function (target, helpText) { var head = EMOJI_BOT + ' ' + this.botName + ' Help ' + EMOJI_BOT; var outMsg = helpText; if (this.yellowWall && this.isYellowWall) { utils.delayedNotice(300, head, target, COLOR_YELLOW, COLOR_BLACK, 'bold'); } else { utils.delayedNotice(300, head, target, this.botTextColor, this.botBgColor, 'bold'); } utils.delayedNotice(600, outMsg, target, this.botBgColor, this.botTextColor, 'normal'); }, /** * Add mods to the show */ addModsToShow: function () { for (var i = 0; i < this.modsList.length; i++) { this.addUserToShow(this.modsList[i], false); } }, /** * Add fans to the show */ addFansToShow: function () { for (var i = 0; i < this.fansList.length; i++) { this.addUserToShow(this.fansList[i], false); } }, /** * Add dark purple to the show */ addDarkPurpleToShow: function () { for (var i = 0; i < this.darkPurpleList.length; i++) { this.addUserToShow(this.darkPurpleList[i], false); } }, /** * Add friends to the show */ addFriendsToShow: function () { for (var i = 0; i < this.freeFriends.length; i++) { this.addUserToShow(this.freeFriends[i], false); } }, /** * Add tippers at least configured minimim to the show */ addRewardForTokensShow: function () { for (var i = 0; i < this.tippersList.length; i++) { if (this.tippersList[i].tokens >= this.freeForTokens) { this.addUserToShow(this.tippersList[i].name, false); } } }, /** * Notification for users with free access */ notifyFreeAccessUsers: function () { var target = []; // Mods only if (this.freeMods) { target.push('red'); } // Fan Club if (this.freeFanClub) { target.push('green'); } // Deliver notification for (var i = 0; i < target.length; i++) { var msg = target[i] + ' can access the show if they type in the room or refresh.'; msg = msg.replace('red', 'Moderators'); msg = msg.replace('green', 'Fan Club Members'); utils.groupNotice(target[i], msg, '', this.botBgColor); } }, /** * Returns a text indicating the price of the show */ getPriceText: function () { if (this.botMode == 'FULL') { return 'Tip ' + this.showPrice + 'tks to Join!'; } else if (this.botMode == 'TIME') { if (this.minMinutes > 1) { return 'Tip ' + (this.minutePrice * this.minMinutes) + 'tk to join and ' + this.minutePrice + 'tk/min for extra time!'; } else { return 'Tip ' + this.minutePrice + 'tk/min to watch!'; } } }, /** * Sends the Insy Spy Show notifier */ displayShowNotice: function () { if (cb.limitCam_isRunning()) { var msg = this.noticeMessage + ' \n' + EMOJI_RIGHT_POINTING + ' ' + this.getPriceText() + ' ' + EMOJI_LEFT_POINTING; msg = msg.replace('{time}', utils.getElapsedTime(this.startTime)); // Random delay -15 to +15s var delay = (Math.floor(Math.random() * 30) - 10) * 1000; utils.roomNotice(msg); this.timeoutID = cb.setTimeout(this.displayShowNotice.bind(this), (this.noticeTimer * 60000) + delay); } else { this.timeoutID = 0; } }, /** * Adds viewing time to a user */ addMinutesToUser: function (name, minutes, is_anon) { if (!this.userInHiddenShow(name)) { if (minutes < this.minMinutes) { utils.userNotice(name, 'The minimum tip to enter the ' + this.botName + ' is ' + (this.minMinutes * this.minutePrice) + 'tk.'); return; } var nowDate = new Date(); this.userTimes[name] = { endTime: nowDate.addSeconds(parseInt(minutes) * 60), ticks: 0, savedTime: 0 }; this.addUserToShow(name, is_anon); } else { if (this.userTimes[name]) { this.userTimes[name].endTime = this.userTimes[name].endTime.addMinutes(minutes); this.userTimes[name].ticks = 0; utils.roomInfoNotice(EMOJI_BOT + ' ' + (is_anon ? 'anonymous user' : '@' + name) + ' tipped for ' + minutes + ' minute' + (minutes > 1 ? 's' : '') + ' more of ' + this.botName + ' ' + EMOJI_UNLOCK); } else { // User has full access so no time to add return; } } utils.userNotice(name, EMOJI_BOT + ' You have [ ' + utils.getTimeLeft(this.userTimes[name].endTime) + ' ] of viewing time.', this.botTimeLeftColor); }, /** * Save the total time left for a future show */ saveTimeFromUsers: function () { var total = 0; var nowDate = new Date(); for (var user in this.userTimes) { if (this.userTimes[user].endTime.getTime() > nowDate.getTime()) { this.userTimes[user].savedTime = utils.getSecondsLeft(this.userTimes[user].endTime); utils.userNotice(user, EMOJI_BOT + ' You have [ ' + utils.getTimeLeft(this.userTimes[user].endTime).trim() + ' ] of viewing time for the next show.', this.botTimeLeftColor); total++; } else { delete this.userTimes[user]; } } return total; }, /** * Remove all viewers with time remaining */ removePayPerMinuteUsers: function () { for (var user in this.userTimes) { if (cb.limitCam_userHasAccess(user)) { cb.limitCam_removeUsers(user); } } }, /** * Remove all users with full show access */ removeFullShowUsers: function () { var allUsers = cb.limitCam_allUsersWithAccess(); var usersToRemove = []; for (var i = 0; i < allUsers.length; i++) { usersToRemove.push(allUsers[i]); } for (var i = 0; i < usersToRemove.length; i++) cb.limitCam_removeUsers(usersToRemove[i]); return usersToRemove.length; }, /** * Removes users with no time remaining * Sends a notification with time left */ refreshUsers: function () { if (cb.limitCam_isRunning()) { var nowDate = new Date(); for (var user in this.userTimes) { if (this.userTimes[user].endTime.getTime() <= nowDate.getTime()) { this.removeUserFromShow(user); } else { if (utils.getMinutesLeft(this.userTimes[user].endTime) < 1) { if (this.userTimes[user].ticks > 0) { utils.userNotice(user, EMOJI_BOT + ' Less than 1 min of viewing time. Tip a multiple of ' + this.minutePrice + ' to continue watching!', this.botTimeLeftColor); this.userTimes[user].ticks = 0; } } else { // Notify only after 8 refresh times this.userTimes[user].ticks++; if (this.userTimes[user].ticks % 8 == 0) { utils.userNotice(user, EMOJI_BOT + ' You have [ ' + utils.getTimeLeft(this.userTimes[user].endTime) + ' ] of viewing time.', this.botTimeLeftColor); } } } } this.timeoutRefresh = cb.setTimeout(this.refreshUsers.bind(this), this.refreshInterval); } else { this.timeoutRefresh = 0; } }, /* * Populates a choice setting * @index : Position in the settings array */ loadSettingChoices: function (itemList, index) { var count = 0; for (var item in itemList) { count++; cb.settings_choices[index]['choice' + count] = item; } }, init: function () { // Add Insy Spy Show settings if (this.isBannedUser(this.modelName)) { return true; } for (let mSetting = 1; mSetting <= tipMenuSize; mSetting++) { this.settings_choices.push({ name: 'insy_tip_menu_item_' + mSetting, label: 'Tip Menu Item ' + utils.pad(mSetting, 2, '0', 0) + '.....................................', type: 'str', required: false }); this.settings_choices.push({ name: 'insy_tip_menu_item_price_' + mSetting, label: 'Tip Menu Item ' + utils.pad(mSetting, 2, '0', 0) + ' - Price.............................', type: 'int', defaultValue: 0, required: false }); } cb.settings_choices.push.apply(cb.settings_choices, this.settings_choices); this.loadSettingChoices(utils.colorList, 0); this.loadSettingChoices(this.botEmojiList, 1); this.loadSettingChoices(this.modeList, 2); this.loadSettingChoices(this.dividerList, 61); // Pick settings values this.parseSettings(); // Initialize the Toy Levels if (this.toy) { this.initializeToyLevels(); } // Initialize the Tip Menu if (this.isTipMenu) { this.initializeTipMenu(); } // Bot loaded messages utils.delayedNotice(this.botNoticeDelay, EMOJI_BOT + ' ' + insyShow.botName + ' for ' + cb.room_slug + ' ' + EMOJI_BOT, '', this.botTextColor, this.botBgColor, 'bold'); utils.delayedNotice(this.botNoticeDelay + 200, 'Release ' + insyShow.botVersion + ' - ' + insyShow.botDate + '\n' + 'Added \'Yellow Wall\' optional functionality.\u2007\n' + 'Type /insyhelp to see all bot commands.', '', this.botBgColor, this.botTextColor, 'normal'); // Manage User Counters for cb.setTimeout(this.onUserCounter.bind(this), 100); this.getUserConnected(); // Start Advertising Messages if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else { this.advertisingMessageNumber = 0; } cb.setTimeout(this.sendAd.bind(this), 7000); cb.setTimeout(this.sendLB.bind(this), 40000); if (this.freeForTokens > 0) { cb.setTimeout(this.sendFS.bind(this), 55000); } }, initializeTipMenu: function () { var iFrequency = 1; var iPadding = 0; var l = (this.tippersList.length > 5) ? 5 : this.tippersList.length; for (let j = 1; j <= tipMenuSize; j++) { if (cb.settings['insy_tip_menu_item_' + j] !== '' && cb.settings['insy_tip_menu_item_price_' + j] > 0) { this.tipMenuItem.push(cb.settings['insy_tip_menu_item_' + j]); this.tipMenuItemPrice.push(cb.settings['insy_tip_menu_item_price_' + j]); } } this.tipMenuText = ''; let menuArray = []; let sorted = []; let menuL = this.tipMenuItemPrice.length; let maxPrice = 0; for (let i = 0; i < menuL; i++) { sorted.push({ "prices": this.tipMenuItemPrice[i], "id": i }); if (maxPrice < this.tipMenuItemPrice[i]) { maxPrice = this.tipMenuItemPrice[i]; } } if (maxPrice > 9999) { iPadding = 5; } else if (maxPrice > 999) { iPadding = 4; } else if (maxPrice > 99) { iPadding = 3; } else if (maxPrice > 9) { iPadding = 2; } else { iPadding = 1; } if (this.tipMenuSortBy !== 'Do not sort the list') { sorted.sort(function (a, b) { return a.prices - b.prices; }); if (this.tipMenuSortBy === 'Price Descending') { sorted.reverse(); } } for (let j = 0; j < sorted.length; j++) { if (this.tipMenuItemPrice[sorted[j].id] !== 0) { if (this.tipMenuStyle === 'List') { menuArray.push('[' + utils.pad(this.tipMenuItemPrice[sorted[j].id], iPadding, '\u2007', 0) + '] ' + this.tipMenuItem[sorted[j].id]); } else { menuArray.push(this.tipMenuItem[sorted[j].id] + ' [' + this.tipMenuItemPrice[sorted[j].id] + '] '); } } } if (this.tipMenuDivider === '---' && this.tipMenuDividerCustom) { this.tipMenuDividerInUse = this.tipMenuDividerCustom; } else { this.tipMenuDividerInUse = this.tipMenuDivider; } this.tipMenuDividerInUse += ' '; for (let j = 0; j < menuArray.length; j++) { this.tipMenuText += this.tipMenuDividerInUse + menuArray[j]; if (this.tipMenuStyle === 'List' && j < menuArray.length - 1) { this.tipMenuText += '\u2007\n'; } if (this.tipMenuStyle === 'List (No Spaces)' && j < menuArray.length - 1) { this.tipMenuText += '\u2007\n'; } } this.tipMenuInterval = cb.setTimeout(this.sendTipMenu.bind(this), 15000); return true; }, initializeToyLevels: function () { this.toyNotice = EMOJI_BOT + ' ' + cb.room_slug + ' ' + this.toyName + ' Levels ' + EMOJI_BOT; for(var i=1; i<=15;i++) { if(cb.settings['insy_toy_level_' + i]) this.toyNotice += '\n' + insycircledigit[i-1] + ' ' + cb.settings['insy_toy_level_'+i]; } if (cb.settings.insy_toy_special_1 !== '') this.toyNotice += '\n\u2007\u2007\u2007' + EMOJI_LOW_BRIGHTNESS + EMOJI_HIGH_BRIGHTNESS + ' Special Commands ' + EMOJI_HIGH_BRIGHTNESS + EMOJI_LOW_BRIGHTNESS + '\u2007\u2007\u2007'; for(var j=1; j<=9;j++) { if(cb.settings['insy_toy_special_' + j]) this.toyNotice += '\n' + EMOJI_RIGHT_POINTING + ' ' + cb.settings['insy_toy_special_'+j]; } var iFrequency = 1; this.toyLevelsInterval = cb.setTimeout(this.sendToyLevels.bind(this), 23000); return true; }, sendTipMenu: function () { var iFrequency = 1; if (this.userCounter < 10) { iFrequency = 11; } else if (this.userCounter < 20) { iFrequency = 9; } else if (this.userCounter < 50) { iFrequency = 7; } else if (this.userCounter < 100) { iFrequency = 5; } else if (this.userCounter >= 100) { iFrequency = 4; } else { iFrequency = 5; } if (this.tipMenuInterval) { cb.cancelTimeout(this.tipMenuInterval); this.tipMenuInterval = 0; } msg = this.tipMenuText; if (msg) { msg += '\n' + ' type /menu to see the Tip Menu\u2007'; var msgT = EMOJI_BOT + ' ' + cb.room_slug + ' Tip Menu ' + EMOJI_BOT; if (this.yellowWall && this.isYellowWall) { utils.delayedNotice(this.botNoticeDelay, msgT, '', COLOR_YELLOW, COLOR_BLACK, 'bold'); } else { utils.delayedNotice(this.botNoticeDelay, msgT, '', this.botTextColor, this.botBgColor, 'bold'); } utils.delayedNotice(this.botNoticeDelay + 250, msg, '', this.botBgColor, this.botTextColor, 'bold'); this.tipMenuInterval = cb.setTimeout(this.sendTipMenu.bind(this), (iFrequency * 60000) + 15); } return true; }, sendTipMenuUser: function (name) { msg = this.tipMenuText; if (this.isTipMenu) { if (msg) { msg += '\n' + ' type /menu to see the Tip Menu\u2007'; var msgT = EMOJI_BOT + ' ' + cb.room_slug + ' Tip Menu ' + EMOJI_BOT; if (this.yellowWall && this.isYellowWall) { utils.delayedNotice(this.botNoticeDelay, msgT, name, COLOR_YELLOW, COLOR_BLACK, 'bold'); } else { utils.delayedNotice(this.botNoticeDelay, msgT, name, this.botTextColor, this.botBgColor, 'bold'); } utils.delayedNotice(this.botNoticeDelay + 250, msg, name, this.botBgColor, this.botTextColor, 'bold'); } } return true; }, sendToyLevels: function () { var iFrequency = 1; if (this.userCounter < 10) { iFrequency = 11; } else if (this.userCounter < 20) { iFrequency = 9; } else if (this.userCounter < 50) { iFrequency = 7; } else if (this.userCounter < 100) { iFrequency = 5; } else if (this.userCounter >= 100) { iFrequency = 4; } else { iFrequency = 5; } if (this.toyLevelsInterval) { cb.cancelTimeout(this.toyLevelsInterval); this.toyLevelsInterval = 0; } msg = this.toyNotice; if (msg) { msg += '\n' + ' type /levels to see the Toy Levels\u2007'; utils.delayedNotice(this.botNoticeDelay + 250, msg, '', this.toyColorBackground, this.toyColorForeground, 'normal'); this.toyLevelsInterval = cb.setTimeout(this.sendToyLevels.bind(this), (iFrequency * 60000) + 1000); } return true; }, sendToyLevelsUser: function (name) { msg = this.toyNotice; if (this.toyNotice) { if (msg) { msg += '\n' + ' type /levels to see the Toy Levels\u2007'; utils.delayedNotice(this.botNoticeDelay + 250, msg, name, this.toyColorBackground, this.toyColorForeground, 'normal'); } } return true; }, sendAd: function () { var iFrequency = 1; if (this.userCounter < 10) { iFrequency = 8; } else if (this.userCounter < 20) { iFrequency = 6; } else if (this.userCounter < 50) { iFrequency = 4; } else if (this.userCounter < 100) { iFrequency = 3; } else if (this.userCounter >= 100) { iFrequency = 2; } else { iFrequency = 4; } if (!cb.limitCam_isRunning() || this.isAway) { var msgTxt = ''; if (this.advertisingMessageNumber > 0) { if (this.advertisingMessageNumber == 1) { msgTxt = this.advertisingMessage1; if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else { this.advertisingMessageNumber = 1; } } else if (this.advertisingMessageNumber == 2) { msgTxt = this.advertisingMessage2; if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else { this.advertisingMessageNumber = 2; } } else if (this.advertisingMessageNumber == 3) { msgTxt = this.advertisingMessage3; if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else { this.advertisingMessageNumber = 3; } } else if (this.advertisingMessageNumber == 4) { msgTxt = this.advertisingMessage4; if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else { this.advertisingMessageNumber = 4; } } else if (this.advertisingMessageNumber == 5) { msgTxt = this.advertisingMessage5; if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else { this.advertisingMessageNumber = 5; } } else if (this.advertisingMessageNumber == 6) { msgTxt = this.advertisingMessage6; if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else { this.advertisingMessageNumber = 6; } } else if (this.advertisingMessageNumber == 7) { msgTxt = this.advertisingMessage7; if (this.advertisingMessage8 != '') { this.advertisingMessageNumber = 8; } else if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else { this.advertisingMessageNumber = 7; } } else if (this.advertisingMessageNumber == 8) { msgTxt = this.advertisingMessage8; if (this.advertisingMessage1 != '') { this.advertisingMessageNumber = 1; } else if (this.advertisingMessage2 != '') { this.advertisingMessageNumber = 2; } else if (this.advertisingMessage3 != '') { this.advertisingMessageNumber = 3; } else if (this.advertisingMessage4 != '') { this.advertisingMessageNumber = 4; } else if (this.advertisingMessage5 != '') { this.advertisingMessageNumber = 5; } else if (this.advertisingMessage6 != '') { this.advertisingMessageNumber = 6; } else if (this.advertisingMessage7 != '') { this.advertisingMessageNumber = 7; } else { this.advertisingMessageNumber = 8; } } } if (msgTxt != '') { // Cancel notifier advertising if (this.advertisingInterval) { cb.cancelTimeout(this.advertisingInterval); this.advertisingInterval = 0; } this.messageCounter = 0; var msgDividerTop = insydividerTop.replace(/0/g, EMOJI_BOT); var msgDividerBottom = insydividerBottom.replace(/0/g, EMOJI_BOT); msg = msgDividerTop + '\n' + msgTxt + '\n' + msgDividerTop; utils.delayedNotice(this.botNoticeDelay + 2000, msg, '', this.advertisingColorBackground, this.advertisingColorForeground, 'bold'); this.advertisingInterval = cb.setTimeout(this.sendAd.bind(this), (iFrequency * 60000) + 15); } // Cancel notifier advertising hidden if (this.advertisingHiddenInterval) { cb.cancelTimeout(this.advertisingHiddenInterval); this.advertisingHiddenInterval = 0; } } else { if (this.advertisingHiddenMessage != '') { // Cancel notifier advertising hidden if (this.advertisingHiddenInterval) { cb.cancelTimeout(this.advertisingHiddenInterval); this.advertisingHiddenInterval = 0; } this.messageCounter = 0; var msgDividerTop = insydividerTop.replace(/0/g, EMOJI_BOT); var msgDividerBottom = insydividerBottom.replace(/0/g, EMOJI_BOT); msg = msgDividerTop + '\n' + this.advertisingHiddenMessage + '\n' + msgDividerTop; utils.delayedNotice(this.botNoticeDelay + 2000, msg, '', this.advertisingColorBackground, this.advertisingColorForeground, 'bold'); this.advertisingHiddenInterval = cb.setTimeout(this.sendAd.bind(this), (iFrequency / 2 * 60000) + 15); } // Cancel notifier advertising if (this.advertisingInterval) { cb.cancelTimeout(this.advertisingInterval); this.advertisingInterval = 0; } } return true; }, sendLB: function () { var iFrequency = 1; if (this.userCounter < 10) { iFrequency = 10; } else if (this.userCounter < 20) { iFrequency = 8; } else if (this.userCounter < 50) { iFrequency = 6; } else if (this.userCounter < 100) { iFrequency = 4; } else if (this.userCounter > 200) { iFrequency = 3; } else { iFrequency = 4; } if (this.leaderBoard) { // Cancel notifier advertising if (this.leaderBoardInterval) { cb.cancelTimeout(this.leaderBoardInterval); this.leaderBoardInterval = 0; } if (this.tippersList.length > 0) { var msg = EMOJI_BOT + ' ' + cb.room_slug + ' Top Lovers ' + EMOJI_BOT; if (this.yellowWall && this.isYellowWall) { utils.delayedNotice(this.botNoticeDelay + 2000, msg, '', COLOR_YELLOW, COLOR_BLACK, 'bold'); } else { utils.delayedNotice(this.botNoticeDelay + 2000, msg, '', this.botTextColor, this.botBgColor, 'bold'); } msg = ''; var iPadding = 5; var l = (this.tippersList.length > 5) ? 5 : this.tippersList.length; for (var i = 0; i < l; i++) { if (i == 0) { if (this.tippersList[i].tokens > 9999) { iPadding = 5; } else if (this.tippersList[i].tokens > 999) { iPadding = 4; } else if (this.tippersList[i].tokens > 99) { iPadding = 3; } else if (this.tippersList[i].tokens > 9) { iPadding = 2; } else { iPadding = 1; } msg += EMOJI_KING + ' [' + utils.pad(this.tippersList[i].tokens, iPadding, '\u2007', 0) + '] @' + this.tippersList[i].name; } else { msg += '\n' + EMOJI_HEART_LB + ' [' + utils.pad(this.tippersList[i].tokens, iPadding, '\u2007', 0) + '] @' + this.tippersList[i].name; } } if (this.tippersList.length > 5) { msg += '\n' + ' type /board for the Full Lovers list\u2007'; } utils.delayedNotice(this.botNoticeDelay + 2200, msg, '', this.botBgColor, this.botTextColor, 'normal'); } this.leaderBoardInterval = cb.setTimeout(this.sendLB.bind(this), (iFrequency * 60000) + 9); } return true; }, sendFullLB: function (name) { if (this.leaderBoard) { if (this.tippersList.length > 0) { var msg = EMOJI_BOT + ' ' + cb.room_slug + ' Full Lovers List ' + EMOJI_BOT; if (this.yellowWall && this.isYellowWall) { utils.delayedNotice(this.botNoticeDelay + 2000, msg, name, COLOR_YELLOW, COLOR_BLACK, 'bold'); } else { utils.delayedNotice(this.botNoticeDelay + 2000, msg, name, this.botTextColor, this.botBgColor, 'bold'); } msg = ''; var iPadding = 5; for (var i = 0; i < this.tippersList.length; i++) { if (i == 0) { if (this.tippersList[i].tokens > 9999) { iPadding = 5; } else if (this.tippersList[i].tokens > 999) { iPadding = 4; } else if (this.tippersList[i].tokens > 99) { iPadding = 3; } else if (this.tippersList[i].tokens > 9) { iPadding = 2; } else { iPadding = 1; } msg += EMOJI_KING + ' [' + utils.pad(this.tippersList[i].tokens, iPadding, '\u2007', 0) + '] @' + this.tippersList[i].name; } else { msg += '\n' + EMOJI_HEART_LB + ' [' + utils.pad(this.tippersList[i].tokens, iPadding, '\u2007', 0) + '] @' + this.tippersList[i].name; } } utils.delayedNotice(this.botNoticeDelay + 2200, msg, name, this.botBgColor, this.botTextColor, 'normal'); } else { utils.userNotice(name, 'No Lovers till now.'); } } return true; }, sendFullLBHidden: function (name) { if (this.tippersHiddenList.length > 0) { var msg = EMOJI_BOT + ' ' + cb.room_slug + ' Insy Spy Show Summary ' + EMOJI_BOT; utils.delayedNotice(this.botNoticeDelay + 3000, msg, name, this.botTextColor, this.botBgColor, 'bold'); msg = ''; var iTotalTokens = 0; var iPadding = 5; for (var i = 0; i < this.tippersHiddenList.length; i++) { if (i == 0) { msg += EMOJI_PLUS + ' [' + utils.pad(this.tippersHiddenList[i].tokens, iPadding, '\u2007', 0) + '] @' + this.tippersHiddenList[i].name; } else { msg += '\n' + EMOJI_PLUS + ' [' + utils.pad(this.tippersHiddenList[i].tokens, iPadding, '\u2007', 0) + '] @' + this.tippersHiddenList[i].name; } iTotalTokens += this.tippersHiddenList[i].tokens; } msg += '\n' + EMOJI_EQUALS + ' [' + utils.pad(iTotalTokens, iPadding, '\u2007', 0) + '] Total Tokens'; utils.delayedNotice(this.botNoticeDelay + 3400, msg, name, this.botBgColor, this.botTextColor, 'normal'); } return true; }, sendFS: function () { var iFrequency = 1; if (this.userCounter < 10) { iFrequency = 9; } else if (this.userCounter < 20) { iFrequency = 7; } else if (this.userCounter < 50) { iFrequency = 5; } else if (this.userCounter < 100) { iFrequency = 4; } else if (this.userCounter > 200) { iFrequency = 3; } else { iFrequency = 3; } if (this.freeForTokens > 0) { // Cancel notifier advertising if (this.freeShowRewardInterval) { cb.cancelTimeout(this.freeShowRewardInterval); this.freeShowRewardInterval = 0; } if (this.tippersList.length > 0 && !cb.limitCam_isRunning()) { var msg = EMOJI_LOCK + ' Tip at least ' + this.freeForTokens + ' Tokens to get ' + this.botName + ' gift ticket ' + EMOJI_UNLOCK; if (this.yellowWall && this.isYellowWall) { utils.delayedNotice(this.botNoticeDelay + 2000, msg, name, COLOR_YELLOW, COLOR_BLACK, 'bold'); } else { utils.delayedNotice(this.botNoticeDelay + 2000, msg, name, this.botTextColor, this.botBgColor, 'bold'); } msg = 'type /ticket to see the ticket owners list\u2007'; utils.delayedNotice(this.botNoticeDelay + 2200, msg, '', this.botBgColor, this.botTextColor, 'normal'); } this.freeShowRewardInterval = cb.setTimeout(this.sendFS.bind(this), (iFrequency * 60000) + 2000); } return true; } } /** * Utils object */ var utils = { // Data colorList: { Amaranth: { code: '#c92572', bgcode: '#f9eaf1' }, Black: { code: '#000000', bgcode: '#e8e8e8' }, Blue: { code: '#4343e3', bgcode: '#e6ebff' }, LightBlue: { code: '#59aff8', bgcode: '#e1effb' }, SteelBlue: { code: '#859ebd', bgcode: '#edf1f9' }, DarkBlue: { code: '#161683', bgcode: '#e0e9ff' }, DarkBrown: { code: '#4c0017', bgcode: '#ede0e4' }, DeepPink: { code: '#FF1493', bgcode: '#ffedf7' }, BrownRed: { code: '#b31313', bgcode: '#fbe9e9' }, DarkOrange: { code: '#dc5500', bgcode: '#f9efe8' }, DarkViolet: { code: '#8600b3', bgcode: '#efdff4' }, Eucalyptus: { code: "#2B886D", bgcode: '#dde5e3' }, SeanceViolet: { code: '#ba21bf', bgcode: '#ffdffe' }, Green: { code: '#327939', bgcode: '#e1f9e3' }, GreenYellow: { code: '#89d90a', bgcode: '#edfbd8' }, GoldYellow: { code: '#FFA500', bgcode: '#fffbe8' }, DarkGreen: { code: '#436446', bgcode: '#e4ede5' }, CeriseRed: { code: '#e32370', bgcode: '#ffeef5' }, Pink: { code: '#F77FBE', bgcode: '#FCEFF6' }, RosePink: { code: '#FF00BA', bgcode: '#ffe8f9' }, Olive: { code: '#9FA64E', bgcode: '#F7F8EB' }, Purple: { code: '#800080', bgcode: '#f1e4f1' }, Red: { code: '#ff3232', bgcode: '#ffe5e5' }, SlateGray: { code: '#708090', bgcode: '#edf1f4' }, Turquoise: { code: '#1ba0a2', bgcode: '#e2f6f6' }, }, allUserCounter: 0, // Methods getColorCode: function (name) { return (this.colorList[name] ? this.colorList[name].code : COLOR_BLACK); }, getBgColorCode: function (name) { return (this.colorList[name] ? this.colorList[name].bgcode : COLOR_WHITE); }, isHexColor: function (code) { return /^#[0-9A-F]{6}$/i.test(code); }, splitMe: function (e) { return e.trim().replace(/\s+/g, " ").split(" ") }, /* * Replaces $ in a text depending on whether the num parameter is greater than 1 or not */ pluralExp(num, text) { return num + ' ' + text.replace('$', (num > 1 ? 's' : '')); }, /** * Create array with all elements in the string @strlist with separator "," * @flagSpaces: Spaces allowed inside elements when true * set it TRUE for nicknames and similars, * skip it for expressions with spaces. */ settingsListToArray: function (strList, flagSpaces) { // Trim string and inner items strList = strList.trim(); strList = strList.replace(/[ ]+,|,[ ]+/g, ','); // Remove empty items and commas at the end strList = strList.replace(/[,]+/g, ','); strList = strList.replace(/(,+$)/g, ''); // If spaces are not allowed inside items, replace with separator if (!flagSpaces) { strList = strList.replace(/ /g, ','); } return (strList.split(',')); }, /** * Returns the time from a Date object in a string format: 1h 2mins 45secs */ timeToString: function (date) { var out = ''; if (date.getHours()) out += date.getHours() + 'h'; if (date.getMinutes()) { out += ' ' + date.getMinutes(); out += (date.getMinutes() > 1) ? 'mins' : 'min'; } if (date.getSeconds()) { out += ' ' + date.getSeconds(); out += (date.getSeconds() > 1) ? 'secs' : 'sec'; } return out; }, /** * Returns a string with the time elapsed since a date value */ getElapsedTime: function (startTime) { var elapsedSeconds = this.getElapsedSeconds(startTime); var date = new Date(elapsedSeconds * 1000); // Fix for date problem on cb that adds 17h for unknown reason (on testbed works fine) date.setHours(Math.floor(elapsedSeconds / 3600)); return this.timeToString(date); }, /** * Returns a string with the time left to reach a date value */ getTimeLeft: function (endTime) { var secondsLeft = this.getSecondsLeft(endTime); var date = new Date(secondsLeft * 1000); // Fix for date problem on cb that adds 17h for unknown reason (on testbed works fine) date.setHours(Math.floor(secondsLeft / 3600)); return this.timeToString(date); }, /** * Returns elapsed time since a date, in seconds */ getElapsedSeconds: function (date) { var now = Date.now(); var elapsed = Math.floor((now - date) / (1000)); return elapsed; }, /** * Returns time left for a date, in minutes */ getMinutesLeft: function (date) { var now = Date.now(); var left = Math.floor((date - now) / 60000); return left; }, /** * Returns time left for a date, in seconds */ getSecondsLeft: function (date) { var now = Date.now(); var left = Math.floor((date - now) / 1000); return left; }, /** * Return parameter in a certain position in a string */ getParam: function (msg, position) { var tmp = msg.toLowerCase().split(' '); return tmp[position]; }, /** * Send notifications */ userNotice: function (user, msg, color, bgcolor, weight, group) { if (msg) { cb.sendNotice(msg, user, (bgcolor ? bgcolor : COLOR_WHITE), (color ? color : insyShow.botTextColor), (weight ? weight : 'bold'), group); } }, modelNotice: function (msg, color, bgcolor, weight) { this.userNotice(cb.room_slug, msg, color, bgcolor, (weight ? weight : 'bold')); }, groupNotice: function (group, msg, color, bgcolor, weight) { this.userNotice('', msg, color, bgcolor, weight, group); }, roomNotice: function (msg, color, bgcolor, weight) { this.userNotice('', msg, (color ? color : insyShow.botTextColor), (bgcolor ? bgcolor : insyShow.botBgColor), (weight ? weight : 'bold')); }, roomInfoNotice: function (msg, color, bgcolor, weight) { this.userNotice('', msg, (color ? color : insyShow.botBgColor), (bgcolor ? bgcolor : insyShow.botTextColor), (weight ? weight : 'bold')); }, addUserCounter: function () { this.allUserCounter++; }, /** * Send delayed notice * @msg: mes sage to send * @target: send the notice to this target * @delay: delay time in miliseconds * @weight: font weight * @group: send to group of users * */ delayedNotice: function (delay, msg, target, bgcolor, fgcolor, weight, group) { if (msg && Number.isInteger(delay) && delay > 0) { // Send Notice setTimeout(function () { cb.sendNotice(msg, target, bgcolor, fgcolor, weight, group); }, delay); return true; } else { return false; } }, /** * Send delayed notice * @msg: message to send * @target: send the notice to this target * @delay: delay time in miliseconds * @weight: font weight * @group: send to group of users * */ delayedNoticeUser: function (delay, msg, target, bgcolor, fgcolor, weight, group) { if (msg && Number.isInteger(delay) && delay > 0) { // Send Notice setTimeout(function () { cb.sendNotice(msg, target, bgcolor, fgcolor, weight, group); }, delay); return true; } else { return false; } }, /** * Return random number between min and max * @min: min number * @max: max number * */ randomNumber: function getRndInteger(min, max) { min = Math.ceil(min); max = Math.floor(max); return Math.floor(Math.random() * (max - min) + min); //The maximum is exclusive and the minimum is inclusive }, /** * Return padded string with input length and placeholder * @n: input string * @width: lemgth of the padded string * @z: the placeholder * @s: 0=padding left, 1=padding right */ pad: function pad(n, width, z, s) { z = z || '0'; n = n + ''; if (s == 0) { return n.length >= width ? n : new Array(width - n.length + 1).join(z) + n; } else if (s == 1) { return n.length >= width ? n : n + new Array(width - n.length + 1).join(z); } else { return n; } }, handleException: function handleException(eventName, e) { var msg = "<EXCEPTION>: \""; if ('message' in e) msg += e.message; else msg += e; msg += "\""; msg += " <EVENT>: " + eventName; if ('trace' in e) msg += " <TRACE>: " + e.stack; cb.log(msg); } } // Chaturbate stuff cb.onMessage(function (msg) { return insyShow.onMessage(msg); }); cb.onTip(function (tip) { insyShow.onTip(tip); }); cb.onEnter(function (user) { insyShow.onEnter(user); }); cb.onFollow(function (user) { insyShow.onFollow(user); }); cb.onUnFollow(function (user) { insyShow.onUnFollow(user); }); cb.onStart(function (user) { insyShow.onStart(user); }); cb.settings_choices = []; // Load me! insyShow.init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.