Created
July 2, 2018 22:57
-
-
Save chatasweetie/a85d7aef1e19014281349ba343e14471 to your computer and use it in GitHub Desktop.
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
// index.js | |
app.intent('challengeHint', (conv) => { | |
// get the data that is saved on the user | |
let challengesName = conv.user.storage.currentChallenge; | |
let level = conv.user.storage.currentLevel; | |
// if they don't have a challengeName, then we tell them a | |
// message | |
if (!challengeName){ | |
conv.ask(new SimpleResponse({ | |
speech: noChallengeresponse['speech'}, | |
text: noChallengeresponse['text'], | |
})); | |
conv.ask(new Suggestions( | |
choose(responses.commmonSuggestions, 2) | |
)); | |
} else { | |
// figures out which question the user is on | |
let question = findQuestion(level, challengesName); | |
// sends hint to user | |
conv.ask(new SimpleResponse({ | |
speech: question['hintSpeech'], | |
text: question['hintText'], | |
})); | |
conv.ask(new Suggestions('Solution', 'Repeat Problem') | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment