Bots Home
|
Create an App
voti - old_wulf
Author:
old_wulf
Description
Source Code
Launch Bot
Current Users
Created by:
Old_Wulf
/* Title: "Vote Off The Island" Bot Author: Old_Wulf Version: 1.00a1 History: 2018/01/018 - Original Code todo: Fix the code so it says 1 token 2 tokens etc. # voted (upon) user var vuser = {name: "name", sVotes: "sVotes", bVotes: "bVotes}; Update so that if values are 0 they are disabled. Must at least have silencing enabled (or the bot is pointless) Spit out messages about things being disabled if they are set to zero. Add notice that mods and the broadcaster can always silence|ban. Add a command to see what the tip values are and instructions /voti_help Keep stats on the number of people silenced|banned and number of tokens generated? */ var progName = 'VOTI'; var version = '1.00a1' var author = "Old_Wulf" var tokensPerVote; var votesToSilence; var votesToBan; var tokensForInstaSilence; var tokensForInstaBan; var tokensForImmunity; var voteableUserColor; var sendInstructions; var noticeColor = '#F10060'; var vUsers = []; cb.settings_choices = [ { name: 'tokensPerVote', type: 'int', minValue: 1, maxValue: 99999, defaultValue: 1, required: true, label: 'Number of tokens to cast a vote' }, { name: 'votesToSilence', type: 'int', minValue: 1, maxValue: 99999, defaultValue: 5, required: true, label: 'Number of votes required before silencing' }, { name: 'votesToBan', type: 'int', minValue: 1, maxValue: 99999, defaultValue: 10, required: true, label: 'Number of votes required before banning' }, { name: 'tokensForInstaSilence', type: 'int', minValue: 0, maxValue: 99999, defaultValue: 101, required: true, label: 'Amount in a single tip for an InstaSilence' }, { name: 'tokensForInstaBan', type: 'int', minValue: 0, maxValue: 99999, defaultValue: 1001, required: true, label: 'Amount in a single tip for an InstaBan' }, { name: 'tokensForImmunity', type: 'int', minValue: 1, maxValue: 99999, defaultValue: 15, required: true, label: 'Cannot be silenced|banned if user has tipped at least this many tokens' }, { name: 'voteableUserColor', type: 'choice', choice1: 'Light Blue', choice2: 'Dark Blue', choice3: 'Light Purple', choice4: 'Dark Purple', defaultValue: "Light Blue", required: true, label: 'Cannot be silenced|banned if user is this color or higher' }, { name: 'sendInstructions', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: true, label: 'Send instructions on voting when a user enters the room', }, { name: 'noticeColor', type: 'str', label: 'Notice color in hex (default reddish)', defaultValue: '#F10060' }, { name: 'exemptUsers', type: 'str', label: 'List of users who can never be voted off (mods, fan club, broadcaster are always unvotable)', required: false, defaultValue: '' } ]; cb.onMessage(function (msg) { vUsers[msg.m].sVote += 1; cb.sendNotice(msg.m + ' has received ' + vUsers[msg.m].sVote + '/' + votesToSilence + ' votes to silence.', '', '', noticeColor, 'bold'); return msg; }); // Check for plural // Pluralize the string if needed. function cfp(string, num) { if (num > 1) { return(string + 's'); } else { return(string); } } function checkColorValidity(color) { if (/^#[0-9A-F]{6}$/i.test(color)) { return(color); } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { cb.sendNotice(progName + " - Error while setting the notice color. Using default value: " + noticeColor, cb.room_slug, "#FFFFFF", "#FF0000", 'bold'); return(noticeColor); } } function init() { // Initialize all the vars tokensPerVote = cb.settings['tokensPerVote']; votesToSilence = cb.settings['votesToSilence']; votesToBan = cb.settings['votesToBan']; tokensForInstaSilence = cb.settings['tokensForInstaSilence']; tokensForInstaBan = cb.settings['tokensForInstaBan']; tokensForImmunity == cb.settings['tokensForImmunity']; voteableUserColor = cb.settings['voteableUserColor']; noticeColor = checkColorValidity(cb.settings['noticeColor']); sendInstructions = (cb.settings['sendInstructions'] == "Yes") ? true : false; cb.sendNotice('Vote Off The Island by ' + author + ' Version: ' + version + ' started.', '', '', noticeColor, 'bold'); cb.sendNotice('Use a tip note in the form of "@username silence" or "@username ban" to cast a vote.', '', '', noticeColor, 'bold'); cb.sendNotice('Tip ' + tokensPerVote + cfp(' token', tokensPerVote) + ' to cast a vote.' + ' (' + votesToSilence + '|' + votesToBan + ') votes requred to (silence|ban).', '', '', noticeColor, 'bold'); if (tokensForInstaSilence > 0 || tokensForInstaBan > 0) { cb.sendNotice('Tip (' + tokensForInstaSilence + '|' + tokensForInstaBan + ') tokens for an instant vote to (silence|ban).', '', '', noticeColor, 'bold'); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.