Bots Home
|
Create an App
SophiaTrip
Author:
erik91383
Description
Source Code
Launch Bot
Current Users
Created by:
Erik91383
var donators = new Array; var don1 = cb.settings.donate1, don2 = cb.settings.donate2, don3 = cb.settings.donate3, don4 = cb.settings.donate4; runningTotal = cb.settings.previous var bcp = {aqua: "#00FFFF",black: "#000000",blue: "#0000FF",fuchsia: "#FF00FF",gray: "#808080",grey: "#808080",green: "#008000",lime: "#00FF00",maroon: "#800000",navy: "#000080",olive: "#808000",orange: "#FFA500",purple: "#800080",red: "#FF0000",silver: "#C0C0C0",teal: "#008080",white: "#FFFFFF",yellow: "#FFFF00" }; cb.settings_choices = [ {name: 'donate1', type: 'int',required:true, label: 'Special tip 1',defaultValue: 34}, {name: 'donate2', type: 'int',required:false, label: 'Special tip 2 (Leave at 0 if not Used)',defaultValue: 343}, {name: 'donate3', type: 'int',required:false, label: 'Special tip 3 (Leave at 0 if not Used)',defaultValue: 3443}, {name: 'donate4', type: 'int',required:false, label: 'Special Tip 4 (Leave at 0 if not Used)',defaultValue: 4334}, {name: 'goal', type: 'int',required:true, label: "(Goal? This won't be shown to anyone)",defaultValue: 250000}, {name: 'previous', type: 'int',required:true, label: "Previous donation total (Needed for accuracy)",defaultValue: 0}, {name: 'moveDate', type: 'str',required:false, label: 'Move date - YYYY-MM-DD? (Not required but helpful)',defaultValue: '2018-01-01'}, ]; cb.onTip(function(tip){ var grossTip = parseInt(tip['amount']) var tipped = tip['from_user'] if(grossTip == don1 || grossTip == don2 || grossTip == don3 || grossTip == don4){ tipperArray(tipped,grossTip) runningTotal += grossTip } if(runningTotal >= cb.settings.goal){ cb.chatNotice("THANK YOU ALL!!!! I have reached my goal to move. You are all so AMAZING! Thank you so much for helping make this wish come true! :celebrate-js",'','',bcp.green,"bold") } }); cb.onMessage(function(msg){ if(msg['m'].substring(0,1)=='/'){ msg['X-Spam']=true; var user = msg['user'] var words = msg['m'].split(" ") if(msg['is_mod'] || user == cb.room_slug){ if(words[0] == '/donators'){ var list = '' for(var i=0;i<donators.length;i++){ list += "User: " + donators[i].user + " Total Donations: " + donators[i].amount + " Tips of " + don1 + ": " + donators[i].tip1 + " Tips of " + don2 + ": " + donators[i].tip2 + " Tips of " + don3 + ": " + donators[i].tip3 + " Tips of " + don4 + ": " + donators[i].tip4 +'\n' } cb.chatNotice(list + "Daily total to be used in the previous total box next time: " + runningTotal,user) } } if(words[0] == '/howto'){ var daysLeft = Math.floor(((new Date(cb.settings.moveDate).getTime())-(new Date().getTime()))/(1000*60*60*24)); cb.chatNotice("Thank you for having an interest in helping me experience life in a new place. I wish to move somewhere new for a short period and your support will help make this happen! By making donations of " + don1 + (don4==0&&don3==0&&don2==0?" ":(don4==0&&don3==0?" or " + don2+" ":", "+don2+(don4==0?", or "+don3+" ":", " + don3+", or "+don4))) + " you will be contibuting to making my desire come true. I am " + (runningTotal!=0?(((runningTotal/cb.settings.goal)*100).toFixed(2)):'0') + "% to my goal" + (isNaN(daysLeft)?".":" and have " + daysLeft + " days until I plan to leave.") + " I hope so much to see this come true :kiss",user,'',bcp.purple,"bold") if(msg['is_mod'] || user == cb.room_slug){ cb.chatNotice("To see the current list of tippers and their donation totals type /donators in the chat",user,'',bcp.red,'bold') } } } }); function tipperArray(user,amount){ var i = findUser(user,donators) if(i < 0){ donators.push({user: user,amount: amount,tip1: 0,tip2: 0,tip3: 0,tip4: 0}) } else{ donators[i].amount += amount } i = findUser(user,donators) if(amount == don1){donators[i].tip1++} else if(amount == don2){donators[i].tip2++} else if(amount == don3){donators[i].tip3++} else if(amount == don4){donators[i].tip4++} thanks(user) }; function findUser(user,arry){ var index = -1 for(var i=0;i<arry.length;i++){ if(arry[i].user === user){ index = i break; } } return index }; function thanks(user){ cb.chatNotice("THANK YOU! for donating to my moving fund. It means so much to me that you are helping. :kiss4u",user,'',bcp.purple,'bold') }; function notifier(){ cb.chatNotice("I've started a fund to help with moving to a new place for a short period. If you would like to help, type /howto in the chat to learn a little more.",'','',bcp.blue,'bold') }; function init(){ cb.setTimeout(notifier,600000) }; init()
© Copyright Chaturbate 2011- 2025. All Rights Reserved.