Bots Home
|
Create an App
Glow Secret Bot
Author:
garterxxx
Description
Source Code
Launch Bot
Current Users
Created by:
Garterxxx
// Title: Glow Secret Bot // Author: Garter XXX // Version: 1.0 // Description: Simple, clean bot with welcome, tip crown, filter, and notices. // ===== STATE ===== var greeted = {}; var crownUser = null; var crownAmt = 0; var rotating = false; // ===== SETTINGS ===== cb.settings_choices = [ {name:'welcome_enabled', type:'choice', choice1:'yes', choice2:'no', defaultValue:'yes', label:'Welcome on entry'}, {name:'welcome_text', type:'str', minLength:1, maxLength:180, defaultValue:'Welcome to the room.', label:'Welcome message'}, {name:'block_words', type:'str', minLength:0, maxLength:500, defaultValue:'discord,telegram,whatsapp', label:'Blocked words'}, {name:'tip_announce', type:'choice', choice1:'yes', choice2:'no', defaultValue:'yes', label:'Announce tips'}, {name:'tip_template', type:'str', minLength:1, maxLength:160, defaultValue:'{user} tipped {amt}. Thank you.', label:'Tip message'}, {name:'crown_template', type:'str', minLength:1, maxLength:160, defaultValue:'{user} is now the Crown Holder with {amt}.', label:'Crown message'}, {name:'rotate_enabled', type:'choice', choice1:'yes', choice2:'no', defaultValue:'no', label:'Enable rotating notices'}, {name:'rotate_interval', type:'int', minValue:10, maxValue:3600, defaultValue:180, label:'Rotate every X seconds'}, {name:'rotate_1', type:'str', minLength:0, maxLength:140, defaultValue:'Be kind and respectful.', label:'Notice 1'}, {name:'rotate_2', type:'str', minLength:0, maxLength:140, defaultValue:'Tips keep the show going.', label:'Notice 2'}, {name:'rotate_3', type:'str', minLength:0, maxLength:140, defaultValue:'Top tipper holds the Crown.', label:'Notice 3'} ]; // ===== UTIL ===== function yes(v){ return (''+v).toLowerCase()==='yes'; } function blocked(text){ var raw=(cb.settings.block_words||'').toLowerCase(); if(!raw.trim()) return false; var list=raw.split(',').map(function(s){return s.trim();}).filter(Boolean); var t=(text||'').toLowerCase(); for(var i=0;i<list.length;i++){ if(list[i] && t.indexOf(list[i])!==-1) return true; } return false; } function sanitize(n){ return (n||'').toString().trim(); } // ===== WELCOME ===== cb.onEnter(function(u){ if(!yes(cb.settings.welcome_enabled)) return; var name=u['user']; if(!name || greeted[name]) return; greeted[name]=true; cb.sendNotice(cb.settings.welcome_text, name); }); // ===== CHAT ===== cb.onMessage(function(m){ var text=(m['m']||'').trim(); var user=m['user']||''; if(blocked(text)){ m['X-Spam']=true; cb.sendNotice('Message removed. Keep chat clean.', user); return m; } if(text.charAt(0)==='/'){ var parts=text.slice(1).split(' '); var cmd=(parts.shift()||'').toLowerCase(); if(cmd==='help'){ cb.sendNotice('Commands: /menu, /w <user> <msg>', user); m['X-Spam']=true; return m; } if(cmd==='w'){ var tgt=(parts.shift()||'').trim(); var msg=parts.join(' ').trim(); if(tgt&&msg) cb.sendNotice(user+': '+msg, tgt); m['X-Spam']=true; return m; } if(cmd==='menu'){ cb.sendNotice('Tip menu coming soon.', user); m['X-Spam']=true; return m; } if(cmd==='notice' && (user===cb.room_slug || m['is_mod']===true)){ cb.sendNotice(parts.join(' ')); m['X-Spam']=true; return m; } m['X-Spam']=true; return m; } return m; }); // ===== TIPS ===== cb.onTip(function(tip){ var amt=parseInt(tip['amount'],10)||0; var usr=sanitize(tip['from_user']); if(!usr || !amt) return; if(yes(cb.settings.tip_announce)){ var line=(cb.settings.tip_template||'').replace('{user}',usr).replace('{amt}',''+amt); cb.sendNotice(line); } if(amt>crownAmt){ crownAmt=amt; crownUser=usr; var cLine=(cb.settings.crown_template||'').replace('{user}',usr).replace('{amt}',''+amt); cb.sendNotice(cLine); } }); // ===== ROTATION ===== function rotateLoop(){ if(!rotating) return; var pool=[cb.settings.rotate_1, cb.settings.rotate_2, cb.settings.rotate_3].filter(function(s){return s && s.trim().length;}); if(pool.length){ var line=pool[Math.floor(Math.random()*pool.length)]; cb.sendNotice(line); } var wait=(parseInt(cb.settings.rotate_interval,10)||180)*1000; cb.setTimeout(rotateLoop, wait); } // ===== INIT ===== (function init(){ if(yes(cb.settings.rotate_enabled)){ rotating=true; rotateLoop(); } cb.sendNotice('Glow Secret Bot online.'); })();
© Copyright Chaturbate 2011- 2026. All Rights Reserved.