Bots Home
|
Create an App
capca
Author:
philwhelp
Description
Source Code
Launch Bot
Current Users
Created by:
Philwhelp
messColor = "#fd00fd"; // patch cb.settings_choices = [ {name:'use_capt', label: "Use Capcha", type:'choice', choice1:'yes', choice2:'no', defaultValue: 'yes'}, {name:'capt', label: "Capcha type", type:'choice', choice1:'Question', choice2:'Number', defaultValue: 'Number'} ]; capt = cb.settings.capt; use_capt = cb.settings.use_capt; spam_count = 0; //-- app setting start function isOwner(e) { return e == cb.room_slug } function sendTitle(e, t, n, bn) { var o = n ? n : messColor; var bo = bn ? bn : ""; o = isOwner(e) ? "#000000" : o, cb.sendNotice(t, e, bo, o, "bolder") } //-- app settings end spacer = " \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605 \u2605"; // main start var allowed_users =[cb.room_slug]; var user_list = {}; function get_Rand() { quest = capt == "Question" ? Math.floor((Math.random() * 90) + 11) +" plus "+ Math.floor((Math.random() * 90) + 11): Math.floor((Math.random() * 9000) + 1001); return quest; } function getResult(e) { return (e.toString().indexOf("plus") != -1) ? Function(`'use strict'; return (${e.replace("plus", "+")})`)() : e; } function addUSR(e) { user_list[e] = get_Rand(); } // check functions function chk_allow(e) { pass = user_list[e.user] ? user_list[e.user] : get_Rand(); if (e.has_tokens == true){ if (allowed_users.indexOf(e.user) != -1) { allowed_users.push(e.user) } return "pass1"} else if (allowed_users.indexOf(e.user) != -1){return "pass1"} else if (e.m == getResult(pass)){allowed_users.push(e.user); return "pass2"} else { addUSR(e.user); return "fault";} } cb.onEnter(function(e) { if (use_capt == "yes"){ var chk = chk_allow(e); if (chk == "fault"){ note = capt == "Number" ? "\n please type the following number to chat \n" : "\n please answer the following question below \n"; note += capt == "Number" ? user_list[e.user].toString().split("").join(" ") : user_list[e.user].toString() ; sendTitle(e.user, spacer + "\n Welcome " + e.user + "! CaptchaBot is active! " + note + "\n" + spacer, "#000000", "#ffff00") } } }); cb.onMessage(function (e) { if (e.m == "!spamcount") {sendTitle(e.user, "The current messages are blocker are : " + spam_count, "#000000", "#ffff00"); e['X-Spam'] = true;} if (use_capt == "yes"){ var chk = chk_allow(e); if (chk == "pass1") {return e} if (chk == "pass2") { e['X-Spam'] = true; e.m="Thank you. you can now chat"; return e; } else { e['X-Spam'] = true; note = capt == "Number" ? "\n please type the following number to chat \n" : "\n please answer the following question below \n"; note += capt == "Number" ? user_list[e.user].toString().split("").join(" ") : user_list[e.user].toString() ; setTimeout(function(){sendTitle(e.user,spacer +"\n "+ note + "\n" + spacer, "#000000", "#ffff00")}, 500); e.m="Message not sent! please answer the question below."; spam_count++;} return e; } }); if (use_capt == "yes"){sendTitle("", "CaptchaBot is now active! ", "#000000", "#ffff00") ;}
© Copyright Chaturbate 2011- 2024. All Rights Reserved.