Bots Home
|
Create an App
Promo Linktree
Author:
kalistone
Description
Source Code
Launch Bot
Current Users
Created by:
Kalistone
/* === Promo Link Bot para Chaturbate === * Anuncios rotatorios + respuesta por privado con tu enlace. * Ajusta desde Settings (cb.settings_choices). */ // ---------- SETTINGS VISIBLES EN EL PANEL ---------- cb.settings_choices = [ {name: 'promo_url', type: 'str', minLength: 3, defaultValue: 'https://linktr.ee/april008', label: 'URL a promocionar (Linktree/Beacons)'}, {name: 'promo_text', type: 'str', minLength: 3, defaultValue: 'Más contenido y packs en mi bio 👉', label: 'Texto del anuncio'}, {name: 'interval_min', type: 'int', minValue: 1, maxValue: 60, defaultValue: 8, label: 'Intervalo de anuncio (minutos)'}, {name: 'whisper_on_command', type: 'choice', choice1: 'on', choice2: 'off', defaultValue: 'on', label: 'Enviar enlace por privado con comando (!link / !of)'}, {name: 'room_notice_weight', type: 'choice', choice1: 'bold', choice2: 'normal', defaultValue: 'bold', label: 'Peso del aviso en sala'}, {name: 'show_trigger_hint', type: 'choice', choice1: 'on', choice2: 'off', defaultValue: 'on', label: 'Mostrar pista de comando en los avisos'} ]; // ---------- ESTADO INTERNO ---------- var lastRoomAnnounceTs = 0; var roomCooldownMs = 1000 * 60 * 3; // 3 minutos entre avisos manuales var userCooldownMs = 1000 * 60 * 2; // 2 min por usuario para comando var userLastWhisper = {}; // { username: timestamp } var timerId = null; // Helpers function minutes(n) { return n * 60 * 1000; } function now() { return new Date().getTime(); } function announceToRoom() { var txt = cb.settings.promo_text + " " + cb.settings.promo_url; if (cb.settings.show_trigger_hint === 'on') { txt += " | pide el enlace con !link"; } // sendNotice(message, [to_user], [background], [foreground], [weight], [to_group]) cb.sendNotice("📣 " + txt, null, null, null, cb.settings.room_notice_weight); lastRoomAnnounceTs = now(); } function scheduleNext() { var delay = minutes(cb.settings.interval_min); timerId = cb.setTimeout(function() { announceToRoom(); scheduleNext(); }, delay); } // ---------- EVENTOS PRINCIPALES ---------- cb.onStart(function () { // Primer aviso al iniciar y programar rotación announceToRoom(); scheduleNext(); }); // Responder comandos en chat cb.onMessage(function (msg) { try { var text = (msg.m || "").trim().toLowerCase(); var user = msg.user; // Solo procesar comandos con prefijo ! if (text.indexOf('!') !== 0) return; // Comando !link o !of -> enviar por privado si está activado if ((text === '!link' || text === '!of') && cb.settings.whisper_on_command === 'on') { var last = userLastWhisper[user] || 0; if (now() - last < userCooldownMs) { cb.sendNotice("⏳ " + user + ", espera un momento antes de pedirlo de nuevo.", user); return; } cb.sendNotice("🔗 Aquí tienes: " + cb.settings.promo_url + " (guárdalo en tus favoritos)", user); userLastWhisper[user] = now(); return; } // Comando !promo -> forzar aviso en sala con cooldown if (text === '!promo') { if (now() - lastRoomAnnounceTs < roomCooldownMs) { cb.sendNotice("⏳ Aún no: hay cooldown para evitar spam."); } else { announceToRoom(); } return; } } catch (e) { cb.log("Error onMessage: " + e); } }); // Limpieza si se detiene la emisión cb.onBroadcastStop(function () { if (timerId) { cb.cancelTimeout(timerId); timerId = null; } });
© Copyright Chaturbate 2011- 2026. All Rights Reserved.