Bots Home
|
My Uploads
|
Create an App
poll bot11
Author:
sofia_dicaprio
Description
Source Code
Launch Bot
Current Users
Created by:
Sofia_Dicaprio
App Images
/// ==================================================== /// PollBot Ultimate 🌈💫 para Chaturbate /// Autor: ChatGPT (versión JavaScript) /// ==================================================== const WEBHOOK_URL = "[https://script.google.com/macros/s/AKfycbyPSNN4jOC2CrRSqrkoL6Ia5S4Oa-B7d83hv-LZSiss1LbG8CCS76urjLgEnUO692HBvA/exec](https://script.google.com/macros/s/AKfycbyPSNN4jOC2CrRSqrkoL6Ia5S4Oa-B7d83hv-LZSiss1LbG8CCS76urjLgEnUO692HBvA/exec)"; let USE_ANIMATIONS = true; let USE_RAINBOW_TEXT = true; const EMOJIS = ["🔥", "💖", "⚡", "🌈", "✨"]; const BOT_NAME = "PollBot🌈"; let pollActive = false; let pollData = {}; let votes = {}; cb.settings_choices = function () { return []; }; cb.onStart = function () { cb.log("PollBot iniciado correctamente 🌈💫"); cb.sendNotice("PollBot 🌈💫 activado. Usa /poll para crear una encuesta."); }; cb.onMessage = function (msg) { const user = msg.user; const text = msg.m.trim(); const isMod = msg.is_mod; const isOwner = msg.is_from_broadcaster; if (text.startsWith("/poll") && (isMod || isOwner)) { const parts = text.split(" ", 3); if (parts.length < 3) { cb.sendNotice("Uso: /poll [modo: free|paid|mixed] pregunta,opcion1,opcion2,..."); return; } ``` const mode = parts[1].toLowerCase(); if (!["free", "paid", "mixed"].includes(mode)) { cb.sendNotice("Modo inválido. Usa: free, paid o mixed."); return; } const questionPart = parts[2].split(","); if (questionPart.length < 3) { cb.sendNotice("Debes escribir una pregunta y al menos 2 opciones."); return; } const question = questionPart[0].trim(); const options = questionPart.slice(1).map(o => o.trim()).filter(o => o); startPoll(question, options, mode); return; ``` } if (text.startsWith("/votar")) { if (!pollActive) { cb.sendUserNotice(user, "No hay encuesta activa."); return; } const parts = text.split(" "); if (parts.length < 2 || isNaN(parts[1])) { cb.sendUserNotice(user, "Uso: /votar N (ej. /votar 1)"); return; } const optionNum = parseInt(parts[1]) - 1; voteOption(user, optionNum); } if (text === "/pollstop" && (isMod || isOwner)) { endPoll("manual"); } if (text === "/animoff" && (isMod || isOwner)) { USE_ANIMATIONS = false; cb.sendNotice("✨ Animaciones desactivadas."); } if (text === "/animon" && (isMod || isOwner)) { USE_ANIMATIONS = true; cb.sendNotice("🌈 Animaciones activadas."); } }; function startPoll(question, options, mode) { pollActive = true; votes = {}; options.forEach(opt => votes[opt] = 0); pollData = { question: question, options: options, mode: mode, start_time: new Date().toISOString() }; cb.sendNotice(`🎉 NUEVA ENCUESTA: ${question}`); options.forEach((o, i) => cb.sendNotice(`(${i + 1}) ${o}`)); cb.sendNotice("Usa /votar N para participar."); cb.sendNotice(`Modo: ${mode.toUpperCase()} | Animaciones: ${USE_ANIMATIONS ? 'ON' : 'OFF'}`); } function voteOption(user, optionIndex) { const options = pollData.options; if (optionIndex < 0 || optionIndex >= options.length) { cb.sendUserNotice(user, "Opción inválida."); return; } const choiceOption = options[optionIndex]; votes[choiceOption]++; const emoji = EMOJIS[Math.floor(Math.random() * EMOJIS.length)]; const msg = `${user} votó por '${choiceOption}' ${emoji}`; sendAnimatedMessage(msg); } cb.onTip = function (tip) { if (!pollActive) return; const user = tip.from_user; const amount = tip.amount; const message = tip.message || ""; const mode = pollData.mode; if (mode === "free") return; const options = pollData.options; const parts = message.split(" "); let num = parseInt(parts[0]) - 1; if (isNaN(num)) num = 0; if (num < 0 || num >= options.length) { cb.sendUserNotice(user, "Opción inválida en tip."); return; } let multiplier = 1; if (mode === "mixed") multiplier = 3; votes[options[num]] += multiplier; const emoji = EMOJIS[Math.floor(Math.random() * EMOJIS.length)]; sendAnimatedMessage(`${user} dio ${amount} tokens y votó por '${options[num]}' ${emoji}`); }; function endPoll(reason) { if (!pollActive) { cb.sendNotice("No hay encuesta activa."); return; } pollActive = false; let resultsText = "Resultados:\n"; for (const o in votes) { resultsText += `${o}: ${votes[o]} votos\n`; } sendAnimatedMessage("🗳️ ENCUESTA FINALIZADA 🗳️"); sendAnimatedMessage(resultsText); saveToSheets(pollData.question, votes); pollData = {}; votes = {}; } function sendAnimatedMessage(msg) { if (USE_ANIMATIONS) { if (USE_RAINBOW_TEXT) { cb.sendNotice(`🌈 ${msg} 🌈`); } else { cb.sendNotice(`💫 ${msg} 💫`); } } else { cb.sendNotice(msg); } } function saveToSheets(question, votesDict) { const data = { question: question, results: votesDict, datetime: new Date().toISOString() }; fetch(WEBHOOK_URL, { method: "POST", body: JSON.stringify(data), headers: { "Content-Type": "application/json" } }) .then(res => cb.log("✅ Datos enviados a Google Sheets.")) .catch(err => cb.log("❌ Error enviando a Google Sheets: " + err)); }
© Copyright Chaturbate 2011- 2026. All Rights Reserved.