Bots Home
|
Create an App
moomoo
Author:
evilmoomoo
Description
Source Code
Launch Bot
Current Users
Created by:
Evilmoomoo
/** Name: Natys Castle **/ cb.settings_choices = [ {name: 'PrinceMinTip', label: 'Minimum tip to become prince', type: 'int', minValue: 1, defaultValue: 1000}, {name: 'KingMinTip', label: 'Minimum tip to become king', type: 'int', minValue: 1, defaultValue: 3000}, {name: 'PrinceMemberList', label: 'List of current princes, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'KingMemberList', label: 'List of current kings, separated by commas (and they need to be the CB username exactly)', type: 'str', minLength: 0, maxLength: 10240, required: false, defaultValue: ''}, {name: 'PrinceText', label: 'Text to put in front of messages (e.g. :<icon_name>)', type: 'str', minLength: 0, maxLength: 30, required: false, defaultValue:':crownSmall'}, {name: 'KingText', label: 'Text to put in front of messages (e.g. :<icon_name>)', type: 'str', minLength: 0, maxLength: 30, required: false, defaultValue:':crown10'}, ]; var PrinceMemberList = {}; var KingMemberList = {}; var KingNotice = "Tip " + cb.settings.PrinceMinTip + " to become a Prince! Or tip " + cb.settings.KingMinTip + " to become King!"; function showKingNotice() { cb.chatNotice(KingNotice, "", "", '#FF000', '#000000', "", ""); cb.setTimeout(showKingNotice, 900000); }; cb.onEnter( ); cb.onMessage(function (msg) { var user = msg['user']; if (isKing(user)) { msg['m'] = cb.settings.KingText + " " + msg['m']; } else if (isPrince(user)) { msg['m'] = cb.settings.PrinceText + " " + msg['m']; } return msg; }); cb.onTip(function (tip) { var amountTipped = parseInt(tip['amount']); if (amountTipped >= cb.settings.KingMinTip && !isKing(tip['from_user'])) { var announcement = tip['from_user'] + " is now a King"; makeKing(tip['from_user']); cb.chatNotice(announcement); } else if (amountTipped >= cb.settings.PrinceMinTip && amountTipped < cb.settings.KingMinTip && !isPrince(tip['from_user']) && !isKing(tip['from_user'])) { var announcement = tip['from_user'] + " is now a Prince"; makePrince(tip['from_user']); cb.chatNotice(announcement); } }); function isKing(username) { return (username in KingMemberList); } function isPrince(username) { return (username in PrinceMemberList); } function makeKing(username) { KingMemberList[username] = {'u': 1}; } function makePrince(username) { PrinceMemberList[username] = {'u': 1}; } function grabSettings() { cb.log("starting grabbing settings"); if (cb.settings.KingMemberList) { var tabKingMemberSetting = cb.settings.KingMemberList.split(','); for(var i = 0 ; i < tabKingMemberSetting.length ; i++) { var clean = tabKingMemberSetting[i].toLowerCase().replace(/ /g, ""); makeKing(clean); } } if (cb.settings.PrinceMemberList) { var tabPrinceMemberSetting = cb.settings.PrinceMemberList.split(','); for(var i = 0 ; i < tabPrinceMemberSetting.length ; i++) { var clean = tabPrinceMemberSetting[i].toLowerCase().replace(/ /g, ""); makePrince(clean); } } cb.log("finished grabbing settings"); } grabSettings(); showKingNotice(); /** **/
© Copyright Chaturbate 2011- 2024. All Rights Reserved.