uopspop

Untitled

Dec 11th, 2019
431
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var questions = [
  2.     {
  3.         "Reindeer have very thick coats, how many hairs per square inch do they have?": [
  4.             "13,000",
  5.             "1,200",
  6.             "5,000",
  7.             "700",
  8.             "1,000",
  9.             "120,000"
  10.         ]
  11.     },
  12.     {
  13.         "The 1964 classic Rudolph The Red Nosed Reindeer was filmed in:": [
  14.             "Japan",
  15.             "United States",
  16.             "Finland",
  17.             "Germany"
  18.         ]
  19.     },
  20.     {
  21.         "Santas reindeer are cared for by one of the Christmas elves, what is his name?": [
  22.             "Wunorse Openslae",
  23.             "Alabaster Snowball",
  24.             "Bushy Evergreen",
  25.             "Pepper Minstix"
  26.         ]
  27.     },
  28.     {
  29.         "If all of Santas reindeer had antlers while pulling his Christmas sleigh, they would all be:": [
  30.             "Girls",
  31.             "Boys",
  32.             "Girls and boys",
  33.             "No way to tell"
  34.         ]
  35.     },
  36.     {
  37.         "What do Reindeer eat?": [
  38.             "Lichen",
  39.             "Grasses",
  40.             "Leaves",
  41.             "Berries"
  42.         ]
  43.     },
  44.     {
  45.         "What of the following is not true?": [
  46.             "Caribou live on all continents",
  47.             "Both reindeer and Caribou are the same species",
  48.             "Caribou are bigger than reindeer",
  49.             "Reindeer live in Scandinavia and Russia"
  50.         ]
  51.     },
  52.     {
  53.         "In what year did Rudolph make his television debut?": [
  54.             "1964",
  55.             "1979",
  56.             "2000",
  57.             "1956"
  58.         ]
  59.     },
  60.     {
  61.         "Who was the voice of Rudolph in the 1964 classic?": [
  62.             "Billie Mae Richards",
  63.             "Burl Ives",
  64.             "Paul Soles",
  65.             "Lady Gaga"
  66.         ]
  67.     },
  68.     {
  69.         "In 1939 what retailer used the story of Rudolph the Red Nose Reindeer?": [
  70.             "Montgomery Ward",
  71.             "Sears",
  72.             "Macys",
  73.             "Kmart"
  74.         ]
  75.     },
  76.     {
  77.         "Santa's reindeer named Donner was originally named what?": [
  78.             "Dunder",
  79.             "Donny",
  80.             "Dweedle",
  81.             "Dreamy"
  82.         ]
  83.     },
  84.     {
  85.         "Who invented the story of Rudolph?": [
  86.             "Robert May",
  87.             "Johnny Marks",
  88.             "Santa",
  89.             "J.K. Rowling"
  90.         ]
  91.     },
  92.     {
  93.         "In what location will you not find reindeer?": [
  94.             "North Pole",
  95.             "Lapland",
  96.             "Korvatunturi mountain",
  97.             "Finland"
  98.         ]
  99.     },
  100.     {
  101.         "What Makes Santa's Reindeer Fly?": [
  102.             "Magical Reindeer Dust",
  103.             "Fusion",
  104.             "Amanita muscaria",
  105.             "Elves"
  106.         ]
  107.     },
  108.     {
  109.         "Including Rudolph, how many reindeer hooves are there?": [
  110.             "36",
  111.             "24",
  112.             "16",
  113.             "8"
  114.         ]
  115.     },
  116.     {
  117.         "Santa only has one female reindeer. Which one is it?": [
  118.             "Vixen",
  119.             "Clarice",
  120.             "Cupid",
  121.             "Cupid"
  122.         ]
  123.     },
  124.     {
  125.         "In the 1964 classic Rudolph The Red Nosed Reindeer, what was the snowman narrators name?": [
  126.             "Sam",
  127.             "Frosty",
  128.             "Burl",
  129.             "Snowy"
  130.         ]
  131.     },
  132.     {
  133.         "What was Rudolph's father's name?": [
  134.             "Donner",
  135.             "Dasher",
  136.             "Blixen",
  137.             "Comet"
  138.         ]
  139.     },
  140.     {
  141.         "In the 1964 movie, What was the name of the coach of the Reindeer Games?": [
  142.             "Comet",
  143.             "Blixen",
  144.             "Donner",
  145.             "Dasher"
  146.         ]
  147.     },
  148.     {
  149.         "In the 1964 movie, what is the name of the deer that Rudolph befriends at the reindeer games?": [
  150.             "Fireball",
  151.             "Clarice",
  152.             "Jumper",
  153.             "Vixen"
  154.         ]
  155.     },
  156.     {
  157.         "In the 1964 movie, How did Donner, Rudolph's father, try to hide Rudolph's nose?": [
  158.             "Black mud",
  159.             "Bag",
  160.             "Pillow case",
  161.             "Sock"
  162.         ]
  163.     },
  164.     {
  165.         "In the 1964 movie, what does the Misfit Elf want to be instead of a Santa Elf?": [
  166.             "Dentist",
  167.             "Reindeer",
  168.             "Toy maker",
  169.             "Candlestick maker"
  170.         ]
  171.     },
  172.     {
  173.         "In the 1964 movie,what was the Bumble's one weakness?": [
  174.             "Could not swim",
  175.             "Always hungry",
  176.             "Candy canes",
  177.             "Cross eyed"
  178.         ]
  179.     },
  180.     {
  181.         "In the 1964 movie, what is Yukon Cornelius really in search of?": [
  182.             "Peppermint",
  183.             "Gold",
  184.             "India",
  185.             "Polar Bears"
  186.         ]
  187.     },
  188.     {
  189.         "In the 1964 movie, why is the train on the Island of Misfit Toys?": [
  190.             "Square wheels",
  191.             "No Engine",
  192.             "Paint does not match",
  193.             "It does not toot"
  194.         ]
  195.     },
  196.     {
  197.         "In the 1964 movie, what is the name of the Jack in the Box?": [
  198.             "Charlie",
  199.             "Sam",
  200.             "Billy",
  201.             "Jack"
  202.         ]
  203.     },
  204.     {
  205.         "In the 1964 movie, why did Santa Claus almost cancel Christmas?": [
  206.             "Storm",
  207.             "No snow",
  208.             "No toys",
  209.             "The Reindeer were sick"
  210.         ]
  211.     },
  212.     {
  213.         "In the 1964 movie, what animal noise did the elf make to distract the Bumble?": [
  214.             "Oink",
  215.             "Growl",
  216.             "Bark",
  217.             "Meow"
  218.         ]
  219.     },
  220.     {
  221.         "In the 1964 movie, what is the name of the prospector?": [
  222.             "Yukon Cornelius",
  223.             "Slider Sam",
  224.             "Bumble",
  225.             "Jack"
  226.         ]
  227.     },
  228.     {
  229.         "How far do reindeer travel when they migrate?": [
  230.             "3000 miles",
  231.             "700 miles",
  232.             "500 miles",
  233.             "0 miles"
  234.         ]
  235.     },
  236.     {
  237.         "How fast can a reindeer run?": [
  238.             "48 miles per hour",
  239.             "17 miles per hour",
  240.             "19 miles per hour",
  241.             "14 miles per hour"
  242.         ]
  243.     }
  244. ];
  245.  
  246.  
  247. // Route the incoming request based on type (LaunchRequest, IntentRequest,
  248. // etc.) The JSON body of the request is provided in the event parameter.
  249.  
  250. exports.handler = function (event, context) {
  251.  
  252.     try {
  253.  
  254.         console.log("event.session.application.applicationId=" + event.session.application.applicationId);
  255.  
  256.         /**
  257.         *Uncomment this if statement and populate with your skill's application ID to
  258.         *prevent someone else from configuring a skill that sends requests to this function.
  259.         */
  260.  
  261.         // if (event.session.application.applicationId !== "amzn1.echo-sdk-ams.app.05aecccb3-1461-48fb-a008-822ddrt6b516") {
  262.         // context.fail("Invalid Application ID");
  263.         // }
  264.  
  265.         if (event.session.new) {
  266.             onSessionStarted({ requestId: event.request.requestId }, event.session);
  267.         }
  268.  
  269.         if (event.request.type === "LaunchRequest") {
  270.             onLaunch(event.request,
  271.                 event.session,
  272.                 function callback(sessionAttributes, speechletResponse) {
  273.                     context.succeed(buildResponse(sessionAttributes, speechletResponse));
  274.                 });
  275.         } else if (event.request.type === "IntentRequest") {
  276.             onIntent(event.request,
  277.                 event.session,
  278.                 function callback(sessionAttributes, speechletResponse) {
  279.                     context.succeed(buildResponse(sessionAttributes, speechletResponse));
  280.                 });
  281.         } else if (event.request.type === "SessionEndedRequest") {
  282.             onSessionEnded(event.request, event.session);
  283.             context.succeed();
  284.         }
  285.     } catch (e) {
  286.         context.fail("Exception: " + e);
  287.     }
  288. };
  289.  
  290. /**
  291.  * Called when the session starts.
  292.  */
  293. function onSessionStarted(sessionStartedRequest, session) {
  294.     console.log("onSessionStarted requestId=" + sessionStartedRequest.requestId
  295.         + ", sessionId=" + session.sessionId);
  296.  
  297.     // add any session init logic here
  298. }
  299.  
  300. /**
  301.  * Called when the user invokes the skill without specifying what they want.
  302.  */
  303. function onLaunch(launchRequest, session, callback) {
  304.     console.log("onLaunch requestId=" + launchRequest.requestId
  305.         + ", sessionId=" + session.sessionId);
  306.  
  307.     getWelcomeResponse(callback);
  308. }
  309.  
  310. /**
  311.  * Called when the user specifies an intent for this skill.
  312.  */
  313. function onIntent(intentRequest, session, callback) {
  314.     console.log("onIntent requestId=" + intentRequest.requestId
  315.         + ", sessionId=" + session.sessionId);
  316.  
  317.     var intent = intentRequest.intent,
  318.         intentName = intentRequest.intent.name;
  319.  
  320.     // handle yes/no intent after the user has been prompted
  321.     if (session.attributes && session.attributes.userPromptedToContinue) {
  322.         delete session.attributes.userPromptedToContinue;
  323.         if ("AMAZON.NoIntent" === intentName) {
  324.             handleFinishSessionRequest(intent, session, callback);
  325.         } else if ("AMAZON.YesIntent" === intentName) {
  326.             handleRepeatRequest(intent, session, callback);
  327.         }
  328.     }
  329.  
  330.     // dispatch custom intents to handlers here
  331.     if ("AnswerIntent" === intentName) {
  332.         handleAnswerRequest(intent, session, callback);
  333.     } else if ("AnswerOnlyIntent" === intentName) {
  334.         handleAnswerRequest(intent, session, callback);
  335.     } else if ("DontKnowIntent" === intentName) {
  336.         handleAnswerRequest(intent, session, callback);
  337.     } else if ("AMAZON.YesIntent" === intentName) {
  338.         handleAnswerRequest(intent, session, callback);
  339.     } else if ("AMAZON.NoIntent" === intentName) {
  340.         handleAnswerRequest(intent, session, callback);
  341.     } else if ("AMAZON.StartOverIntent" === intentName) {
  342.         getWelcomeResponse(callback);
  343.     } else if ("AMAZON.RepeatIntent" === intentName) {
  344.         handleRepeatRequest(intent, session, callback);
  345.     } else if ("AMAZON.HelpIntent" === intentName) {
  346.         handleGetHelpRequest(intent, session, callback);
  347.     } else if ("AMAZON.StopIntent" === intentName) {
  348.         handleFinishSessionRequest(intent, session, callback);
  349.     } else if ("AMAZON.CancelIntent" === intentName) {
  350.         handleFinishSessionRequest(intent, session, callback);
  351.     } else if ("AnswerNoMeaning" === intentName) {
  352.         handleAnswerRequest(intent, session, callback);
  353.     } else {
  354.         throw "Invalid intent";
  355.     }
  356. }
  357.  
  358. /**
  359.  * Called when the user ends the session.
  360.  * Is not called when the skill returns shouldEndSession=true.
  361.  */
  362. function onSessionEnded(sessionEndedRequest, session) {
  363.     console.log("onSessionEnded requestId=" + sessionEndedRequest.requestId
  364.         + ", sessionId=" + session.sessionId);
  365.  
  366.     // Add any cleanup logic here
  367. }
  368.  
  369. // ------- Skill specific business logic -------
  370.  
  371. var ANSWER_COUNT = 4;
  372.  
  373. var GAME_LENGTH = 5;
  374.  
  375. var CARD_TITLE = "Trivia"; // Be sure to change this for your skill.
  376.  
  377. function getWelcomeResponse(callback) {
  378.  
  379.     var sessionAttributes = {},
  380.  
  381.         speechOutput = "I will ask you " + GAME_LENGTH.toString()
  382.  
  383.             + " questions, try to get as many right as you can. Just say the number of the answer. Let's begin. ",
  384.  
  385.         shouldEndSession = false,
  386.  
  387.         gameQuestions = populateGameQuestions(),
  388.         correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT)), // Generate a random index for the correct answer, from 0 to 3
  389.         roundAnswers = populateRoundAnswers(gameQuestions, 0, correctAnswerIndex),
  390.  
  391.         currentQuestionIndex = 0,
  392.         spokenQuestion = Object.keys(questions[gameQuestions[currentQuestionIndex]])[0],
  393.         repromptText = "Question 1. " + spokenQuestion + " ",
  394.  
  395.         i, j;
  396.  
  397.     for (i = 0; i < ANSWER_COUNT; i++) {
  398.         repromptText += (i + 1).toString() + ". " + roundAnswers[i] + ". "
  399.     }
  400.     speechOutput += repromptText;
  401.     sessionAttributes = {
  402.         "speechOutput": repromptText,
  403.         "repromptText": repromptText,
  404.         "currentQuestionIndex": currentQuestionIndex,
  405.         "correctAnswerIndex": correctAnswerIndex + 1,
  406.         "questions": gameQuestions,
  407.         "score": 0,
  408.         "correctAnswerText":
  409.             questions[gameQuestions[currentQuestionIndex]][Object.keys(questions[gameQuestions[currentQuestionIndex]])[0]][0]
  410.     };
  411.     callback(sessionAttributes,
  412.         buildSpeechletResponse(CARD_TITLE, speechOutput, repromptText, shouldEndSession));
  413. }
  414.  
  415. function populateGameQuestions() {
  416.     var gameQuestions = [];
  417.     var indexList = [];
  418.     var index = questions.length;
  419.  
  420.     if (GAME_LENGTH > index) {
  421.         throw "Invalid Game Length.";
  422.     }
  423.  
  424.     for (var i = 0; i < questions.length; i++) {
  425.         indexList.push(i);
  426.     }
  427.  
  428.     // Pick GAME_LENGTH random questions from the list to ask the user, make sure there are no repeats.
  429.     for (var j = 0; j < GAME_LENGTH; j++) {
  430.         var rand = Math.floor(Math.random() * index);
  431.         index -= 1;
  432.  
  433.         var temp = indexList[index];
  434.         indexList[index] = indexList[rand];
  435.         indexList[rand] = temp;
  436.         gameQuestions.push(indexList[index]);
  437.     }
  438.  
  439.     return gameQuestions;
  440. }
  441.  
  442. function populateRoundAnswers(gameQuestionIndexes, correctAnswerIndex, correctAnswerTargetLocation) {
  443.     // Get the answers for a given question, and place the correct answer at the spot marked by the
  444.     // correctAnswerTargetLocation variable. Note that you can have as many answers as you want but
  445.     // only ANSWER_COUNT will be selected.
  446.     var answers = [],
  447.         answersCopy = questions[gameQuestionIndexes[correctAnswerIndex]][Object.keys(questions[gameQuestionIndexes[correctAnswerIndex]])[0]],
  448.         temp, i;
  449.  
  450.     var index = answersCopy.length;
  451.  
  452.     if (index < ANSWER_COUNT) {
  453.         throw "Not enough answers for question.";
  454.     }
  455.  
  456.     // Shuffle the answers, excluding the first element.
  457.     for (var j = 1; j < answersCopy.length; j++) {
  458.         var rand = Math.floor(Math.random() * (index - 1)) + 1;
  459.         index -= 1;
  460.  
  461.         var temp = answersCopy[index];
  462.         answersCopy[index] = answersCopy[rand];
  463.         answersCopy[rand] = temp;
  464.     }
  465.  
  466.     // Swap the correct answer into the target location
  467.     for (i = 0; i < ANSWER_COUNT; i++) {
  468.         answers[i] = answersCopy[i];
  469.     }
  470.     temp = answers[0];
  471.     answers[0] = answers[correctAnswerTargetLocation];
  472.     answers[correctAnswerTargetLocation] = temp;
  473.     return answers;
  474. }
  475.  
  476. function handleAnswerRequest(intent, session, callback) {
  477.     var speechOutput = "";
  478.     var sessionAttributes = {};
  479.     var gameInProgress = session.attributes && session.attributes.questions;
  480.     var answerSlotValid = isAnswerSlotValid(intent);
  481.     var userGaveUp = intent.name === "DontKnowIntent";
  482.  
  483.     if (!gameInProgress) {
  484.         // If the user responded with an answer but there is no game in progress, ask the user
  485.         // if they want to start a new game. Set a flag to track that we've prompted the user.
  486.         sessionAttributes.userPromptedToContinue = true;
  487.         speechOutput = "There is no game in progress. Do you want to start a new game? ";
  488.         callback(sessionAttributes,
  489.             buildSpeechletResponse(CARD_TITLE, speechOutput, speechOutput, false));
  490.     } else if (intent.name === "AnswerNoMeaning") {
  491.         // This is my try for this function
  492.         var reprompt = session.attributes.speechOutput;
  493.         var speechOutput = "Please give it a try";
  494.         callback(session.attributes,
  495.             buildSpeechletResponse(CARD_TITLE, speechOutput, reprompt, false));
  496.     } else if (!answerSlotValid && !userGaveUp) {
  497.         // If the user provided answer isn't a number > 0 and < ANSWER_COUNT,
  498.         // return an error message to the user. Remember to guide the user into providing correct values.
  499.         var reprompt = session.attributes.speechOutput;
  500.         var speechOutput = "Your answer must be a number between 1 and " + ANSWER_COUNT + ". " + reprompt;
  501.         callback(session.attributes,
  502.             buildSpeechletResponse(CARD_TITLE, speechOutput, reprompt, false));
  503.     } else {
  504.         var gameQuestions = session.attributes.questions,
  505.             correctAnswerIndex = parseInt(session.attributes.correctAnswerIndex),
  506.             currentScore = parseInt(session.attributes.score),
  507.             currentQuestionIndex = parseInt(session.attributes.currentQuestionIndex),
  508.             correctAnswerText = session.attributes.correctAnswerText;
  509.  
  510.         var speechOutputAnalysis = "";
  511.  
  512.         if (answerSlotValid && parseInt(intent.slots.Answer.value) == correctAnswerIndex) {
  513.             currentScore++;
  514.             speechOutputAnalysis = "correct. ";
  515.         } else {
  516.             if (!userGaveUp) {
  517.                 speechOutputAnalysis = "wrong. "
  518.             }
  519.             speechOutputAnalysis += "The correct answer is " + correctAnswerIndex + ": " + correctAnswerText + ". ";
  520.         }
  521.         // if currentQuestionIndex is 4, we've reached 5 questions (zero-indexed) and can exit the game session
  522.         if (currentQuestionIndex == GAME_LENGTH - 1) {
  523.             speechOutput = userGaveUp ? "" : "That answer is ";
  524.             speechOutput += speechOutputAnalysis + "You got " + currentScore.toString() + " out of "
  525.                 + GAME_LENGTH.toString() + " questions correct. Thank you for playing!";
  526.             callback(session.attributes,
  527.                 buildSpeechletResponse(CARD_TITLE, speechOutput, "", true));
  528.         } else {
  529.             currentQuestionIndex += 1;
  530.             var spokenQuestion = Object.keys(questions[gameQuestions[currentQuestionIndex]])[0];
  531.             // Generate a random index for the correct answer, from 0 to 3
  532.             correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT));
  533.             var roundAnswers = populateRoundAnswers(gameQuestions, currentQuestionIndex, correctAnswerIndex),
  534.  
  535.                 questionIndexForSpeech = currentQuestionIndex + 1,
  536.                 repromptText = "Question " + questionIndexForSpeech.toString() + ". " + spokenQuestion + " ";
  537.             for (var i = 0; i < ANSWER_COUNT; i++) {
  538.                 repromptText += (i + 1).toString() + ". " + roundAnswers[i] + ". "
  539.             }
  540.             speechOutput += userGaveUp ? "" : "That answer is ";
  541.             speechOutput += speechOutputAnalysis + "Your score is " + currentScore.toString() + ". " + repromptText;
  542.  
  543.             sessionAttributes = {
  544.                 "speechOutput": repromptText,
  545.                 "repromptText": repromptText,
  546.                 "currentQuestionIndex": currentQuestionIndex,
  547.                 "correctAnswerIndex": correctAnswerIndex + 1,
  548.                 "questions": gameQuestions,
  549.                 "score": currentScore,
  550.                 "correctAnswerText":
  551.                     questions[gameQuestions[currentQuestionIndex]][Object.keys(questions[gameQuestions[currentQuestionIndex]])[0]][0]
  552.             };
  553.             callback(sessionAttributes,
  554.                 buildSpeechletResponse(CARD_TITLE, speechOutput, repromptText, false));
  555.         }
  556.     }
  557. }
  558.  
  559. function handleRepeatRequest(intent, session, callback) {
  560.     // Repeat the previous speechOutput and repromptText from the session attributes if available
  561.     // else start a new game session
  562.     if (!session.attributes || !session.attributes.speechOutput) {
  563.         getWelcomeResponse(callback);
  564.     } else {
  565.         callback(session.attributes,
  566.             buildSpeechletResponseWithoutCard(session.attributes.speechOutput, session.attributes.repromptText, false));
  567.     }
  568. }
  569.  
  570. function handleGetHelpRequest(intent, session, callback) {
  571.     // Provide a help prompt for the user, explaining how the game is played. Then, continue the game
  572.     // if there is one in progress, or provide the option to start another one.
  573.  
  574.     // Set a flag to track that we're in the Help state.
  575.     session.attributes.userPromptedToContinue = true;
  576.  
  577.     // Do not edit the help dialogue. This has been created by the Alexa team to demonstrate best practices.
  578.  
  579.     var speechOutput = "I will ask you " + GAME_LENGTH + " multiple choice questions. Respond with the number of the answer. "
  580.         + "For example, say one, two, three, or four. To start a new game at any time, say, start game. "
  581.         + "To repeat the last question, say, repeat. "
  582.         + "Would you like to keep playing?",
  583.         repromptText = "To give an answer to a question, respond with the number of the answer . "
  584.             + "Would you like to keep playing?";
  585.     var shouldEndSession = false;
  586.     callback(session.attributes,
  587.         buildSpeechletResponseWithoutCard(speechOutput, repromptText, shouldEndSession));
  588. }
  589.  
  590. function handleFinishSessionRequest(intent, session, callback) {
  591.     // End the session with a "Good bye!" if the user wants to quit the game
  592.     callback(session.attributes,
  593.         buildSpeechletResponseWithoutCard("Good bye!", "", true));
  594. }
  595.  
  596. function isAnswerSlotValid(intent) {
  597.     var answerSlotFilled = intent.slots && intent.slots.Answer && intent.slots.Answer.value;
  598.     var answerSlotIsInt = answerSlotFilled && !isNaN(parseInt(intent.slots.Answer.value));
  599.     return answerSlotIsInt && parseInt(intent.slots.Answer.value) < (ANSWER_COUNT + 1) && parseInt(intent.slots.Answer.value) > 0;
  600. }
  601.  
  602. // ------- Helper functions to build responses -------
  603.  
  604. function buildSpeechletResponse(title, output, repromptText, shouldEndSession) {
  605.  
  606.     return {
  607.         outputSpeech: {
  608.             type: "PlainText",
  609.             text: output
  610.         },
  611.         card: {
  612.             type: "Simple",
  613.             title: title,
  614.             content: output
  615.         },
  616.         reprompt: {
  617.             outputSpeech: {
  618.                 type: "PlainText",
  619.                 text: repromptText
  620.             }
  621.         },
  622.         shouldEndSession: shouldEndSession
  623.     };
  624.  
  625. }
  626.  
  627. function buildSpeechletResponseWithoutCard(output, repromptText, shouldEndSession) {
  628.  
  629.     return {
  630.         outputSpeech: {
  631.             type: "PlainText",
  632.             text: output
  633.         },
  634.         reprompt: {
  635.             outputSpeech: {
  636.                 type: "PlainText",
  637.                 text: repromptText
  638.             }
  639.         },
  640.         shouldEndSession: shouldEndSession
  641.     };
  642.  
  643. }
  644.  
  645. function buildResponse(sessionAttributes, speechletResponse) {
  646.  
  647.     return {
  648.         version: "1.0",
  649.         sessionAttributes: sessionAttributes,
  650.         response: speechletResponse
  651.     };
  652. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×