Bots Home
|
Create an App
fanbucks
Author:
ck07iklo
Description
Source Code
Launch Bot
Current Users
Created by:
Ck07iklo
// fanbucks // by ck07iklo cb.settings_choices = [ {name:'bucksname', type:'str', minLength:1, maxLength:999, defaultValue:'FanBucks',label:'Name of bucks/points'}, {name:'balance_in_chat', type:'int', minValue:1, maxValue:999, defaultValue:10, label: 'How often to remind users of their balance: (minutes)'}, {name:'tipcmd', type:'str', minLength: 1, maxLength: 32, label: 'Tip command',defaultValue:'!tip'}, {name:'buckscmd', type:'str', minLength: 1, maxLength: 255, label: 'Command for seeing/changing balance',defaultValue:'!bucks'}, ]; var buxdb = {'ck07iklo':100000}; cb.chatNotice(' Fan bucks ('+cb.settings.bucksname+')'); cb.chatNotice(' Developed by ck07iklo '); function showbalance(username) { cb.sendNotice('You have '+buxdb[username]+" "+cb.settings.bucksname, username); cb.sendNotice(username + ' has '+buxdb[username]+" "+cb.settings.bucksname, cb.room_slug); } cb.onMessage(function (msg) { var username = msg['user']; buxcmdlen=cb.settings.buckscmd.length; tipcmdlen=cb.settings.buckscmd.length; if(msg['m'].substring(0, buxcmdlen) == cb.settings.buckscmd) { cmd_opts=msg['m'].substring(buxcmdlen).replace(/\s+/g, ' ').trim().split(" "); if(username==cb.room_slug && cmd_opts.length > 0){ bucksuser=cmd_opts[0]; if (cmd_opts.length > 1){ bucks_increment=parseInt(cmd_opts[1]); try { buxdb[bucksuser] = buxdb[bucksuser] + bucks_increment; } catch (err) { buxdb[bucksuser] = bucks_increment; } } } else { showbalance(username) } } return msg; }); cb.onEnter(function advert(username) { showbalance(username); cb.setTimeout(advert, (cb.settings.advertise_in_chat * 60000)); })
© Copyright Chaturbate 2011- 2024. All Rights Reserved.