Bots Home
|
Create an App
Notifier
Author:
playfull_mike
Description
Source Code
Launch Bot
Current Users
Created by:
Playfull_Mike
cb.settings_choices=[]; MAXITEMS = 6; var i=0; modnote = cb.settings.modnote; color = cb.settings['msgcolor']; sid = ''; cb.settings_choices.push({name: 'modnote', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'no', label: "allow moderator to post custom notice "}); cb.settings_choices.push({name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay in minutes between notices being displayed (minimum 1)'}); cb.settings_choices.push({name:'Wmsg', type:'str', required: true, label:'welcome message',}); for(var x = 1; x <= MAXITEMS; x++) { if (x ==1) { req = true;} else {req = false;} cb.settings_choices.push({name:'msg' + x, type:'str', required: req, label:'auto Message ' +x,}); } cb.settings_choices.push({name:'premsg1', type:'str', required: false, label:'preset message 1 (room use)',}); cb.settings_choices.push({name:'premsg2', type:'str', required: false, label:'preset message 2 (room use)',}); cb.settings_choices.push({name:'premsg3', type:'str', required: false, label:'preset message 3 (room use)',}); function chatAd() { var msg; while (cb.settings['msg' + (i + 1)] == 0) { //skip empty messages i++; i %= MAXITEMS; } msg = cb.settings['msg' + (i + 1)]; i++; i %= MAXITEMS; cb.sendNotice(msg,'','',cb.settings['msgcolor'],'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); cb.onMessage(function (msg) { if (((modnote == "yes") && (msg['is_mod'] == true)) || (msg['user'] == cb.room_slug)) { if (msg['m'].match(/\/note/i) ) {newmsg = msg['m'].replace( /\/note/i, "" );} else if (msg['m'].match(/\/mmm1/i) ) { if (cb.settings["premsg1"]) {newmsg = cb.settings["premsg1"];} else { newmsg = '';};} else if (msg['m'].match(/\/mmm2/i) ) { if (cb.settings["premsg2"]) {newmsg = cb.settings["premsg2"];} else { newmsg = '';};} else if (msg['m'].match(/\/mmm3/i) ) { if (cb.settings["premsg3"]) {newmsg = cb.settings["premsg3"];} else { newmsg = '';};} else { newmsg = '';} if (newmsg) { msg['m'] = newmsg; msg['user'] = cb.room_slug; } if (msg['m'].match(/\/color/i) ) {sid = ''; Ncolor = msg['m'].replace( /\/color /i, "" ); 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!';} if (newmsg) { Mmsg =newmsg; msg['X-Spam'] = true; cb.chatNotice(Mmsg, msg['user'], '#ffffff', color , 'bold');} } } 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 (cb.settings['premsg1']) {WelcomeMSG += '\n /mmm1 = ' + cb.settings['premsg1'];} if (cb.settings['premsg2']) {WelcomeMSG += '\n /mmm2 = ' + cb.settings['premsg2'];} if (cb.settings['premsg3']) {WelcomeMSG += '\n /mmm3 = ' + 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'],'',cb.settings['msgcolor'],'bold'); });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.