Bots Home
|
Create an App
myheroes
Author:
analiestar
Description
Source Code
Launch Bot
Current Users
Created by:
Analiestar
/* * App: myheroes * Author: analiestar * Date: 30-04/2020 * Version: 1.0.2 * Description: Remember your fans * Commands: /myheroes */ cb.settings_choices=[ { name: 'txt_heroes', type: 'str', label: 'My Heroes: (separete,with,comma)', defaultValue: '', required: false }, { name: 'mintiphero', type: 'int', label: 'Minimum Tip Hero', defaultValue: 100, required: true }, { name: 'mintipnotify', type: 'int', label: 'Min Tip Session Notify', defaultValue: 1, required: true } ]; var newheroes=[]; var myheroes=[]; var mytippers=[]; var notices; cb.onTip(function(tip) { var user=tip['from_user']; var tip=parseInt(tip['amount']); var found=false; for(var i=0;i<mytippers.length;i++) { if(mytippers[i].name==user) { mytippers[i].amount+=tip; if(mytippers[i].amount>=cb.settings.mintiphero) { if(!newheroes.includes(user)) { newheroes.push(user); notices=""; notices+=user+" is now my newest hero <333"; cb.sendNotice(notices,'','#682DB9','#DEDB69','bold'); } } found=true; break; } } if(!found) { var newtipper={ name: user, amount: tip }; mytippers.push(newtipper); if(tip>=cb.settings.mintiphero) { newheroes.push(user); notices=""; notices+=user+" is now my newest hero <333"; cb.sendNotice(notices,'','#682DB9','#DEDB69','bold'); } else { notices=""; notices+=user+" is now vip (;"; cb.sendNotice(notices,'','#682DB9','#DEDB69','bold'); } } }); cb.onMessage(function(msg) { if(cb.room_slug==msg['user'] && msg['m'].match(/\/myheroes/i)) { msg['X-Spam']=true; notices=""; notices+="My heroes today -- <3 "; for(var i=0;i<newheroes.length;i++) { notices+=newheroes[i]+" <3 "; if(!myheroes.includes(newheroes[i])) myheroes.push(newheroes[i]); } cb.sendNotice(notices,'','#682DB9','#DEDB69','bold'); notices="[hidden] "; notices+="Your full list of heroes to copy into the bots permanent heroes: (include,the,commas)\n"; notices+="--\n"; for(var i=0;i<myheroes.length;i++) { notices+=myheroes[i]; if(i<myheroes.length-1) notices+=","; } cb.sendNotice(notices,cb.room_slug,'#682DB9','#DEDB69','bold'); } }); cb.onLeave(function(user) { for(var i=0;i<mytippers.length;i++) { if(mytippers[i].name==user['user']) { notices=""; notices+=user['user']+" has left the room."; cb.sendNotice(notices,'','#682DB9','#DEDB69','bold'); break; } } }); cb.onEnter(function(user) { notices=""; notices+="Myheroes bot is running!\n"; notices+="All users tipping more than "+cb.settings.mintipnotify+" will be notified in chat on entry and leave!\n"; notices+="All users tipping more than "+cb.settings.mintiphero+" will be remembered as heroes in this app for all time!"; cb.sendNotice(notices,user['user'],'#682DB9','#DEDB69','bold'); for(var i=0;i<mytippers.length;i++) { if(mytippers[i].name==user['user']) { notices=""; notices+=user['user']+" have joined the room!"; cb.sendNotice(notices,'','#682DB9','#DEDB69','bold'); break; } } }); var heroes=cb.settings.txt_heroes; function init() { notices=""; notices+="Myheroes bot has started!\n"; notices+="All users tipping more than "+cb.settings.mintipnotify+" will be notified in chat on entry and leave!\n"; notices+="All users tipping more than "+cb.settings.mintiphero+" will be remembered as heroes in this app for all time!"; cb.sendNotice(notices,'','#682DB9','#DEDB69','bold'); if(heroes && heroes.length) { if(heroes.length>0) { if(heroes.includes(",")) { myheroes=heroes.split(","); } else { myheroes.push(heroes); } } for(var i=0;i<myheroes.length;i++) { var newtipper={ name: myheroes[i], amount: 0 }; mytippers.push(newtipper); } } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.