Bots Home
|
Create an App
notifier with tipmenuplus
Author:
pholtest
Description
Source Code
Launch Bot
Current Users
Created by:
Pholtest
//---- settings for notifier ---// set1=[]; set1_max = 6; var i=0; modnote = cb.settings.modnote; color = cb.settings['msgcolor']; sid = ''; set1.push({name: 'setup', type: 'choice', choice1:' 0 - Use only Notifier!', choice2: '1 - Use only Tip menu plus', choice3: '2 - Use Both', defaultValue:'2 - Use Both', label: 'which apps do you want to use?'}); set1.push({name: 'setupb', type: 'choice', choice1:' 0 - separate notices', choice2: '1 - combine notices', defaultValue:'1 - combine notices', label: 'which apps do you want to use?'}); set1.push({name:'Wmsg', type:'str', required: true, label:'welcome message (USER = Members name)',}); set1.push({name:'seperator', required: false, type:'str', label:'----- Notifier Settings -----'}); set1.push({name: 'modnote', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "allow moderator to post custom notice "}); set1.push({name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay between notices( in minutes) also used for combined notices'}); set1.push({name:'msgcolor', type:'str', required: false, label:'Message color(defult = #ff00dd)',defaultValue:'#ff00dd'}); for(var x = 1; x <= set1_max; x++) { if (x ==1) { req = true;} else {req = false;} set1.push({name:'msg' + x, type:'str', required: req, label:'auto Message ' +x,}); } set1.push({name:'seperator2', required: false, type:'str', label:'----- Custom messages that can be used in chat.. (your use and mod use if you allow them.-----'}); set1.push({name:'premsg1', type:'str', required: false, label:'preset message 1 (room use)',}); set1.push({name:'premsg2', type:'str', required: false, label:'preset message 2 (room use)',}); set1.push({name:'premsg3', type:'str', required: false, label:'preset message 3 (room use)',}); //-- settingst for tip menu plus --// var HEART = '\u2665'; // ♥ BDIAMOND = '\u2666'; // ♦ BSTAR = '\u2605'; // ★ var tip_amt = 0; var separator_char = "| "; var msg; var tipmenuprice = []; var tipmenuitem= []; set2_max = 20; var MAXSEP = 9; separators = [ {label:'Hearts',shortcut:':heart2'}, {label:'Glitter',shortcut:':pixelglitter'}, {label:'Flowers',shortcut:':tinyflower2'}, {label:'Bow',shortcut:':bluebow'}, {label:'Hearts2',shortcut:':pixelheart'}, {label:'Smiley',shortcut:':smile'}, {label:'Text Heart',shortcut:HEART}, {label:'Text Diamond',shortcut:BDIAMOND}, {label:'Text Star',shortcut:BSTAR}, ]; set2 = [ {name:'seperator3', required: false, type:'str', label:'----- Tip menu plus settings -----'}, {name: 'sepchar', type: 'choice', choice1: 'Vertical Bar', choice2: 'Hearts', choice3:'Glitter',choice4:'Flowers',choice5:'Bow',choice6:'Hearts2',choice7:'Smiley',choice8:'Text Heart', choice9:'Text Diamond', choice10:'Text Star', defaultValue: 'Vertical Bar', label: "Separator character"}, {name:'noticecolor', type:'str', label:'Tip menu color (default color = red #FF0000)', defaultValue: '#FF0000'}, {name: 'chat_ad2', type:'int', minValue: 1, maxValue: 999, defaultValue: 1, label: 'Delay in minutes (min 1 minute)'}]; for(var x = 1; x <= set2_max; x++) { if (x ==1) { req = true; eg = ' (eg 10--flash tits)';} else {req = false; eg= '';} set2.push({name:'item' + x, type:'str', required: req, label:'Item ' +x+ eg,}); } cb.settings_choices = set1.concat(set2); function chatAd() { var msg; while (cb.settings['msg' + (i + 1)] == 0) { //skip empty messages i++; i %= set1_max; } msg = cb.settings['msg' + (i + 1)]; i++; i %= set1_max; cb.sendNotice(msg,'','',cb.settings['msgcolor'],'bold'); if (((subno == 0) && (no == 2)) | (no == 0)) {cb.setTimeout(chatAd, cb.settings.chat_ad*60000);} } cb.onMessage(function (msg) { nam = ''; if (((modnote == "yes") && (msg['is_mod'] == true)) || (msg['user'] == cb.room_slug)) { if (msg['m'].match(/\/note/i) ) {newmsg = msg['m'].replace( /\/note/i, "" ).trim(); msg['X-Spam'] = true;} else if (msg['m'].match(/\/color/i) ) {Ncolor = msg['m'].replace( /\/color /i, "" ).trim(); nam = msg['user']; msg['X-Spam'] = true; var isOk = /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(Ncolor); if (isOk == true) {color = Ncolor; newmsg = 'color changed'; } else if (isOk == false) {newmsg = 'check color code and try again!';} } else { newmsg = '';} if (newmsg) {Mmsg = newmsg; cb.chatNotice(Mmsg, nam, '#ffffff', color , 'bold');} ;} if (msg['user'] == cb.room_slug) { if (msg['m'].match(/\/m1/i) ) { if (cb.settings["premsg1"]) {newmsg2 = cb.settings["premsg1"];} else { newmsg2 = '';};} else if (msg['m'].match(/\/m2/i) ) { if (cb.settings["premsg2"]) {newmsg2 = cb.settings["premsg2"];} else { newmsg2 = '';};} else if (msg['m'].match(/\/m3/i) ) { if (cb.settings["premsg3"]) {newmsg2 = cb.settings["premsg3"];} else { newmsg2 = '';};} else { newmsg2 = '';} if (newmsg2) { msg['m'] = newmsg2; };} return msg; }); cb.onEnter(function(user) { WelcomeMSG = ''; if (user['user'] == cb.room_slug) {WelcomeMSG = 'welcome ' + user['user'] + ' to your room';} else if (user['is_mod'] == true) {WelcomeMSG = 'welcome ' + user['user'] + ' you are my moderator';} else {WelcomeMSG = cb.settings['Wmsg'].replace( /USER/gi, user['user'] );} if (user['is_mod'] == true) { WelcomeMSG += '\n As the moderator please post messages to help my room.';} if (((modnote == "yes") && (user['is_mod'] == true)) || (user['user'] == cb.room_slug)) { WelcomeMSG += '\n you can use the following codes in this room'; if (user['user'] == cb.room_slug) { if (cb.settings['premsg1']) {WelcomeMSG += '\n /m1 = ' + cb.settings['premsg1'];} if (cb.settings['premsg2']) {WelcomeMSG += '\n /m2 = ' + cb.settings['premsg2'];} if (cb.settings['premsg3']) {WelcomeMSG += '\n /m3 = ' + cb.settings['premsg3'];}} if ((cb.settings["modnote"] == "yes") || (user['user'] == cb.room_slug)) { WelcomeMSG += '\n /note = custom notice for the room'; WelcomeMSG += '\n /color = (change the color of /note)'; } } cb.sendNotice(WelcomeMSG,user['user'],'','#111111','normal'); }); function chatAd2() { if (msg!='Tip Menu: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } if (((subno == 0) && (no == 2)) | (no == 1)) {cb.setTimeout(chatAd2, cb.settings.chat_ad2*60000);} } function init() { for (y=0;y<=MAXSEP-1;y++) { if (cb.settings['sepchar'] == separators[y].label) { separator_char = separators[y].shortcut + ' '; } } msg = 'Tip Menu: '; for (y=1;y<=set2_max;y++) { var tmp; tmp=cb.settings['item' + y]; if (tmp) { var arr= tmp.split('--'); if (arr[1]===undefined) { cb.sendNotice('Error-You need two dashes to separate the tip amount and menu item for item no '+ y,'','',cb.settings['noticecolor'],'bold'); } else { var amt=parseInt(arr[0]); if (amt>0) { tipmenuprice[y]=amt; tipmenuitem[y]=arr[1]; if (y>=2) { msg += separator_char; } msg += arr[1] + '(' + amt + ') '; } } } } if (msg!= 'Tip Menu: ') { cb.sendNotice(msg,'','',cb.settings['noticecolor'],'bold'); } else { cb.sendNotice('Error-No menu items found','','',cb.settings['noticecolor'],'bold'); } } function blender() { if (n == 1) { n = 2 ; add = cb.settings.chat_ad; chatAd(); } else { n = 1 ; add = cb.settings.chat_ad; chatAd2();} cb.setTimeout(blender,add*60000); } function checker() { subno = 0; no = 0; if (cb.settings.setup) {no = cb.settings.setup.split(/-/)[0];} if (cb.settings.setupb) {subno = cb.settings.setupb.split(/-/)[0];} if (no == 1) {init(); cb.setTimeout(chatAd2, cb.settings.chat_ad2*60000);} else if (no == 0) {chatAd();} else if ((subno == 1) && (no == 2)) {init(); n= 1; cb.setTimeout(blender, cb.settings.chat_ad*60000);} else if ((subno == 0) && (no == 2)) { init(); cb.setTimeout(chatAd, cb.settings.chat_ad*30000); cb.setTimeout(chatAd2, cb.settings.chat_ad2*60000);} } cb.onTip(function (tip) { tip_amt=parseInt(tip['amount']); for (var i = 1; i <= set2_max ; i++) { if (tip_amt == tipmenuprice[i]) { cb.sendNotice(tip['from_user'] + ' tipped for ' + tipmenuitem[i],'','',cb.settings['noticecolor'],'bold'); } } }); checker();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.