Bots Home
|
Create an App
sparta
Author:
ayot3chsdad
Description
Source Code
Launch Bot
Current Users
Created by:
Ayot3chsdad
/****************************** * TITLE: ThisIsSparta * AUTHOR: Chivalrous_Mike * VERSION: 1.0 * DATE: 2015-07-03 * DESCRIPTION: Displays Spartan and King Avatars before messages if the user has * attained that status. * Made for Nicole ----> https://chaturbate.com/littlenicole/ */ var king = ""; var spartans = []; var n=1; /****************************** * Setup Bot Choices *******************************/ cb.settings_choices = [ { name: 'BotLabel', type: 'str', minLength: 1, maxLength: 100, label: "Bot Name", defaultValue: 'This is Sparta!', required: false}, { name: 'ShowQueen', type: 'choice', label: 'Display Queens Crown', choice1: 'yes', choice2: 'no', defaultValue: 'yes'}, { name: 'King', type: 'str', minLength: 0, maxLength: 50, label: "King Leonidas", defaultValue: '', required: false}, { name: 'King_Tip', label: "Reigning High Tip", minValue: 1, required: false, type: "int", default: 1}, { name: 'Spartans', type: 'str', minLength: 0, maxLength: 1000, label: "Spartans (comma separated)", defaultValue: '', required: false}, { name: 'SpartanAvatar', type: 'choice', label: 'Select Spartan Avatar', choice1: ':av_sparta1 ', choice2: ':av_sparta2 ', choice3: ':av_sparta3 ', defaultValue: ':av_sparta1 '}, { name: 'notify_time', type:'int', minValue: 1, maxValue: 999, defaultValue: 5, label: 'Delay in minutes between notices being displayed (minimum 1)'}, { name:'msg1', type:'str', required: false, label:'Notice 1',}, { name:'msg2', type:'str', required: false, label:'Notice 2',}, { name:'msg3', type:'str', required: false, label:'Notice 3',}, { name:'msg4', type:'str', required: false, label:'Notice 4',}, { name:'msg5', type:'str', required: false, label:'Notice 5',}, {name: 'display_notice', type:'int', minValue: 1, maxValue: 60, defaultValue: 5, label: 'Delay in minutes between notices'} ]; function displayNotice() { var msg; while (cb.settings['msg' + n] == 0) { //skip empty messages n++; if (n > 5) { //loop back to first message n=1; } } msg = cb.settings['msg' + n]; n++; if (n > 5) { //loop back to first message n=1; } cb.sendNotice(msg,'', '', '#000000','bold'); cb.setTimeout(displayNotice, (cb.settings.display_notice * 60000)); } cb.setTimeout(displayNotice, (cb.settings.display_notice * 60000)); var totalTipped = 0; cb.onTip(function (tip) { var tipAmount = parseInt(tip['amount']); var name = tip['from_user']; var modelName = cb.room_slug; msgModel = "" msgPublic = "" switch(tipAmount) { case 300: var alreadyspartan = spartans.indexOf(name); if (alreadyspartan != -1) { msgPublic = name + ' is already one of Nicoles Spartans... Thanks for the tip!'; } else { spartans.push(name); msgPublic = name + ' is now one of Nicoles Spartans... Welcome to Sparta!'; msgModel = modelName + ', don\'t forget to add ' + name + ' to Spartans in the bot config!'; } } if (tipAmount > king_tip){ cb.settings.King = name; king = cb.settings.King ? cb.settings.King.split(',') : new Array(); king_tip = tipAmount + 1; msgPublic = name + ' is the new :av_leonidas reigning King Leonidas!'; msgModel = modelName + ', don\'t forget to change ' + name + ' to King Leonidas in the bot config!'; } // Output any public notices or command results if (msgPublic.length > 0) { cb.sendNotice(msgPublic, '', '','#18453B','bold'); msgPublic = ""; } // Output any messages to the model if (msgModel.length > 0) { cb.sendNotice(msgModel, modelName, '','#18453B','bold'); msgModel = ""; } }); function NotifyMsg() { var msg1 = "--------- Tip 300 tokens to become one of Nicoles Spartans ---------" var msg2 = "Tip " + king_tip + "(single tip) to replace :av_leonidas " + king + " as reigning King Leonidas!"; cb.sendNotice(msg1,'','','#18453B','bold'); cb.sendNotice(msg2,'','','#18453B',''); cb.setTimeout(NotifyMsg, (cb.settings.notify_time * 60000)); } cb.setTimeout(NotifyMsg, (cb.settings.notify_time * 60000)); cb.onMessage(function (msg) { var message = msg['m']; var user = msg['user']; var isQueen = false; var isKing = false; var isSpartan = false; var name = cb.room_slug; if (name == user.toLowerCase()) { isQueen = true; } for (var i = 0; i < king.length; i++) { var name = king[i].toLowerCase(); if (name == user.toLowerCase()) { isKing = true; break; } } for (var i = 0; i < spartans.length; i++) { var name = spartans[i].toLowerCase(); if (name == user.toLowerCase()) { isSpartan = true; break; } } if (isQueen) { if (cb.settings.ShowQueen == 'yes') message = ":av_queennic " + message; } else if (isKing) { message = ":av_leonidas " + message; } else if (isSpartan) { message = cb.settings.SpartanAvatar + message; } msg['m'] = message; return msg; }); // Initialize Application function init() { var title = "---------------------------------------------\n--- " + cb.settings.BotLabel + " - Made for Nicole ---\n---------------------------------------------"; cb.sendNotice(title, '', '','#18453B','bold'); //var temp; //var emote = ''; king = cb.settings.King ? cb.settings.King.split(',') : new Array(); king_tip = cb.settings.King_Tip + 1; spartans = cb.settings.Spartans ? cb.settings.Spartans.split(',') : new Array(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.