Bots Home
|
Create an App
Working Wingman
Author:
renzo_899
Description
Source Code
Launch Bot
Current Users
Created by:
Renzo_899
// Working Wingman: converts entrants into chatters. Event-driven only, never talks over humans. var lastActivity = Date.now(); var lastWakeNotice = 0; var msgCount = 0; var greeted = {}; var questions = [ 'Quick poll while Renzo works: beach or mountains?', 'Question for the room: coffee or energy drinks?', 'Poll: should Renzo quit work early today? yes / yes', 'Be honest: who else is supposed to be working right now?', 'Poll: glasses on or off?' ]; cb.settings_choices = [ { name: 'greetTokensOnly', label: 'Greet only users with tokens?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'wakeAfterSilentMin', label: 'Wake-up notice if room was silent for (min):', type: 'int', minValue: 3, maxValue: 120, defaultValue: 10 }, { name: 'questionEvery', label: 'Conversation starter every N human messages:', type: 'int', minValue: 5, maxValue: 100, defaultValue: 20 } ]; function onActivity() { var now = Date.now(); var silentMs = cb.settings.wakeAfterSilentMin * 60000; if (now - lastActivity > silentMs && now - lastWakeNotice > silentMs) { cb.sendNotice('Someone just joined the party - type /menu to distract Renzo, or tip 5 to call a Keno number', '', '#E8F4FF', '#0C5A8A', 'bold', 'all'); lastWakeNotice = now; } lastActivity = now; } cb.onEnter = function (user) { try { var name = user['user']; onActivity(); if (greeted[name]) { return; } greeted[name] = true; if (cb.settings.greetTokensOnly === 'Yes' && !user['has_tokens']) { return; } cb.sendNotice('Welcome ' + name + ' - Renzo is on a deadline, help him procrastinate (/menu)', name, '', '', 'bold'); } catch (e) {} }; cb.onMessage = function (msg) { try { onActivity(); msgCount++; var every = Math.max(5, cb.settings.questionEvery); if (msgCount % every === 0) { var idx = Math.floor(msgCount / every) % questions.length; cb.sendNotice(questions[idx], '', '#FFF3D6', '#7A5200', 'bold', 'all'); } } catch (e) {} return msg; }; cb.onTip = function (tip) { try { onActivity(); } catch (e) {} };
© Copyright Chaturbate 2011- 2026. All Rights Reserved.