Bots Home
|
Create an App
December lily bot 2
Author:
polymathcs
Description
Source Code
Launch Bot
Current Users
Created by:
Polymathcs
/** * This is a bot made for Lily for december for the things she has planned * */ //var var NNstnadings = 0; var mostNughtyVotes = 0; var mostNiceVotes = 0; var naughtyTA = 0; var niceTA = 0; var naughtyV = 0; var niceV = 0; var naughtyMsg = ''; var niceMsg = ''; var naughtyTVA = 0; var niceTVA = 0; var totalNNPurchases = 0; var rafSub = ''; var rafPrz = ''; var rafWarn = ''; var rafTicket1 = 0; var rafTicket6 = 0; var rafTicket13 = 0; var rafPurch = []; var rafTotalTickets = 0; var rafList = []; var meanestPerson = ''; var nicestPerson = ''; var NNList = []; var noCountList = ''; var noCountUsers = []; var msgArray = []; var NNTippers = []; var NNTippersNice = []; var NNTippersNaughty = []; var rafTicketNum = 0; var haveRafTickets = []; var userArrayNum = 0; var tempUserArrayNum = 0; var NNUserArrayLocation = 0; var NNObject = []; var printList = ''; //people whose tips don't count var noCount = []; //settings cb.settings_choices = [ { label: 'Naugthy Tip Ammount', name: 'naughtyTipAmmount', type: 'int', required: true, default: 26, minValue: 1 }, { label: 'Nice Tip Ammount', name: 'niceTipAmount', type: 'int', required: true, default: 27, minValue: 2 }, { label: 'Naughty Votes', name: 'NaughtyVotes', type: 'int', default: 0 }, { label: 'Nice Votes', name: 'niceVotes', type: 'int', default: 0 }, { label: 'Naughty Message', name: 'naughtyMessage', type: 'str', default: 'You think that I am a Naughty' }, { label: 'Nice Message', name: 'niceMessage', type: 'str', default: 'I am an angel sent from heaven' }, { label: 'How many votes does each tip cast?', name: 'naughtyVotesPerTip', type: 'int', default: 3 }, { label: 'How many votes does each tip cast?', name: 'niceVotesPerTip', type: 'int', default: 3 }, //raffle area { label: 'Raffle subject', name: 'raffleSub', type: 'str', default: 'A Christmas Raffle where 3 prizes are available. Only one prize per person so one person can\'t win all 3' }, { label: 'Raffle Prizes', name: 'rafflePrizes', type: 'str', default: 'Candy, panties, and private' }, { label: 'Raffle Warning', name: 'raffleWarn', type: 'str', default: 'Only tips at the exact ammount will count towards raffle tickets. Tipping more then that stated amount will result in no raffle tickets. Prizes may be chnaged by the Broadcaster prior to the drawing of the winner or winners. If shipping is more than $50 US dollars the rest may be asked to be paid for by the winner shipping will be done by standard mail systems. a tracking Identification may be provided after the prize has been shipped. the shipper is not responsible for any tazes or VAT that may be add by the recieving country. the shipper is not responsible if the parcel is lost or damaged.' }, { label: '1 Raffle ticket costs', name: 'raffleTicket1', type: 'int', default: 98 }, { label: '6 raffle tickets cost', name: 'raffleTickets6', type: 'int', default: 499 }, { label: '13 raffle tickets cost', name: 'raffleTickets13', type: 'int', default: 999 }, { label: 'What is the starting number for the raffle tickets?', name: 'rafTicketNumber', type: 'int', default: 0000 }, { label: 'Users that you dont want tips to count for any of these offerings put user names in with a space between them', name: 'doesNotCount', type: 'str', default: 'downspout76' } ]; cb.onTip(function (tip) { var tipAmount = parseInt(tip['amount']); var pretUser = tip['from_user']; var tFanClub = tip['from_user_in_fanclub']; var tGender = tip['user_gender']; var tUser = pretUser.toLowerCase(); switch (tipAmount) { case 26: //naughty tip if (addNaughtyVote(tUser)) { cb.sendNotice(naughtyMsg,'','#800000','#FFFFFF','bold',''); } else { cb.sendNotice('********** ERROR ************ \nThe last vote was not counted from ' + tUser,cb.room_slug,'#FF0000','#FFFFFF','bold','red'); } break; case 27: //Nice tip if (addNiceVote(tUser)) { cb.sendNotice(niceMsg,'','#1bb834','#FFFFFF','bold',''); } else { cb.sendNotice('********** ERROR ************ \nThe last vote was not counted from ' + tUser,cb.room_slug,'#FF0000','#FFFFFF','bold','red'); } break; case rafTicket1: var m = ticketsBought(tUser,1); cb.sendNotice(m,'','','','',''); break; case rafTicket6: var m1 = ticketsBought(tUser,6); cb.sendNotice(m1,'','','','',''); break; case rafTicket13: var m2 = ticketsBought(tUser,13); cb.sendNotice(m2,'','','','',''); break; default: break; } }); cb.onMessage(function (msg) { //when ever someone messages var msgUser = msg['user']; var msgMsg = msg['m']; var msgMod = (cb.room_slug === msg['user'] || msg['is_mod']); msgArray = msgMsg.split(' '); var msgCommand = msgArray[0]; if (msgMsg.startsWith('/')) { msg['x-Spam'] = true; //if (!doICount(msgUser)) { if (msgMod) { switch (msgCommand) { case '/addNoCount': var userToBeSilenced = msgArray[1]; addNoCount(userToBeSilenced, msgUser); cb.sendNotice('the User ' + userToBeSilenced + ' has been added to the No Count list',msgUser,'#FFC0CB','','bold',''); break; case '/showNoCount': showNoCount(msgUser); break; case '/niceLevel': niceLevel(); break; case '/badLevel': badLevel(); break; case '/lead': whoLeads(); break; case 'printNN': votesPrint(); break; case '/userStats': userStats(msgArray[1]); break; case '/rs': raffleSubNoice(); break; case '/rp': rafflePrizeNotice(); break; case '/rw': raffleWarningNotice(); break; case '/rafList': raffleList(msgUser); break; case '/rafObj': raffleObject(msgUser); break; } } else { cb.sendNotice("Sorry your not allowed to do that",msgUser,'#FF0000','','bold',''); return msg; } //} } }); function doICount(user) { //this is for anyone that you may not want to count for raffle or votes cbjs.arrayContains(noCountUsers, user); //return array.contains(noCountUsers, user); } function addNoCount(user, mod) { //this is to add people to the no count list noCountUsers.push(user); return true; } function createNoCount(noCountList2) { cb.sendNotice('The no Count list has ' + noCountList2 + ' users.','','','','',''); if (noCountList2 === 'undefined') { noCountUsers[0] = 'blank'; cb.sendNotice('i hate undefined','','','','',''); } else { //noCountUsers = noCountList2.split(' '); cb.sendNotice('The no Count list has ' + noCountUsers.length + ' users.','','','','',''); } } function showNoCount(user) { //to show who is on no count list var i = 0; while(noCountUsers[i]) { printlist = printList + ' ' + noCountUsers[i] + '\n'; cb.sendNotice(noCountUsers[i] + ' here is printList ' + printlist,'','','','',''); i++; } cb.sendNotice('here are the people that are on the No Count list \n' + printList + ' ',user,'','','',''); } function isUserInNNTippersNaughty(user) { return cbjs.arrayContains(NNTippers, user); } function isUserInNNTippersNice(user) { return cbjs.arrayContains(NNTippersNice, user); } function addNaughtyVote(user) { var totalVotes = 0; if (!doICount(user)) { if (isUserInNNTippersNaughty(user)) { totalVotes = (naughtyTVA); tempUserArrayNum = (NNTippers.indexOf(user) - 1); cb.sendNotice(user + 'casted ' + totalVotes + ' votes for naughty','','','','',''); NNList.push(user + 'casted ' + totalVotes + ' votes for naughty'); naughtyV += (totalVotes); totalNNPurchases += (totalVotes); var currentAmountVotes = NNList[tempUserArrayNum].NNUNaug; if (user === meanestPerson) { mostNughtyVotes += totalVotes; NNList[tempUserArrayNum].NNUNaug = (currentAmountVotes + totalVotes); } else { NNList[tempUserArrayNum].NNUNaug = (currentAmountVotes + totalVotes); var tempCheck = (NNList[tempUserArrayNum].NNUNaug); if (tempCheck > mostNughtyVotes) { mostNughtyVotes = tempCheck; meanestPerson = user; cb.sendNotice('We have a new meanest person ' + meanestPerson + '!','','','','',''); } else { var difference = (mostNughtyVotes - tempCheck); cb.sendNotice('You are ' + difference + ' behind the Meanest person'); } } return true; } else { cb.sendNotice('The first time someone tipped for naughty or nice','','','','',''); if (cbjs.arrayContains(NNTippers,user)) { NNTippersNaughty.push(user); } else { NNTippers.push(user); NNList.push(createNNUser(user,totalVotes,0,totalVotes)); NNTippersNaughty.push(user); } totalVotes = (naughtyTVA); totalNNPurchases += (totalVotes); cb.sendNotice(user + 'casted ' + totalVotes + ' votes for naughty', '', '', '', '', ''); NNList.push(user + 'casted ' + totalVotes + ' votes for naughty'); NNUserArrayLocation = (NNTippers.length - 1); //cb.sendNotice(NNObject[NNUserArrayLocation].NNUser + ' has ' + NNObject[NNUserArrayLocation].NNNumvotes + ' votes total.','','','','bold',''); naughtyV += totalVotes; if (NNTippersNaughty.length === 1) { mostNughtyVotes = totalVotes; meanestPerson = user; //NNObject[NNUserArrayLocation].NNUHNaughKing = true; } else { cb.sendNotice('oh shit something went wrong','','#FF0000','','bold','') } return true; } } else { cb.sendNotice('*' + naughtyMsg + '*','','#FFC0CB','#000000','bold',''); return true; } } function addNiceVote(user, vote) { var totalvotes = 0; if (!doICount(user)) { if (isUserInNNTippersNice(user)) { totalvotes = (1 * niceTVA); tempUserArrayNum = (NNTippers.indexOf(user) - 1); var currentAmountvotes = NNList[tempUserArrayNum].NNUNice; cb.sendNotice(user + 'casted ' + totalvotes + ' votes for nice','','','','',''); NNList.push(user + 'casted ' + totalvotes + ' votes for nice'); niceV += (totalvotes); totalNNPurchases += totalvotes; if (user === nicestPerson) { mostNiceVotes += totalvotes; NNList[tempUserArrayNum].NNUNice = (currentAmountvotes + totalvotes); } else { NNList[tempUserArrayNum].NNUNice += totalvotes; var tempCHeck = NNList[tempUserArrayNum].NNUNice; if (tempCHeck > mostNiceVotes) { mostNiceVotes = tempCHeck; nicestPerson = user; cb.sendNotice('We have a new nicest person ' + nicestPerson + '!','','','','',''); } else { var differene = (mostNiceVotes - tempCHeck); cb.sendNotice('You are ' + differene + ' behind the Nicest person',user,'','','bold',''); } } return true; } else { cb.sendNotice('The first time someone tipped for nice','','','','',''); totalvotes = (niceTVA); if (cbjs.arrayContains(NNTippers, user)) { NNTippersNice.push(user); tempUserArrayNum = (NNTippers.indexOf(user) - 1); NNList[tempUserArrayNum].NNUNice += totalvotes; } else { NNTippers.push(user); NNTippersNice.push(user); NNList.push(createNNUser(user, totalvotes, totalvotes,(0))); } NNUserArrayLocation = (NNTippers.length - 1); totalNNPurchases += totalvotes; cb.sendNotice(user + 'casted ' + totalvotes + ' votes for nice', '', '', '', '', ''); NNList.push(user + 'casted ' + totalvotes + ' votes for nice'); niceV += (totalvotes); if (NNTippersNice.length === 1) { mostNiceVotes = totalvotes; nicestPerson = user; } else { cb.sendNotice('oh shit something went wrong','','#FF0000','','bold','') } return true; } } else { cb.sendNotice('*' + niceMsg + '*','','#FFC0CB','#000000','bold',''); return true; } } function createNNUser(user,totalvotes,nicevotes,naughtyvotes) { cb.sendNotice('Made it to create NN User ','','','','',''); var tmpUser = (typeof user === 'undefined') ? '' : user; var tmpTV = (typeof totalvotes === 'undefined') ? '' : totalvotes; var tmpNiceV = (typeof nicevotes === 'undefined') ? '' : nicevotes; var tmpNaugV = (typeof naughtyvotes === 'undefined') ? '' : naughtyvotes; var tmp1 = { NNUser: tmpUser, NNNumvotes: tmpTV, NNUNice: tmpNiceV, NNUNaug: tmpNaugV, NNUHNiceKing: false, NNUHNaughKing: false }; cb.sendNotice('This ' + tmp1.NNUser + ' User was just add','','','','',''); return tmp1; } function whoLeads() { var winner = naughtyV > niceV ? "Naughty is in the lead" : 'Nice is in the Lead'; cb.sendNotice(winner,'','#0000FF','#FFFFFF','bold',''); } function votesPrint() { var print = ''; print += 'Total Nice votes ' + niceV + '!\n' + 'Total Naughty votes ' + naughtyV + '!\n' + 'Total Votes ' + totalNNPurchases + '! (that should be correct)'; cb.sendNotice(print,'','','','','') } function niceLevel() { cb.sendNotice('Total Nice Tips ' + niceV + ' the nicest person is ' + nicestPerson + '.','','','','',''); } function badLevel() { cb.sendNotice('Total Naughty Tips ' + naughtyV + ' the meanist person is ' + meanestPerson + '.','','','','',''); } function userStats(user) { var userarraylocation = 0; userarraylocation = (NNTippers.indexOf(user) - 1); var print = NNObject[userarraylocation].NNUser + ' total votes ' + NNObject[userarraylocation].NNNumvotes + ' number of nice votes ' + NNObject[userarraylocation].NNUNice + ' number of naughty votes ' + NNObject[userarraylocation].NNUNaug; cb.sendNotice(print,user,'','','bold','red'); } //Raffle section. function ticketsBought(user,numTicket) { var msg = (user + ' has purchased '); var storeRafNumbers = ''; //has the user tipped for raffle tickets before if (cb.arrayContains(haveRafTickets)) { var userlocate = haveRafTickets.indexOf(user); rafList[userlocate].howManyTickets += numTicket; for (var j = 0;j<numTicket;j++) { rafPurch.push(user + ' ' + rafTicketNum + ' ** '); msg += (rafTicketNum + ', '); storeRafNumbers = (storeRafNumbers + rafTicketNum.toString() + ', '); rafTicketNum++; } rafList[userlocate].raffleTicketNumbers += storeRafNumbers; rafTotalTickets += numTicket; } else { //this is for the first time purchase and to create the object of userraffle for (var k = 0;k<numTicket;k++) { rafPurch.push(user + ' ' + rafTicketNum + ' ** '); msg += (rafTicketNum + ', '); storeRafNumbers = (storeRafNumbers + rafTicketNum.toString() + ', '); rafTicketNum++; } rafTotalTickets += numTicket; haveRafTickets.push(user); userArrayNum = (haveRafTickets.length - 1); var raffleUser = { username: user, userArrayLocation: userArrayNum, howManyTickets: numTicket, raffleTicketNumbers: storeRafNumbers }; cb.sendNotice('this is after create raffle user', '','','','',''); rafList.push(raffleUser); sendNotice('The user was added to raffle list at ' + (rafList.length - 1) + ' position.','','','','',''); } msg += 'tickets.'; return msg; } function raffleSubNoice() { cb.sendNotice(rafSub,'','','','',''); } function rafflePrizeNotice() { cb.sendNotice(rafPrz,'','','','',''); } function raffleWarningNotice() { cb.sendNotice(rafWarn,'','','','',''); } function raffleList(user) { cb.sendNotice(rafList,user,'','','',''); } function raffleObject(user) { var print = ''; for (var l = 0;l<haveRafTickets.length;l++) { print = rafList[l].username + ' ' + rafList[l].userArrayLocation + ' ' + rafList[l].howManyTickets + ' ' + rafList[l].raffleTicketNumbers + '\n'; cb.sendNotice(print,'user','','','',''); } } function init() { // if(cb.room_slug !== 'x_lily_x' || 'polymathcs') { // cb.settings_choices = [ // {name: 'sorry', // label: 'This bit is meant for one model sry for the inconvenience.', // type: 'int', // default: 0} // ]; // } else { /* var rafPurch = {}; var rafTotalTickets = 0; var rafList = []; var totalNNPurchases = 0; var meanestPerson = ''; var nicestPerson = ''; var NNList = {}; */ cb.sendNotice("The December Bot for Lily",cb.room_slug,'','','bold',''); naughtyTA = cb.settings.naughtyTipAmount; niceTA = cb.settings.niceTipAmount; naughtyV = cb.settings.naughtyVotes; niceV = cb.settings.niceVotes; naughtyMsg = cb.settings.naughtyMessage; niceMsg = cb.settings.niceMessage; naughtyTVA = cb.settings.naughtyVotesPerTip; //The number of votes each tip casts niceTVA = cb.settings.niceVotesPerTip; //The number of votes each tip casts noCountList = cb.settings.doesNotCount; createNoCount(noCountList); //raffle section rafSub = cb.settings.raffleSub; rafPrz = cb.settings.rafflePrizes; rafWarn = cb.settings.raffleWarn; rafTicket1 = cb.settings.raffleTicket1; rafTicket6 = cb.settings.raffleTickets6; rafTicket13 = cb.settings.raffleTicket13; rafTicketNum = cb.settings.rafTicketNumber; // } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.