MissLayla_ Lovers
Author: layladolce
Description Source Code Launch Bot Current Users

Short Description:

MissLayla_ Lovers

Full Description

// Cb settings
//
// loverTip : Amount to Tip to become a lover - Default : 11.
// tipMode' : The Tip must be "Exact" , or "Equal or more".
// noticeTime : Number of minutes between BOT notifications - 1 to 10 Default : 3).
// messColor : Notices Color (No #. Default : Cb Orange DC5500).
// permanentString : Permanent Lovers
//

cb.settings_choices = [

{name: 'loverTip',
label: 'Tip to become a Lover ',
type: 'int',
minValue: 1,
defaultValue: 11
},
{name: 'tipMode',
label: 'The Tip must be ',
type: 'choice', choice1: 'Equal or more',
choice2: 'Exact',
defaultValue: 'Equal or more'
},
{name: 'noticeTime',
label: 'Minute(s) between Notices ',
type: 'int',
minValue: 1,
maxValue: 10,
defaultValue: 3
},
{name: 'messColor',
label: 'You can change Notices color (Default : Orange - DC5500) ' ,
type: 'str',
minLength: 6,
maxLength: 6,
defaultValue: 'DC5500'
},
{name: 'permanentString',
label: 'Permanent Lovers, if any, separated by space',
type: 'str',
minLength: 0,
maxLength: 10240,
required: false
},
];


// Variables
//
// tipMode : Tip mode choosen by the broadcaster : 1 "Equal or more", 2 "Exact"
// messColor : Notices color
// actionIndic : To stop Bot notifications if no action (message or Tip)
// loversList : List of Lovers of the day
// permanentList : List of Permanent Lovers
// permNb : Number of Permanent Lovers
// botNotice : BOT Notification regularly sent to the room

var tipMode = 0;
var messColor = '#' + cb.settings.messColor;
var actionIndic = 0;
var loversList = {};
var permanentList = {};
var permNb = 0;
var botNotice = "\n Tip " + cb.settings.loverTip + " to make your heart :qq_beatingheart beat for me and become my Lover Of The Day. \n" ;

//
// Init :
// Initialize list of Lover and list of Permanent Lovers
// Welcome the broadcaster, and remind her/his parameters.
// First call to the Bot notification function.
//

function init()
{
switch (cb.settings.tipMode) {

case "Equal or more" :
var mess = "OR MORE";
tipMode = 1 ;
break;

case "Exact" :
var mess="EXACTLY";
tipMode = 2 ;
break;
}
cb.sendNotice( "\nHi " + cb.room_slug + " :qq_beatingheart , LoverOfTheDay is running : \n \n - Lover TIP : " + cb.settings.loverTip + " Tokens " + mess + " in one Tip. " , cb.room_slug ,'','#000000', 'bolder');

if (cb.settings.permanentString) {
loversListPopulate();
}

if (permNb == 0) {
cb.sendNotice (" - No Permanent Lover" , cb.room_slug, '', '#000000', 'bolder' );
}

cb.sendNotice("\n Thanks for using LoverOfTheDay. Be loved :qq_beatingheart ", cb.room_slug, '', '#000000', 'bolder' );

timeBotNotice();
}

function timeBotNotice()
{
if (actionIndic < 1) {
cb.sendNotice(botNotice,'','', messColor ,'bolder');
actionIndic += 1 ;
}
cb.setTimeout(timeBotNotice, cb.settings.noticeTime * 60000) ;
}



//
// On Enter :
// Bot notification to the User
//

cb.onEnter(function(user)
{
var usr = user['user'];
cb.sendNotice(botNotice, usr ,'',messColor, 'bolder');
});

//
// On Tip :
//
// If the Tipper is not a Lover yet, and the Tip matches
// (depending on the Tip mode), make the tipper a lover,
// notify it and inhib the next Bot notice.
//


cb.onTip(function (tip)
{
actionIndic = 0;
var usr = tip['from_user'];
var amountTipped = parseInt(tip['amount']);

if (!isLover(usr) ) {

if (( (tipMode == 1) && (amountTipped >= cb.settings.loverTip) ) ||
( (tipMode == 2) && (amountTipped == cb.settings.loverTip) )) {

makeLover(usr);
actionIndic += 1;
cb.sendNotice(" :qq_heartthanks Thank you so much " + usr + ". Your heart now beats for me :qq_heartshy " ,'','', messColor ,'bolder');
}
}
});



//
// On Message :
//
// Message of the broadcaster stay unchanged
// Add the Lover graphic to Lovers messages
// Add the Non-Lover graphic to Non-Lovers messages
//

cb.onMessage(function (msg)
{
var usr = msg['user'];
actionIndic = 0;

if (!isOwner(usr))
{
if (isLover(usr))
{ msg['m'] = " :qq_beatingheart " + msg['m']; }
else
{ msg['m'] = " :qq_staticheart " + msg['m']; }
}
return msg;
});


// Functions :
//
// isOwner : User is the broadcaster ?
// isLover : User is in the list of Lovers ?
// makeLover : Add the user to the list of Lovers
// makePermanent : Add the user to the list of Permanent Lovers
//


function isOwner(username)
{ return (username == cb.room_slug); }

function isLover(username)
{ return (username in loversList); }

function makeLover(username)
{ loversList[username] = {'u': 1}; }

function isPermanent(username)
{ return (username in permanentList); }

function makePermanent(username)
{ permanentList[username] = {'u': 1}; }

//
// loversListPopulate ( ) :
// Initialize loversList and permanentList.
//

function loversListPopulate() {

var usr = cb.room_room ;
var b = '' ;
var c = '#000000' ;
var f = 'bolder' ;

var permArray = cb.settings.permanentString.toLowerCase().split((" "));

if (cbjs.arrayContains (permArray, cb.room_slug) ) {

permArray = cbjs.arrayRemove (permArray , cb.room_slug);
cb.sendNotice( "- You are in the list of Permanent Lovers. Sorry, no heart beating for youself ... The option to choose your own graphic will come soon. ", usr, b, c, f) ;
}

for (var i = 0 ; i < permArray.length ; i++) {
var perm = permArray[i].replace(/ /g, "");
if (perm && !isLover(perm)) {
makeLover(perm) ;
makePermanent(perm) ;
permNb += 1 ;
if (permNb == 1) {
cb.sendNotice(" - Permanent Lovers : ", usr, b, c, f) ;
}
cb.sendNotice(permNb + " : " +perm, usr, b, c, f) ;
}
}
}

//
// Init
//
//

init();

© Copyright Chaturbate 2011- 2026. All Rights Reserved.