Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@chatasweetie
Created July 2, 2018 22:56
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/7099e2a60799e07b0a24bd0c88970266 to your computer and use it in GitHub Desktop.
Save chatasweetie/7099e2a60799e07b0a24bd0c88970266 to your computer and use it in GitHub Desktop.
// index.js
app.intent('askProblem', (conv, params) => {
let level = params.level;
// if level is random or not defined, I choose a random level
if (level === 'random' || !level) {
let keys = Object.keys(response.challenges);
level = choose(keys);
}
let questions = responses.challenge[level];
let message = choose(questions)[0];
conv.ask(new SimpleResponse({
speech: message['speech'],
text: message['text'],
}));
// provides suggestion chips for visual displays
conv.ask(new Suggestions('Hint', 'Solution'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment