Bots Home
|
Create an App
TestTrivia
Author:
walla
Description
Source Code
Launch Bot
Current Users
Created by:
Walla
var trivia_questions = { mixed: { 'Who is Connies favorite husband? Cohent, Major, AZ or Dilly': 'all of them', 'What is Connies favorite book? The Name of the Rose, The Gangsta That Stole My Heart or Everyone poops?': 'The Name of the Rose', 'What is Connies all time favorite movie? Honey, I Shrunk the Kids, Goodfellas, Gone Girl or Se7en?': 'Gone Girl' }, sexual: { 'Who is the current supreme leader of North Korea?': 'Kim Jong Un', 'What famous actor became Governor of California in 2003?': 'Arnold Schwarzenegger', 'Who was the vice president that served under President Barack Obama?': 'Joe Biden', 'What late American singer was the mayor of Palm Springs California from 1988 to 1992?': 'Sonny Bono', 'Who was vice president of the United States when Lincoln was assassinated?': 'Andrew Johnson', 'In What state was President Barack Obama born?': 'Hawaii', 'Who won the nomination of the Democratic Party to run for president in 2016?': 'Hillary Clinton', 'How many states are needed to ratify an amendment for it to become part of the constitution?': 'Three-fourths of the states', 'Who is the oldest person to be elected to the office of President of the United States?': 'Donald Trump', 'The Bill of Rights contains how many of the first amendments to the United States Constitution?': 'Ten', 'Barack Obama was first elected president of the United States in what year?': '2008', 'How many U.S. presidents were only children?': 'None', 'The oldest parliament in the world belongs to what country?': 'Iceland', 'Who assassinated President Abraham Lincoln?': 'John Wilkes Booth', 'Who was the first First Lady to be elected to public office?': 'Hillary Rodham Clinton', 'Who was the first Roman Catholic to be Vice President of the United States of America?': 'Joe Biden', 'Which US president was known as “The Great Communicator”?': 'Ronald Regan', 'What animal is the symbol of the United States democratic party?': 'Donkey', 'Who was the first U.S. president that was born a citizen of the United States?': 'Martin Van Buren', 'The Electoral College in the United States is made up of how many electors?': '538', 'How many US Supreme Court justices are there?': '9' }, } var playing = false; var topic = ""; var score_board = {}; var answer = ""; var question = ""; var mode = ""; cb.onMessage((message) => { var m = message.m.toLowerCase().trim(); if (trivia_questions[m]) { topic = m; cb.sendNotice("Do you want easy mode or hard mode?", "", "#fff", "#C71393") } if ((m == "easy" || m == "hard") && answer == "") { play(topic, m) mode = m } if (m == "-trivia") { playing = true; var topics = ""; for (var t in trivia_questions) { topics += `/${t}/ ` } cb.sendNotice("What topic do you want? " + topics, "", "#fff", "#C71393") } if (m == answer.toLowerCase()) { delete trivia_questions[topic][question]; cb.sendNotice(`${message.user} is correct! Next question? Y|N`, "", "#fff", "#C71393"); if (score_board[message.user]) { score_board[message.user] += 1; } else { score_board[message.user] = 1; } var scores = ""; for (var s in score_board) { scores += `${s}:${score_board[s]} | ` } cb.sendNotice(scores, "", "#fff", "#C71393") answer = "" } if (message.m == "Y" && answer == "") { play(topic, mode); } if (m == "-hint") { var half = (answer.length - 1) / 2; var hint = answer.slice(0, half); cb.sendNotice(`Hint: ${hint}`); } }) function randomNum(min, max) { return Math.floor(Math.random() * (max - min)) + min; } function shuffle(a) { var j, x, i; for (i = a.length - 1; i > 0; i--) { j = Math.floor(Math.random() * (i + 1)); x = a[i]; a[i] = a[j]; a[j] = x; } return a; } function play(topic, mode) { if (Object.keys(trivia_questions[topic]).length == 0) { cb.sendNotice("No more questions for this topic.", "", "#fff", "#C71393"); return } var keys = Object.keys(trivia_questions[topic]); question = keys[randomNum(0, keys.length - 1)]; cb.sendNotice(question, "", "#fff", "#C71393"); if (mode == "easy") { var options = []; for (var i = 0; i < 3; i++) { options.push(`(${trivia_questions[topic][keys[randomNum(0, keys.length - 1)]]})`); } options.push(`(${trivia_questions[topic][question]})`); shuffle(options); cb.sendNotice(`Options: ${options}`, "", "#fff", "#C71393"); } answer = trivia_questions[topic][question]; }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.