Bots Home
|
Create an App
testtipnote
Author:
staringatstars
Description
Source Code
Launch Bot
Current Users
Created by:
Staringatstars
cb.settings_choices = [ {name: 'tipMsgOn', type: 'choice', choice1: 'on', choice2: 'off', defaultValue: 'off', label: "---------------------------------TIP_MSG_CONTROLS---------------------------------- ------------------------------------------------------------------------------------------------- Tip msg's on"}, {name:'tipMsgTextcolour', type:'str', label:'Tip msg text color (html code)', required: false}, {name:'tipMsgNoticecolour', type:'str', required: false, label:'Tip msg background color (html code)'}, {name:'tipMsg', type:'str', required: false, label:'Messages or Gifs to be displayed on tip, followed by the min amount to display that msg, seperated by commas, groups seperated by / eg: Thank you,25/:gif,50 - would display the msg Thank you when tipped 25-49 and :gif when tipped 50 or more, you can enter as many groups as you want',}, ]; var tmo = ''; var tipMsgs = []; function errorMsg (msg) { cb.sendNotice(msg); } function addtipMsgsnotice (notice,tip) { tipMsgs.push([notice,tip]); } // grab settings tmo = cb.settings['tipMsgOn']; if (cb.settings.tipMsg) { var tempList = cb.settings.tipMsg.split('/'); for (var i = 0; i < tempList.length; i++) { var tempList2 = tempList[i].split(',') if (tempList2.length < 2) { errorMsg(("list too short, you need to check your tip msg settings, tip msg's are now off " + String(tempList2.length) + ' ' + tempList2)); tmo = 'off'; break; } if (tempList2.length > 2) { errorMsg(("list too long, you need to check your tip msg settings, tip msg's are now off " + String(i) + String(tempList2.length) + ' ' + tempList2)); tmo = 'off'; break; } var a = tempList2[0]; var b = tempList2[1]; addtipMsgsnotice(a,b); } tipMsgs.sort(function(a, b) { var x = a[1]; var y = b[1]; return x - y; }); } function getTipMsg(tip) { for (var i = 0; i < tipMsgs.length; i++) { if (parseInt(tipMsgs[i][1]) <= parseInt(tip)) { if (i+1 == tipMsgs.length) { return tipMsgs[i][0]; } if (parseInt(tipMsgs[i+1][1]) > parseInt(tip)) { return tipMsgs[i][0]; } } } return 'na'; } cb.onTip(function (tip) { var a = getTipMsg(tip['amount']); if (a != 'na') { cb.chatNotice(a,'',cb.settings['tipMsgNoticecolour'],cb.settings['tipMsgTextcolour'],'bold'); } });
© Copyright Chaturbate 2011- 2024. All Rights Reserved.