Last active
February 1, 2020 05:05
-
-
Save softwarechido/761d93fb81a82b5c58f3a7c41633ff9b to your computer and use it in GitHub Desktop.
Trivia de México - Skill de Ejemplo para crear skills de trivia. Para generar las preguntas, visita: http://softwarechido.com/alexa/trivia/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |
// Licensed under the Amazon Software License | |
// http://aws.amazon.com/asl/ | |
//Lambda | |
/* eslint-disable func-names */ | |
/* eslint-disable no-console */ | |
const Alexa = require('ask-sdk-core'); | |
const questions = require('./questions'); | |
const i18n = require('i18next'); | |
const sprintf = require('i18next-sprintf-postprocessor'); | |
const ANSWER_COUNT = 4; | |
const GAME_LENGTH = 5; | |
const SKILL_NAME = 'Trivia de México'; | |
const FALLBACK_MESSAGE = 'Recuerda, en esta skill yo te hago preguntas y respondes con el número de tu respuesta. Dime repite para volver a preguntarte o puedes iniciar un juego nuevo. ¿Cómo te puedo ayudar?'; | |
const FALLBACK_REPROMPT = '¿Cómo te puedo ayudar?'; | |
const languageString = { | |
es: { | |
translation: { | |
QUESTIONS: questions.QUESTIONS_ES_MX, | |
GAME_NAME: 'Trivia de México', | |
HELP_MESSAGE: 'Te haré %s preguntas de opción múltiple. Responde con el número de la respuesta. Para iniciar un juego nuevo di, comenzar juego. ¿Cómo te puedo ayudar?', | |
REPEAT_QUESTION_MESSAGE: 'Para repetir la última pregunta dime: repíte', | |
ASK_MESSAGE_START: 'Te gustaría comenzar a jugar?', | |
HELP_REPROMPT: 'Para responder simplemente dime el número de tu respuesta', | |
STOP_MESSAGE: 'Ok, jugaremos en otra ocasión', | |
CANCEL_MESSAGE: 'Ok, jugaremos en otra ocasión', | |
NO_MESSAGE: 'Ok, regresa pronto. ¡Adios!', | |
TRIVIA_UNHANDLED: 'Intenta diciendo un número entre 1 y %s', | |
HELP_UNHANDLED: 'Dime si para continuar, no para terminar el juego', | |
START_UNHANDLED: 'Dime comenzar para iniciar el juego', | |
NEW_GAME_MESSAGE: 'Bienvenido a %s. ', | |
WELCOME_MESSAGE: 'Yo te haré %s preguntas, intenta adivinar la respuesta correcta diciendo el número de la respuesta, comencemos. ', | |
ANSWER_CORRECT_MESSAGE: 'correcta. ', | |
ANSWER_WRONG_MESSAGE: 'incorrecta. ', | |
CORRECT_ANSWER_MESSAGE: 'La respuesta correcta es %s: %s. ', | |
ANSWER_IS_MESSAGE: 'Esa respuesta es ', | |
TELL_QUESTION_MESSAGE: 'Pregunta %s. %s ', | |
GAME_OVER_MESSAGE1: 'Has obtenido %s respuesta correcta de %s preguntas. ¡Gracias por jugar conmigo!', | |
GAME_OVER_MESSAGE: 'Has obtenido %s respuestas correctas de %s preguntas. ¡Gracias por jugar conmigo!', | |
SCORE_IS_MESSAGE: 'Tu puntuación es %s. ' | |
}, | |
}, | |
'es-es': { | |
translation: { | |
QUESTIONS: questions.QUESTIONS_ES_ES, | |
GAME_NAME: 'Trivia de México en España', | |
WELCOME_MESSAGE: 'Yo te haré %s preguntas sobre las capitales de estados mexicanos, intenta adivinar la respuesta correcta diciendo el número de la respuesta, comencemos. ', | |
}, | |
}, | |
}; | |
function populateGameQuestions(translatedQuestions) { | |
const gameQuestions = []; | |
const indexList = []; | |
let index = translatedQuestions.length; | |
if (GAME_LENGTH > index) { | |
throw new Error('Longitud de Juego Inválida'); | |
} | |
for (let i = 0; i < translatedQuestions.length; i += 1) { | |
indexList.push(i); | |
} | |
for (let j = 0; j < GAME_LENGTH; j += 1) { | |
const rand = Math.floor(Math.random() * index); | |
index -= 1; | |
const temp = indexList[index]; | |
indexList[index] = indexList[rand]; | |
indexList[rand] = temp; | |
gameQuestions.push(indexList[index]); | |
} | |
return gameQuestions; | |
} | |
function populateRoundAnswers( gameQuestionIndexes, correctAnswerIndex, correctAnswerTargetLocation, translatedQuestions) { | |
const answers = []; | |
const translatedQuestion = translatedQuestions[gameQuestionIndexes[correctAnswerIndex]]; | |
const answersCopy = translatedQuestion[Object.keys(translatedQuestion)[0]].slice(); | |
let index = answersCopy.length; | |
if (index < ANSWER_COUNT) { | |
throw new Error('No hay suficiente respuestas para la pregunta'); | |
} | |
// Shuffle the answers, excluding the first element which is the correct answer. | |
for (let j = 1; j < answersCopy.length; j += 1) { | |
const rand = Math.floor(Math.random() * (index - 1)) + 1; | |
index -= 1; | |
const swapTemp1 = answersCopy[index]; | |
answersCopy[index] = answersCopy[rand]; | |
answersCopy[rand] = swapTemp1; | |
} | |
// Swap the correct answer into the target location | |
for (let i = 0; i < ANSWER_COUNT; i += 1) { | |
answers[i] = answersCopy[i]; | |
} | |
const swapTemp2 = answers[0]; | |
answers[0] = answers[correctAnswerTargetLocation]; | |
answers[correctAnswerTargetLocation] = swapTemp2; | |
return answers; | |
} | |
function isAnswerSlotValid(intent) { | |
const answerSlotFilled = intent | |
&& intent.slots | |
&& intent.slots.Answer | |
&& intent.slots.Answer.value; | |
const answerSlotIsInt = answerSlotFilled | |
&& !Number.isNaN(parseInt(intent.slots.Answer.value, 10)); | |
return answerSlotIsInt | |
&& parseInt(intent.slots.Answer.value, 10) < (ANSWER_COUNT + 1) | |
&& parseInt(intent.slots.Answer.value, 10) > 0; | |
} | |
function handleUserGuess(userGaveUp, handlerInput) { | |
const { requestEnvelope, attributesManager, responseBuilder } = handlerInput; | |
const { intent } = requestEnvelope.request; | |
const answerSlotValid = isAnswerSlotValid(intent); | |
let speechOutput = ''; | |
let speechOutputAnalysis = ''; | |
const sessionAttributes = attributesManager.getSessionAttributes(); | |
const gameQuestions = sessionAttributes.questions; | |
let correctAnswerIndex = parseInt(sessionAttributes.correctAnswerIndex, 10); | |
let currentScore = parseInt(sessionAttributes.score, 10); | |
let currentQuestionIndex = parseInt(sessionAttributes.currentQuestionIndex, 10); | |
const { correctAnswerText } = sessionAttributes; | |
const requestAttributes = attributesManager.getRequestAttributes(); | |
const translatedQuestions = requestAttributes.t('QUESTIONS'); | |
if (answerSlotValid | |
&& parseInt(intent.slots.Answer.value, 10) === sessionAttributes.correctAnswerIndex) { | |
currentScore += 1; | |
speechOutputAnalysis = requestAttributes.t('ANSWER_CORRECT_MESSAGE'); | |
} else { | |
if (!userGaveUp) { | |
speechOutputAnalysis = requestAttributes.t('ANSWER_WRONG_MESSAGE'); | |
} | |
speechOutputAnalysis += requestAttributes.t( | |
'CORRECT_ANSWER_MESSAGE', | |
correctAnswerIndex, | |
correctAnswerText | |
); | |
} | |
// Check if we can exit the game session after GAME_LENGTH questions (zero-indexed) | |
if (sessionAttributes.currentQuestionIndex === GAME_LENGTH - 1) { | |
speechOutput = userGaveUp ? '' : requestAttributes.t('ANSWER_IS_MESSAGE'); | |
if (currentScore===1){ | |
speechOutput += speechOutputAnalysis + requestAttributes.t( | |
'GAME_OVER_MESSAGE1', | |
currentScore.toString(), | |
GAME_LENGTH.toString()); | |
} | |
else{ | |
speechOutput += speechOutputAnalysis + requestAttributes.t( | |
'GAME_OVER_MESSAGE1', | |
currentScore.toString(), | |
GAME_LENGTH.toString()); | |
} | |
return responseBuilder | |
.speak(speechOutput) | |
.withShouldEndSession(true) | |
.getResponse(); | |
} | |
currentQuestionIndex += 1; | |
correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT)); | |
const spokenQuestion = Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0]; | |
const roundAnswers = populateRoundAnswers( | |
gameQuestions, | |
currentQuestionIndex, | |
correctAnswerIndex, | |
translatedQuestions | |
); | |
const questionIndexForSpeech = currentQuestionIndex + 1; | |
let repromptText = requestAttributes.t( | |
'TELL_QUESTION_MESSAGE', | |
questionIndexForSpeech.toString(), | |
spokenQuestion | |
); | |
for (let i = 0; i < ANSWER_COUNT; i += 1) { | |
repromptText += `${i + 1}. ${roundAnswers[i]}. `; | |
} | |
speechOutput += userGaveUp ? '' : requestAttributes.t('ANSWER_IS_MESSAGE'); | |
speechOutput += speechOutputAnalysis | |
+ requestAttributes.t('SCORE_IS_MESSAGE', currentScore.toString()) | |
+ repromptText; | |
const translatedQuestion = translatedQuestions[gameQuestions[currentQuestionIndex]]; | |
Object.assign(sessionAttributes, { | |
speechOutput: repromptText, | |
repromptText, | |
currentQuestionIndex, | |
correctAnswerIndex: correctAnswerIndex + 1, | |
questions: gameQuestions, | |
score: currentScore, | |
correctAnswerText: translatedQuestion[Object.keys(translatedQuestion)[0]][0] | |
}); | |
return responseBuilder.speak(speechOutput) | |
.reprompt(repromptText) | |
.withSimpleCard(requestAttributes.t('GAME_NAME'), repromptText) | |
.getResponse(); | |
} | |
function startGame(newGame, handlerInput) { | |
const requestAttributes = handlerInput.attributesManager.getRequestAttributes(); | |
let speechOutput = newGame | |
? requestAttributes.t('NEW_GAME_MESSAGE', requestAttributes.t('GAME_NAME')) | |
+ requestAttributes.t('WELCOME_MESSAGE', GAME_LENGTH.toString()) | |
: ''; | |
const translatedQuestions = requestAttributes.t('QUESTIONS'); | |
const gameQuestions = populateGameQuestions(translatedQuestions); | |
const correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT)); | |
const roundAnswers = populateRoundAnswers( | |
gameQuestions, | |
0, | |
correctAnswerIndex, | |
translatedQuestions | |
); | |
const currentQuestionIndex = 0; | |
const spokenQuestion = Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0]; | |
let repromptText = requestAttributes.t('TELL_QUESTION_MESSAGE', '1', spokenQuestion); | |
for (let i = 0; i < ANSWER_COUNT; i += 1) { | |
repromptText += `${i + 1}. ${roundAnswers[i]}. `; | |
} | |
speechOutput += repromptText; | |
const sessionAttributes = {}; | |
const translatedQuestion = translatedQuestions[gameQuestions[currentQuestionIndex]]; | |
Object.assign(sessionAttributes, { | |
speechOutput: repromptText, | |
repromptText, | |
currentQuestionIndex, | |
correctAnswerIndex: correctAnswerIndex + 1, | |
questions: gameQuestions, | |
score: 0, | |
correctAnswerText: translatedQuestion[Object.keys(translatedQuestion)[0]][0] | |
}); | |
handlerInput.attributesManager.setSessionAttributes(sessionAttributes); | |
return handlerInput.responseBuilder | |
.speak(speechOutput) | |
.reprompt(repromptText) | |
.withSimpleCard(requestAttributes.t('GAME_NAME'), repromptText) | |
.getResponse(); | |
} | |
function helpTheUser(newGame, handlerInput) { | |
const requestAttributes = handlerInput.attributesManager.getRequestAttributes(); | |
const askMessage = newGame | |
? requestAttributes.t('ASK_MESSAGE_START') | |
: requestAttributes.t('REPEAT_QUESTION_MESSAGE') + requestAttributes.t('STOP_MESSAGE'); | |
const speechOutput = requestAttributes.t('HELP_MESSAGE', GAME_LENGTH) + askMessage; | |
const repromptText = requestAttributes.t('HELP_REPROMPT') + askMessage; | |
return handlerInput.responseBuilder.speak(speechOutput).reprompt(repromptText).getResponse(); | |
} | |
const LocalizationInterceptor = { | |
process(handlerInput) { | |
const localizationClient = i18n.use(sprintf).init({ | |
lng: handlerInput.requestEnvelope.request.locale, | |
overloadTranslationOptionHandler: sprintf.overloadTranslationOptionHandler, | |
resources: languageString, | |
returnObjects: true | |
}); | |
const attributes = handlerInput.attributesManager.getRequestAttributes(); | |
attributes.t = function (...args) { | |
return localizationClient.t(...args); | |
}; | |
}, | |
}; | |
const LaunchRequest = { | |
canHandle(handlerInput) { | |
const { request } = handlerInput.requestEnvelope; | |
return request.type === 'LaunchRequest' | |
|| (request.type === 'IntentRequest' | |
&& request.intent.name === 'AMAZON.StartOverIntent'); | |
}, | |
handle(handlerInput) { | |
return startGame(true, handlerInput); | |
}, | |
}; | |
const HelpIntent = { | |
canHandle(handlerInput) { | |
const { request } = handlerInput.requestEnvelope; | |
return request.type === 'IntentRequest' && request.intent.name === 'AMAZON.HelpIntent'; | |
}, | |
handle(handlerInput) { | |
const sessionAttributes = handlerInput.attributesManager.getSessionAttributes(); | |
const newGame = !(sessionAttributes.questions); | |
return helpTheUser(newGame, handlerInput); | |
}, | |
}; | |
const FallbackHandler = { | |
canHandle(handlerInput) { | |
const request = handlerInput.requestEnvelope.request; | |
return request.type === 'IntentRequest' | |
&& request.intent.name === 'SimulateFallBackIntent'; | |
}, | |
handle(handlerInput) { | |
return handlerInput.responseBuilder | |
.speak(FALLBACK_MESSAGE) | |
.reprompt(FALLBACK_REPROMPT) | |
.getResponse(); | |
}, | |
}; | |
const UnhandledIntent = { | |
canHandle() { | |
return true; | |
}, | |
handle(handlerInput) { | |
const sessionAttributes = handlerInput.attributesManager.getSessionAttributes(); | |
const requestAttributes = handlerInput.attributesManager.getRequestAttributes(); | |
if (Object.keys(sessionAttributes).length === 0) { | |
const speechOutput = requestAttributes.t('START_UNHANDLED'); | |
return handlerInput.attributesManager | |
.speak(speechOutput) | |
.reprompt(speechOutput) | |
.getResponse(); | |
} else if (sessionAttributes.questions) { | |
const speechOutput = requestAttributes.t('TRIVIA_UNHANDLED', ANSWER_COUNT.toString()); | |
return handlerInput.responseBuilder | |
.speak(speechOutput) | |
.reprompt(speechOutput) | |
.getResponse(); | |
} | |
const speechOutput = requestAttributes.t('HELP_UNHANDLED'); | |
return handlerInput.responseBuilder.speak(speechOutput).reprompt(speechOutput).getResponse(); | |
}, | |
}; | |
const SessionEndedRequest = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'SessionEndedRequest'; | |
}, | |
handle(handlerInput) { | |
console.log(`La sesión se ha finalizado con la razón: ${handlerInput.requestEnvelope.request.reason}`); | |
return handlerInput.responseBuilder.withShouldEndSession(true).getResponse(); | |
}, | |
}; | |
const AnswerIntent = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' | |
&& (handlerInput.requestEnvelope.request.intent.name === 'AnswerIntent' | |
|| handlerInput.requestEnvelope.request.intent.name === 'DontKnowIntent'); | |
}, | |
handle(handlerInput) { | |
if (handlerInput.requestEnvelope.request.intent.name === 'AnswerIntent') { | |
return handleUserGuess(false, handlerInput); | |
} | |
return handleUserGuess(true, handlerInput); | |
}, | |
}; | |
const RepeatIntent = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' | |
&& handlerInput.requestEnvelope.request.intent.name === 'AMAZON.RepeatIntent'; | |
}, | |
handle(handlerInput) { | |
const sessionAttributes = handlerInput.attributesManager.getSessionAttributes(); | |
return handlerInput.responseBuilder.speak(sessionAttributes.speechOutput) | |
.reprompt(sessionAttributes.repromptText) | |
.getResponse(); | |
}, | |
}; | |
const ResumeIntent = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' | |
&& handlerInput.requestEnvelope.request.intent.name === 'AAMAZON.ResumeIntent'; | |
}, | |
handle(handlerInput) { | |
const sessionAttributes = handlerInput.attributesManager.getSessionAttributes(); | |
return handlerInput.responseBuilder.speak(sessionAttributes.speechOutput) | |
.reprompt(sessionAttributes.repromptText) | |
.getResponse(); | |
}, | |
}; | |
const YesIntent = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' | |
&& handlerInput.requestEnvelope.request.intent.name === 'AMAZON.YesIntent'; | |
}, | |
handle(handlerInput) { | |
const sessionAttributes = handlerInput.attributesManager.getSessionAttributes(); | |
if (sessionAttributes.questions) { | |
return handlerInput.responseBuilder.speak(sessionAttributes.speechOutput) | |
.reprompt(sessionAttributes.repromptText) | |
.getResponse(); | |
} | |
return startGame(false, handlerInput); | |
}, | |
}; | |
const StopIntent = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' | |
&& handlerInput.requestEnvelope.request.intent.name === 'AMAZON.StopIntent'; | |
}, | |
handle(handlerInput) { | |
const requestAttributes = handlerInput.attributesManager.getRequestAttributes(); | |
const speechOutput = requestAttributes.t('STOP_MESSAGE'); | |
return handlerInput.responseBuilder.speak(speechOutput) | |
.withShouldEndSession(true) | |
.getResponse(); | |
}, | |
}; | |
const CancelIntent = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' | |
&& handlerInput.requestEnvelope.request.intent.name === 'AMAZON.CancelIntent'; | |
}, | |
handle(handlerInput) { | |
const requestAttributes = handlerInput.attributesManager.getRequestAttributes(); | |
const speechOutput = requestAttributes.t('CANCEL_MESSAGE'); | |
return handlerInput.responseBuilder.speak(speechOutput) | |
.withShouldEndSession(true) | |
.getResponse(); | |
}, | |
}; | |
const NoIntent = { | |
canHandle(handlerInput) { | |
return handlerInput.requestEnvelope.request.type === 'IntentRequest' | |
&& handlerInput.requestEnvelope.request.intent.name === 'AMAZON.NoIntent'; | |
}, | |
handle(handlerInput) { | |
const requestAttributes = handlerInput.attributesManager.getRequestAttributes(); | |
const speechOutput = requestAttributes.t('NO_MESSAGE'); | |
return handlerInput.responseBuilder.speak(speechOutput).withShouldEndSession(true).getResponse(); | |
}, | |
}; | |
const ErrorHandler = { | |
canHandle() { | |
return true; | |
}, | |
handle(handlerInput, error) { | |
console.log(`Error: ${error.message}`); | |
return handlerInput.responseBuilder | |
.speak('Lo siento, no puedo entender el comando. Por favor, intenta de nuevo.') | |
.reprompt('Lo siento, no puedo entender el comando. Por favor, intenta de nuevo.') | |
.getResponse(); | |
}, | |
}; | |
const skillBuilder = Alexa.SkillBuilders.custom(); | |
exports.handler = skillBuilder | |
.addRequestHandlers( | |
LaunchRequest, | |
HelpIntent, | |
AnswerIntent, | |
RepeatIntent, | |
YesIntent, | |
StopIntent, | |
CancelIntent, | |
NoIntent, | |
SessionEndedRequest, | |
FallbackHandler, | |
UnhandledIntent | |
) | |
.addRequestInterceptors(LocalizationInterceptor) | |
.addErrorHandlers(ErrorHandler) | |
.lambda(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"interactionModel": { | |
"languageModel": { | |
"invocationName": "trivia de mexico", | |
"intents": [ | |
{ | |
"name": "AMAZON.CancelIntent", | |
"samples": [] | |
}, | |
{ | |
"name": "AMAZON.HelpIntent", | |
"samples": [] | |
}, | |
{ | |
"name": "AMAZON.StopIntent", | |
"samples": [] | |
}, | |
{ | |
"name": "AnswerIntent", | |
"slots": [ | |
{ | |
"name": "Answer", | |
"type": "AMAZON.NUMBER" | |
} | |
], | |
"samples": [ | |
"mi respuesta es {Answer}", | |
"la respuesta es {Answer}", | |
"es {Answer}", | |
"{Answer} es la respuesta", | |
"{Answer}" | |
] | |
}, | |
{ | |
"name": "DontKnowIntent", | |
"slots": [], | |
"samples": [ | |
"no se ", | |
"no lo se", | |
"sepa", | |
"sepa la bola", | |
"ni idea", | |
"no tengo idea", | |
"quien sabe", | |
"esta no la se" | |
] | |
}, | |
{ | |
"name": "AMAZON.StartOverIntent", | |
"samples": [ | |
"comenzar juego", | |
"quiero iniciar un juego nuevo", | |
"con un juego nuevo", | |
"inicia un juego nuevo", | |
"iniciar juego nuevo", | |
"comienza un juego", | |
"empieza un juego", | |
"juego nuevo", | |
"empieza", | |
"empieza nuevo juego" | |
] | |
}, | |
{ | |
"name": "AMAZON.RepeatIntent", | |
"samples": [] | |
}, | |
{ | |
"name": "AMAZON.YesIntent", | |
"samples": [] | |
}, | |
{ | |
"name": "AMAZON.NoIntent", | |
"samples": [] | |
}, | |
{ | |
"name": "AMAZON.NavigateHomeIntent", | |
"samples": [] | |
}, | |
{ | |
"name": "SimulateFallBackIntent", | |
"slots": [ | |
{ | |
"name": "anything", | |
"type": "AMAZON.SearchQuery" | |
} | |
], | |
"samples": [ | |
"{anything} z", | |
"{anything} y", | |
"{anything} a", | |
"{anything} b", | |
"{anything} c", | |
"{anything} d", | |
"{anything} e", | |
"{anything} f", | |
"{anything} g", | |
"{anything} h", | |
"{anything} i", | |
"{anything} j", | |
"{anything} k", | |
"{anything} l", | |
"{anything} m", | |
"{anything} n", | |
"{anything} o", | |
"{anything} p", | |
"{anything} q", | |
"{anything} r", | |
"{anything} s", | |
"{anything} t", | |
"{anything} u", | |
"{anything} v", | |
"{anything} w", | |
"{anything} x", | |
"ellos", | |
"ustedes ", | |
"nosotros", | |
"tu", | |
"yo", | |
"algo", | |
"lo que sea", | |
"a {anything}" | |
] | |
} | |
], | |
"types": [] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "trivia", | |
"version": "1.1.0", | |
"description": "Skill de Ejemplo para crear Skills de Trivia", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "Amazon Alexa", | |
"license": "ISC", | |
"dependencies": { | |
"ask-sdk-core": "^2.6.0", | |
"ask-sdk-model": "^1.18.0", | |
"aws-sdk": "^2.326.0", | |
"i18next": "^10.6.0", | |
"i18next-sprintf-postprocessor": "^0.2.2" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
QUESTIONS_ES_MX: [{ | |
'¿Cuál es la capital de Aguascalientes?': ['Aguascalientes', 'Jesús María', 'Calvillo', 'Aguardiente', 'Calandria', 'Camelias', ], | |
}, { | |
'¿Cuál es la capital de Baja California Norte?': ['Tijuana', 'Mexicali', 'Ensenada ', 'Tecate ', 'Playas de rosarito', 'Macana', ], | |
}, { | |
'¿Cuál es la capital de Baja California Sur?': ['La Paz', 'Comondu', 'Loreto', 'Los cabos', 'Mulegé', 'San Lucas', ], | |
}, { | |
'¿Cuál es la capital de Campeche?': ['Campeche', 'Calkini', 'Carmen', 'Champotón', 'Candelaria', 'Escárcega', ], | |
}, { | |
'¿Cuál es la capital de Coahuila?': ['Saltillo', 'Ramos Arizpe', 'Sabinas', 'Piedras negras', 'Torreón ', 'Monclova', ], | |
}, { | |
'¿Cuál es la capital de Colima?': ['Colima', 'Tecomán', 'Armería', 'Manzanillo', 'Villa de Álvarez', 'Villarutia', ], | |
}, { | |
'¿Cuál es la capital de Chiapas?': ['Tuxtla Gutiérrez', 'San Cristóbal de las Casas', 'Tapachula', 'Chamula', 'Cintalapa', 'Comitán de Domínguez ', ], | |
}, { | |
'¿Cuál es la capital de Chihuahua?': ['Chihuahua', 'Camargo', 'Cuauhtémoc', 'Delicias', 'Guachochi', 'Guadalupe y calvo', ], | |
}, { | |
'¿Cuál es la capital de Durango?': ['Durango', 'Gómez Palacio', 'Lerdo', 'Santiago Papásquiaro', 'Huapango', 'Villa mangó', ], | |
}, { | |
'¿Cuál es la capital de Guanajuato?': ['Guanajuato', 'León', 'Celaya', 'Irapuato', 'Tarimoro', 'Salamanca', ], | |
}, { | |
'¿Cuál es la capital de Guerrero?': ['Chilpancingo', 'Taxco de Alarcón', 'Ayutla', 'Petatlán', 'Eduardo Neri', 'Coyuca de Benítez', ], | |
}, { | |
'¿Cuál es la capital de Hidalgo?': ['Pachuca de Soto', 'Tizayuca', 'Tula de allende', 'Tepeji del rio ', 'Tulancingo de bravo', 'Huejutla de reyes', ], | |
}, { | |
'¿Cuál es la capital de Jalisco?': ['Guadalajara', 'Tonalá', 'Tlaquepaque', 'Zapopan', 'Ocotlán', 'Tequila', ], | |
}, { | |
'¿Cuál es la capital de México?': ['Toluca', 'Ecatepec de Morelos', 'Tultitlan', 'Atlacomulco', 'Cuautitlán', 'Texcoco', ], | |
}, { | |
'¿Cuál es la capital de Michoacán?': ['Morelia', 'Apatzingán', 'Maravatío', 'Sahuayo', 'Zitácuaro', 'Pátzcuaro', ], | |
}, { | |
'¿Cuál es la capital de Morelos?': ['Cuernavaca', 'Cuautla', 'Ayala', 'Jojutla', 'Temixco', 'Yautepec', ], | |
}, { | |
'¿Cuál es la capital de Nayarit?': ['Tepic', 'Atlatlahucán', 'Santiago Ixcuintla', 'Compostela', 'Acaponeta', 'Bahía de banderas ', ], | |
}, { | |
'¿Cuál es la capital de Nuevo León?': ['Monterrey', 'Guadalupe', 'San Nicolás de los garza', 'Apodaca', 'General Escobedo', 'Linares', ], | |
}, { | |
'¿Cuál es la capital de Oaxaca?': ['Oaxaca de Juárez', 'Ciudad de Huajuapan de León', 'Salina cruz', 'Juchitán de Zaragoza', 'San Juan Bautista Tuxtepec', 'Santa María Huatulco', ], | |
}, { | |
'¿Cuál es la capital de Puebla?': ['Puebla', 'Atlixco', 'Tehuacán', 'San Pedro Cholula', 'Zacatlán', 'Huauchinango', ], | |
}, { | |
'¿Cuál es la capital de Querétaro?': ['Querétaro', 'San Juan del Rio', 'Pedro Escobedo', 'Amealco de Bonfil', 'Arroyo seco', 'Cadereyta de montes', ], | |
}, { | |
'¿Cuál es la capital de Quintana Roo?': ['Chetumal', 'Benito Juárez', 'Cozumel', 'Isla mujeres', 'José maría Morelos', 'Lázaro cárdenas', ], | |
}, { | |
'¿Cuál es la capital de San Luis Potosí?': ['San Luis potosí', 'Ciudad Valles', 'Matehuala', 'Mexquitic de Carmona', 'Rio verde', 'Soledad de graciano Sánchez', ], | |
}, { | |
'¿Cuál es la capital de Sinaloa?': ['Culiacán', 'Mazatlán', 'Guasave', 'Ahome', 'Navolato', 'Salvador Alvarado', ], | |
}, { | |
'¿Cuál es la capital de Sonora?': ['Hermosillo', 'Navojoa', 'Nogales', 'Huatabampo', 'Agua prieta', 'Guaymas', ], | |
}, { | |
'¿Cuál es la capital de Tabasco?': ['Villa Hermosa', 'Balancán', 'Cárdenas', 'Centla', 'Centro', 'Comalcalco', ], | |
}, { | |
'¿Cuál es la capital de Tamaulipas?': ['Ciudad Victoria', 'Nuevo Laredo', 'Reynosa', 'Altamira', 'Ciudad madero', 'Tampico', ], | |
}, { | |
'¿Cuál es la capital de Tlaxcala?': ['Tlaxcala', 'Apizaco', 'Chiautempán', 'Huamantla', 'San Pedro del Monte', 'Alcalá', ], | |
}, { | |
'¿Cuál es la capital de Veracruz?': ['Veracruz', 'Acayucan', 'Boca del Rio', 'Coatzacoalcos', 'Córdoba', 'Cosamaloapan', ], | |
}, { | |
'¿Cuál es la capital de Yucatán?': ['Mérida', 'Progreso', 'Tizimin ', 'Tucamixtle', 'Yucamtico', 'Yextepete', ], | |
}, { | |
'¿Cuál es la capital de Zacatecas?': ['Zacatecas', 'Sombrerete', 'Rio grande', 'Fresnillo', 'Valparaíso', 'Jerez', ], | |
}, ], | |
QUESTIONS_ES_ES: [{ | |
'¿Cuál es la capital de Aguascalientes?': ['Aguascalientes', 'Jesús María', 'Calvillo', 'Aguardiente', 'Calandria', 'Camelias', ], | |
}, { | |
'¿Cuál es la capital de Baja California Norte?': ['Tijuana', 'Mexicali', 'Ensenada ', 'Tecate ', 'Playas de rosarito', 'Macana', ], | |
}, { | |
'¿Cuál es la capital de Baja California Sur?': ['La Paz', 'Comondu', 'Loreto', 'Los cabos', 'Mulegé', 'San Lucas', ], | |
}, { | |
'¿Cuál es la capital de Campeche?': ['Campeche', 'Calkini', 'Carmen', 'Champotón', 'Candelaria', 'Escárcega', ], | |
}, { | |
'¿Cuál es la capital de Coahuila?': ['Saltillo', 'Ramos Arizpe', 'Sabinas', 'Piedras negras', 'Torreón ', 'Monclova', ], | |
}, { | |
'¿Cuál es la capital de Colima?': ['Colima', 'Tecomán', 'Armería', 'Manzanillo', 'Villa de Álvarez', 'Villarutia', ], | |
}, { | |
'¿Cuál es la capital de Chiapas?': ['Tuxtla Gutiérrez', 'San Cristóbal de las Casas', 'Tapachula', 'Chamula', 'Cintalapa', 'Comitán de Domínguez ', ], | |
}, { | |
'¿Cuál es la capital de Chihuahua?': ['Chihuahua', 'Camargo', 'Cuauhtémoc', 'Delicias', 'Guachochi', 'Guadalupe y calvo', ], | |
}, { | |
'¿Cuál es la capital de Durango?': ['Durango', 'Gómez Palacio', 'Lerdo', 'Santiago Papásquiaro', 'Huapango', 'Villa mangó', ], | |
}, { | |
'¿Cuál es la capital de Guanajuato?': ['Guanajuato', 'León', 'Celaya', 'Irapuato', 'Tarimoro', 'Salamanca', ], | |
}, { | |
'¿Cuál es la capital de Guerrero?': ['Chilpancingo', 'Taxco de Alarcón', 'Ayutla', 'Petatlán', 'Eduardo Neri', 'Coyuca de Benítez', ], | |
}, { | |
'¿Cuál es la capital de Hidalgo?': ['Pachuca de Soto', 'Tizayuca', 'Tula de allende', 'Tepeji del rio ', 'Tulancingo de bravo', 'Huejutla de reyes', ], | |
}, { | |
'¿Cuál es la capital de Jalisco?': ['Guadalajara', 'Tonalá', 'Tlaquepaque', 'Zapopan', 'Ocotlán', 'Tequila', ], | |
}, { | |
'¿Cuál es la capital de México?': ['Toluca', 'Ecatepec de Morelos', 'Tultitlan', 'Atlacomulco', 'Cuautitlán', 'Texcoco', ], | |
}, { | |
'¿Cuál es la capital de Michoacán?': ['Morelia', 'Apatzingán', 'Maravatío', 'Sahuayo', 'Zitácuaro', 'Pátzcuaro', ], | |
}, { | |
'¿Cuál es la capital de Morelos?': ['Cuernavaca', 'Cuautla', 'Ayala', 'Jojutla', 'Temixco', 'Yautepec', ], | |
}, { | |
'¿Cuál es la capital de Nayarit?': ['Tepic', 'Atlatlahucán', 'Santiago Ixcuintla', 'Compostela', 'Acaponeta', 'Bahía de banderas ', ], | |
}, { | |
'¿Cuál es la capital de Nuevo León?': ['Monterrey', 'Guadalupe', 'San Nicolás de los garza', 'Apodaca', 'General Escobedo', 'Linares', ], | |
}, { | |
'¿Cuál es la capital de Oaxaca?': ['Oaxaca de Juárez', 'Ciudad de Huajuapan de León', 'Salina cruz', 'Juchitán de Zaragoza', 'San Juan Bautista Tuxtepec', 'Santa María Huatulco', ], | |
}, { | |
'¿Cuál es la capital de Puebla?': ['Puebla', 'Atlixco', 'Tehuacán', 'San Pedro Cholula', 'Zacatlán', 'Huauchinango', ], | |
}, { | |
'¿Cuál es la capital de Querétaro?': ['Querétaro', 'San Juan del Rio', 'Pedro Escobedo', 'Amealco de Bonfil', 'Arroyo seco', 'Cadereyta de montes', ], | |
}, { | |
'¿Cuál es la capital de Quintana Roo?': ['Chetumal', 'Benito Juárez', 'Cozumel', 'Isla mujeres', 'José maría Morelos', 'Lázaro cárdenas', ], | |
}, { | |
'¿Cuál es la capital de San Luis Potosí?': ['San Luis potosí', 'Ciudad Valles', 'Matehuala', 'Mexquitic de Carmona', 'Rio verde', 'Soledad de graciano Sánchez', ], | |
}, { | |
'¿Cuál es la capital de Sinaloa?': ['Culiacán', 'Mazatlán', 'Guasave', 'Ahome', 'Navolato', 'Salvador Alvarado', ], | |
}, { | |
'¿Cuál es la capital de Sonora?': ['Hermosillo', 'Navojoa', 'Nogales', 'Huatabampo', 'Agua prieta', 'Guaymas', ], | |
}, { | |
'¿Cuál es la capital de Tabasco?': ['Villa Hermosa', 'Balancán', 'Cárdenas', 'Centla', 'Centro', 'Comalcalco', ], | |
}, { | |
'¿Cuál es la capital de Tamaulipas?': ['Ciudad Victoria', 'Nuevo Laredo', 'Reynosa', 'Altamira', 'Ciudad madero', 'Tampico', ], | |
}, { | |
'¿Cuál es la capital de Tlaxcala?': ['Tlaxcala', 'Apizaco', 'Chiautempán', 'Huamantla', 'San Pedro del Monte', 'Alcalá', ], | |
}, { | |
'¿Cuál es la capital de Veracruz?': ['Veracruz', 'Acayucan', 'Boca del Rio', 'Coatzacoalcos', 'Córdoba', 'Cosamaloapan', ], | |
}, { | |
'¿Cuál es la capital de Yucatán?': ['Mérida', 'Progreso', 'Tizimin ', 'Tucamixtle', 'Yucamtico', 'Yextepete', ], | |
}, { | |
'¿Cuál es la capital de Zacatecas?': ['Zacatecas', 'Sombrerete', 'Rio grande', 'Fresnillo', 'Valparaíso', 'Jerez', ], | |
}, ], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment