Bots Home
|
Create an App
Moon_vote
Author:
aerari
Description
Source Code
Launch Bot
Current Users
Created by:
Aerari
// bot options cb.settings_choices = [ {name: 'poll_title', type: 'str', minLength: 1, maxLength: 255, label: 'Poll Title'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay in minutes between notices being displayed (minimum 1)'}, {name: 'opt1_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 1'}, {name: 'opt1_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 1 tokens'}, {name: 'opt2_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 2'}, {name: 'opt2_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 2 tokens'}, {name: 'opt3_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 3', required: false}, {name: 'opt3_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 3 tokens', required: false}, {name: 'opt4_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 4', required: false}, {name: 'opt4_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 4 tokens', required: false}, {name: 'opt5_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 5', required: false}, {name: 'opt5_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 5 tokens', required: false}, {name: 'opt6_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 6', required: false}, {name: 'opt6_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 6 tokens', required: false}, {name: 'opt7_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 7', required: false}, {name: 'opt7_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 7 tokens', required: false}, {name: 'opt8_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 8', required: false}, {name: 'opt8_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 8 tokens', required: false}, {name: 'opt9_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 9', required: false}, {name: 'opt9_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 9 tokens', required: false}, {name: 'opt10_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 10', required: false}, {name: 'opt10_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 10 tokens', required: false}, {name: 'opt11_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 11', required: false}, {name: 'opt11_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 11 tokens', required: false}, {name: 'opt12_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 12', required: false}, {name: 'opt12_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 12 tokens', required: false}, {name: 'opt13_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 13', required: false}, {name: 'opt13_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 13 tokens', required: false}, {name: 'opt14_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 14', required: false}, {name: 'opt14_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 14 tokens', required: false}, {name: 'opt15_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 15', required: false}, {name: 'opt15_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 15 tokens', required: false}, {name: 'opt16_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 16', required: false}, {name: 'opt16_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 16 tokens', required: false}, {name: 'opt17_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 17', required: false}, {name: 'opt17_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 17 tokens', required: false}, {name: 'opt18_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 18', required: false}, {name: 'opt18_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 18 tokens', required: false}, {name: 'opt19_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 19', required: false}, {name: 'opt19_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 19 tokens', required: false}, {name: 'opt20_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 20', required: false}, {name: 'opt20_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 20 tokens', required: false}, {name: 'opt21_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 21', required: false}, {name: 'opt21_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 21 tokens', required: false}, {name: 'opt22_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 22', required: false}, {name: 'opt22_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 22 tokens', required: false}, {name: 'opt23_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 23', required: false}, {name: 'opt23_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 23 tokens', required: false}, {name: 'opt24_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 24', required: false}, {name: 'opt24_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 24 tokens', required: false}, {name: 'opt25_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 25', required: false}, {name: 'opt25_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 25 tokens', required: false}, {name: 'opt26_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 26', required: false}, {name: 'opt26_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 26 tokens', required: false}, {name: 'opt27_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 27', required: false}, {name: 'opt27_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 27 tokens', required: false}, {name: 'opt28_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 28', required: false}, {name: 'opt28_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 28 tokens', required: false}, {name: 'opt29_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 29', required: false}, {name: 'opt29_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 29 tokens', required: false}, {name: 'opt30_label', type: 'str', minLength: 1, maxLength: 255, label: 'Option 30', required: false}, {name: 'opt30_tokens', type: 'int', minValue: 0, default: 0, label: 'Option 30 tokens', required: false} ]; var foreground = '#FFFFFF'; var fg_warn = '#FF0000'; var background = '#0629AC'; var opt_labels = [cb.settings.opt1_label, cb.settings.opt2_label, cb.settings.opt3_label, cb.settings.opt4_label, cb.settings.opt5_label, cb.settings.opt6_label, cb.settings.opt7_label, cb.settings.opt8_label, cb.settings.opt9_label, cb.settings.opt10_label, cb.settings.opt11_label, cb.settings.opt12_label, cb.settings.opt13_label, cb.settings.opt14_label, cb.settings.opt15_label, cb.settings.opt16_label, cb.settings.opt17_label, cb.settings.opt18_label, cb.settings.opt19_label, cb.settings.opt20_label, cb.settings.opt21_label, cb.settings.opt22_label, cb.settings.opt23_label, cb.settings.opt24_label, cb.settings.opt25_label, cb.settings.opt26_label, cb.settings.opt27_label, cb.settings.opt28_label, cb.settings.opt29_label, cb.settings.opt30_label]; var opt_tokens = [cb.settings.opt1_tokens, cb.settings.opt2_tokens, cb.settings.opt3_tokens, cb.settings.opt4_tokens, cb.settings.opt5_tokens, cb.settings.opt6_tokens, cb.settings.opt7_tokens, cb.settings.opt8_tokens, cb.settings.opt9_tokens, cb.settings.opt10_tokens, cb.settings.opt11_tokens, cb.settings.opt12_tokens, cb.settings.opt13_tokens, cb.settings.opt14_tokens, cb.settings.opt15_tokens, cb.settings.opt16_tokens, cb.settings.opt17_tokens, cb.settings.opt18_tokens, cb.settings.opt19_tokens, cb.settings.opt20_tokens, cb.settings.opt21_tokens, cb.settings.opt22_tokens, cb.settings.opt23_tokens, cb.settings.opt24_tokens, cb.settings.opt25_tokens, cb.settings.opt26_tokens, cb.settings.opt27_tokens, cb.settings.opt28_tokens, cb.settings.opt29_tokens, cb.settings.opt30_tokens]; var mins_remain = cb.settings.poll_count; var votes_remain = cb.settings.poll_count; var poll_running = true; cb.onTip(function (tip) { var amount = parseInt(tip['amount']); var Tip_message = (tip['message']); if (Tip_message != "") { for (i=0; i<opt_tokens.length; i++) { if (Tip_message == opt_labels[i]) { cb.sendNotice(tip['from_user'] + " has voted for " + opt_labels[i] + " " + amount + " votes" , '', background, foreground); opt_tokens[i] = opt_tokens[i] + amount; } } } }); cb.onMessage(function (m) { switch (m['m']) { case '!vote': // other users don't need to see this message var is_mod = (cb.room_slug == m['user'] || m['is_mod']); m['X-Spam'] = !is_mod; if (is_mod) { showBoard(''); } else { showBoard(m['user']); } break; } }); function showBoard(user) { // var response1 = "Here's the Token Poll board:\n"; var response1 = '---------- Trip Voting board' + ('' == user ? ' (sent to all)' : '') + ': ----------\n'; var response2 = cb.settings.poll_title; if (!poll_running) { return; } for (i=0; i<opt_tokens.length; i++) { if ("" != opt_labels[i]) { response2 += "\n - " + opt_labels[i] + " ["+ opt_tokens[i] + " votes]" ; } } var response3 = ''; response3 = 'Simply tip the any amount and write name of your city to register your vote.\nWrite me if your city still not in list.\nType !vote at any time to see poll board.'; // cb.sendNotice(response1, user); cb.sendNotice(response1 + response2, user, background, foreground, 'bold'); // if (undefined != response3) { cb.sendNotice(response3, user, background, foreground); // } // cb.sendNotice(response4, user); } cb.onEnter(function (user) { cb.sendNotice("Hello " + user['user'] + ", the Trip Voting app is currently active in this room.\nWrite your city in a tinote to vote for it.\nType !vote to see voting voting.", user['user'], background, foreground); }); function chatAd() { var msg; msg = "The Trip Voting app is currently active in this room.\nWrite your city in a tinote to vote for it.\n1 token = 1 vote. More tokens - more votes!\nType !vote to see voting list."; cb.sendNotice(msg,'', background, foreground,'bold'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000));
© Copyright Chaturbate 2011- 2024. All Rights Reserved.