Bots Home
|
Create an App
RomeoBot
Author:
romeo_john
Description
Source Code
Launch Bot
Current Users
Created by:
Romeo_John
/* #################################################################################################### # # Kate's All-in-One Bot # Version: 0.0.1 # Author: romeo_john # #################################################################################################### */ var BOT = (function(){ var _cfg = {}; function _cancelTimeout(id) { cb.cancelTimeout(id); } function _changeRoomSubject(new_subject) { cb.changeRoomSubject(new_subject); } function _doubleNum(num) { return num < 10 ? "0" + num.toString() : num.toString(); } function _drawPanel() { cb.drawPanel(); } function _formatSettingsHeading(heading_text) { return ":::::::::: " + heading_text + " ::::::::::" } /* c: message color m: the message text user: username of message sender f: message font in_fanclub: is the user in the broadcasters fan club has_tokens: does the user have at least 1 token is_mod: is the user a moderator tipped_recently: is the user a “dark blue”? tipped_alot_recently: is the user a “purple”? tipped_tons_recently: is the user a “dark purple”? gender: “m” (male), “f” (female), “s” (trans), or “c” (couple) */ function _handleMessage(msg) { var message_text = msg["m"].toLowerCase().trim(); if (message_text.length <= 10 && message_text.indexOf("pm") != -1 && cb.settings.pm_cost > 0) { cb.sendNotice("pm-" + cb.settings.pm_reply_pm_cost + "tkn"); } return msg; } function _htmlEntityDecode(str) { return $("<div />").html(str).text(); } function _htmlEntityEncode(str) { return $('<div/>').text(str).html(); } function _log(msg) { cb.log(msg); } function _setTimeout(func, msecs) { var id = cb.setTimeout(func, msecs); return id; } function _setupSettings() { cb.settings_choices = [ { name: "pm_reply_heading", type: "choice", label: _formatSettingsHeading("Automatically reply to PM requests"), required: false }, { name: "pm_reply_enable", type: "choice", label: "Enable", choice1: "Yes", choice2: "No", defaultValue: "Yes" }, { name: 'pm_reply_pm_cost', type: 'int', label: "How many tokens do you charge for a PM? ", minValue: 0, maxValue: 10000, defaultValue: 20 } ]; } function _timestamp() { return Math.floor(Date.now() / 1000); } return { getBotName: function() { return "Kate's All-in-One Bot"; }, log: function(msg) { _log(msg); }, htmlEntityDecode: function(str) { return _htmlEntityDecode(str); }, htmlEntityEncode: function(str) { return _htmlEntityEncode(str); }, init: function() { BOT.log(BOT.getBotName() + " initialized."); _setupSettings(); cb.onMessage(function (msg) { return _handleMessage(msg); }); } }; })(); BOT.init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.