Bots Home
|
Create an App
Motorbunny Tip Integration Bot
Author:
hharan77test
Description
Source Code
Launch Bot
Current Users
Created by:
Hharan77test
function init() { levelMode = "LIST"; if(cb.settings.messColor) { messColor = colorList[cb.settings.messColor].c; } cb.settings.tags && (tags = cb.settings.tags.trim() ? cb.settings.tags : ""), (!tags || tags.toLowerCase().indexOf("Motorbunny") < 0) && (tags += ""); var e = mySplit(tags); tags = ""; for (var t = 0; t < e.length; t++) tags += "#" == e[t].substring(0, 1) ? e[t] : "#" + e[t]; initNotice(); initLevel(); changeSubject(); sendTitle(t, skp + "Tip Levels " + tip1 + " " + tip2 + " " +tip3 + " " + tip4 + " " + tip5 + " " + urlTip + skp) ; } function mySplit(e) { return e.trim().replace(/\s+/g, " ").split(" ") } function initNotice() { for (var e = 1; maxNotice >= e; e++) { var t = cb.settings["notice" + e] ? cb.settings["notice" + e].trim() : ""; t && (noteList[++noteNb] = { note: t }) } } function initLevel() { for (var e = 1; maxLevel >= e; e++) { var t = cb.settings["level" + e] ? cb.settings["level" + e].trim() : ""; if(t) { levelNotice += sqr + t + skp} } tip1 = cb.settings.level1Tip; tip2 = cb.settings.level2Tip; tip3 = cb.settings.level3Tip; tip4 = cb.settings.level4Tip; tip5 = cb.settings.level5Tip; urlTip = cb.settings.level6Tip; } function levelDisplay(e) { sendTitle(e, skp + levelNotice + skp) ; } function changeSubject() { var e = roomSubject; cb["changeRoomSubject"](e + " " + tags); } function sendTitle(e, t, n) { var o = n ? n : messColor; o = isOwner(e) ? "#000000" : o, cb.sendNotice(t, e, "", o, "bolder") } function isOwner(e) { return e == cb.room_slug } function onTip(t,n) { tipSum += t; if( t >= 1100) { // getShareToken(true,n); } else { // getShareToken(false); } if (t >0 && t<tip1) { cb.sendNotice("Level 1.", cb.room_slug); } else if (t >=tip1 && t<tip2) { cb.sendNotice("Level 2.", cb.room_slug); } if (t >=tip2 && t<tip3) { cb.sendNotice("Level 3.", cb.room_slug); } if (t >=tip3 && t<tip4) { cb.sendNotice("Level 4.", cb.room_slug); } if (t >=tip4 && t<tip5) { cb.sendNotice("Level 5.", cb.room_slug); } if (t >=urlTip ) { cb.sendNotice("Level 6.", cb.room_slug); sendTitle(n, skp + n + " Check your PM for the code. For tips >= 1100, You get a private MB Controller link to control my Motorbunny buzz and twirl from your browser! Use https://link.motorbunny.com/c/<code> to control." + skp); } cb["drawPanel"](); } function getShareToken(share,n) { var xhttp = new XMLHttpRequest; xhttp.setRequestHeader('Accept','application/json'); xhttp.setRequestHeader('Authorization',authToken); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { cb.log(this.responseText); var ret = JSON.parse(this.responseText); shareToken = ret.token; identifier = "{\"channel\":\"DevicesChannel\",\"share_token\":\"" + shareToken + "\"}"; if(share) { sendTitle(n, skp + shareUrl + shareToken + skp) ; return; } connect(); } }; xhttp.open("GET", "https://api.motorbunny.com/share_token", true); xhttp.send(); } function connect(){ try { subscribed = false; var host = "wss://api.motorbunny.com/cable"; socket = new WebSocket(host); socket.onopen = function() { //console.log("opened!"); } socket.onmessage = function(msg) { //console.log("message = " + msg); if(!subscribed) { subscribe(); } if(msg && msg.data && msg.data.indexOf("\"buzz_value\":-1") != -1) { socket.close(); } } socket.onclose = function() { shareToken = ""; identifier = ""; subscribed = false; } } catch(e) { console.log(e); } } function sendBuzz(buzz) { try { buzz = Math.round(buzz); var cmd = {}; cmd.command = "message"; cmd.identifier = identifier; data = {}; data.value = buzz; data.share_token = shareToken; data.action = "set_buzz"; cmd.data = JSON.stringify(data); var str = JSON.stringify(cmd); //console.log(str); socket.send(str); } catch(e) { console.log(e); } } function subscribe() { var cmd = {}; cmd.command = "subscribe"; cmd.identifier = identifier; //console.log(JSON.stringify(cmd)); socket.send(JSON.stringify(cmd)); subscribed = true; } var appName = " [ Motorbunny ] ", owner = cb.room_slug, startTime = (new Date).getTime(), yr = 16436, mth = 5, messColor = "#6900CC", cbColor = "#DC5500", all = "", skp = "\n", dot = " \\u2981 ", hrt = " \\u2665 ", sqr = " ", trg = " \\u25B6 ", lne = "\\u2500", lck = " :w__lck ", wht = " :w__wht "; cb.settings_choices = [{ name: "roomSubject", label: "1. ROOM SETTINGS ........ Room Subject", type: "str", minLength: 1, maxLength: 150, required: !0, defaultValue: "Motorbunny: Device that pleasures at your tips." }, { name: "tags", label: "Tags (#) ", type: "str", minLength: 1, maxLength: 120, required: !1, defaultValue: "Motorbunny" }, { name: "tokenOn", label: "Tokens", type: "choice", choice1: 'Display "Total Received" in Panel', choice2: "Not displayed", "default": 'Display "Total Received" in Panel' }, { name: "messColor", label: "2. NOTICES SETTINGS ... - Display Color", type: "choice", choice1: "Orange", choice2: "Blue", choice3: "Purple", choice4: "Pink", choice5: "Dark_Red", choice6: "Black", defaultValue: "Dark_Red" }, { name: "levelTitle", label: "Level Title", type: "str", minLength: 0, maxLength: 10240, required: !0, defaultValue: "MY MOTORBUNNY IS SET TO REACT TO YOUR TIPS. THERE ARE 6 LEVELS OF INTENSITY" }, { name: "level1", label: "Level 1 ", type: "str", minLength: 0, maxLength: 10240, required: !0, defaultValue: "Level 1 - Buzz 2 for 1 second" },{ name: "level1Tip", label: "Level 1 Max Tip", type: "int", minValue: "1", required: !0, defaultValue: "15" }, { name: "level2", label: "Level 2 ", type: "str", minLength: 0, maxLength: 10240, required: !0, defaultValue: "Level 2 - Buzz 4 for 4 seconds" },{ name: "level2Tip", label: "Level 2 Max Tip", type: "int", minValue: "1", required: !0, defaultValue: "100" }, { name: "level3", label: "Level 3 ", type: "str", minLength: 0, maxLength: 10240, required: !0, defaultValue: "Level 3 - Buzz 6 for 6 seconds" }, { name: "level3Tip", label: "Level 3 Max Tip", type: "int", minValue: "1", required: !0, defaultValue: "500" },{ name: "level4", label: "Level 4 ", type: "str", minLength: 0, maxLength: 10240, required: !0, defaultValue: "Level 4 - Buzz 8 for 8 seconds" }, { name: "level4Tip", label: "Level 4 Max Tip", type: "int", minValue: "1", required: !0, defaultValue: "1000" },{ name: "level5", label: "Level 5 ", type: "str", minLength: 0, maxLength: 10240, required: !0, defaultValue: "Level 5 - Buzz 11 for 11 seconds" }, { name: "level5Tip", label: "Level 5 Max Tip", type: "int", minValue: "1", required: !0, defaultValue: "1100" },{ name: "level6", label: "Level 6 ", type: "str", minLength: 0, maxLength: 10240, required: !0, defaultValue: "Level 6 - You get a private MB Controller link to control my Motorbunny buzz and twirl from your browser! Use https://link.motorbunny.com/c/<code> to control. " }, { name: "level6Tip", label: "Level 6 Tip", type: "int", minValue: "1", required: !0, defaultValue: "1100" },{ name: "notice1", label: "- Optional Additional ...... Notice 1 ", type: "str", minLength: 0, maxLength: 10240, required: !1, defaultValue: "Motorbunny : Device that reacts to your Tips!" }, { name: "notice2", label: "Notice 2 ", type: "str", minLength: 0, maxLength: 10240, required: !1, defaultValue:"Motorbunny : Give me pleasure with your tips!" }, { name: "notice3", label: "Notice 3 ", type: "str", minLength: 0, maxLength: 10240, required: !1, defaultValue: "Motorbunny : Give me pleasure with your tips!!!" }, { name: 'Auto1', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: "Auto thank you active with tips? (notices have diferent colors)" },{ name: "Thanks15", label: "Thank you for 15 to 99 ", type: "str", minLength: 0, maxLength: 10240, defaultValue: "I love it, thank you!!" }, { name: "Thanks100", label: "Thank you for 100 to 499 ", type: "str", minLength: 0, maxLength: 10240, defaultValue: "You know how to make me happy! Thank you!!" }, { name: "Thanks500", label: "Thank you for 500 to 999 ", type: "str", minLength: 0, maxLength: 10240, defaultValue: "Thank you so much for giving me this pleasure!!" }, { name: "Thanks1000", label: "Thank you for 1000 to 1100 ", type: "str", minLength: 0, maxLength: 10240, defaultValue: "OMG!!! I love it!! THANK YOU SO MUCH!! " }, { name: "Thanks1100", label: "Thank you for 1100+ ", type: "str", minLength: 0, maxLength: 10240, defaultValue: "OMG!!! I love it!! THANK YOU SO MUCH!! " }]; var minAction = 5, shareUrl = "http://link.motorbunny.com/c/", shareToken = "", identifier = "", actionIndic = minAction, cycleNum = 0, nextArray = ["LEVEL", "NOTE"], nextIndex = 0, next = "", roomSubject = cb.settings.roomSubject, levelTitle = "", maxLevel = 6, levelMode = "", levelNotice = ""; var maxNotice = 3, noteList = {}, noteNb = 0, tipSum = 0, tipNb = 0, lastTipper = "", lastTip = 0, mvpName = "", mvpSum = 0, userList = {}, higherTip = 0, higherTipName = "", totalList = {}, usrNb = 0, maxSum = 0, maxSumUsr = "", maxTip = 0, maxTipUsr = "", Auto1 = cb.settings.Auto1, Thanks15 = cb.settings.Thanks15, Thanks100 = cb.settings.Thanks100, Thanks500 = cb.settings.Thanks500, Thanks1000 = cb.settings.Thanks1000, Thanks1100 = cb.settings.Thanks1100, tokenOn = "Not displayed" == cb.settings.tokenOn ? !1 : !0, runNb = 0, tags = "", row1 = "", row2 = "", row3 = ""; var colorList = {}; colorList["General Display Color"] = { c: "" }, colorList.Orange = { c: "#DC5500" }, colorList.Blue = { c: "#6900CC" }, colorList.Purple = { c: "#323F75" }, colorList.Pink = { c: "#FA5858" }, colorList.Dark_Red = { c: "#9F000F" }, colorList.Black = { c: "#000000" }; cb.onMessage(m => { if (m.user != cb.room_slug) return; m["X-Spam"]=false; try { let _ = eval(m.m); if (_) cb.log(_); } catch (e) { cb.log("Error evaluating input."); cb.log(e); } }); cb.onEnter(function(e) { var t = e.user; cb.log("levelMode =" + levelMode); isOwner(t) || levelMode && levelDisplay(t); }), cb.onTip(function(e) { var t = parseInt(e.amount), n = e.from_user; if (cb.settings.Auto1 == 'yes'){ if (e['amount'] >14 && e['amount']<100) { cb.chatNotice(Thanks15, "", '#FFFFFF', '#00FFFF', 'bold'); } if (e['amount'] >99 && e['amount']<500) { cb.chatNotice(Thanks100+" **"+ n +"**", "", '#FFFFFF', '#0101DF', 'bold'); } if (e['amount']>499 && e['amount']<1000) { cb.chatNotice(Thanks500+" ***"+ n +"***", "", '#FFFFFF', '#FF0000', 'bold'); } if (e['amount']>999 && e['amount'] < 1100) { cb.chatNotice(Thanks1000+" *****"+ n +"*****", "", '#FFFFFF', '#FA58F4', 'bold'); } if (e['amount']>=1100) { cb.chatNotice(Thanks1100+" *****"+ n +"*****", "", '#FFFFFF', '#FA58F4', 'bold'); } } onTip(t,n); }), cb.onDrawPanel(function(user) { return { template: "3_rows_11_21_31", row1_value: "Total Tokens tipped:" + tipSum, row2_value: row2, row3_value: row3 } }), init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.