Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chatasweetie/a85d7aef1e19014281349ba343e14471 to your computer and use it in GitHub Desktop.
Save chatasweetie/a85d7aef1e19014281349ba343e14471 to your computer and use it in GitHub Desktop.
// 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