Skip to content

Instantly share code, notes, and snippets.

@chatasweetie
Created July 22, 2019 20:45
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/d185527c6401b71447b0a43a6aab232a to your computer and use it in GitHub Desktop.
Save chatasweetie/d185527c6401b71447b0a43a6aab232a to your computer and use it in GitHub Desktop.
/**
* Selects suggestion chips
* @param {obj} conv, the conversation object.
* @return [] array of suggestion chips.
*/
function selectSuggestionChips(conv) {
let suggestions = [];
for (let i=0; i < conv.data.intentFulfilled.length; i++) {
if (conv.data.intentFulfilled[i] === 0) {
suggestions.push(responses.SUGGESTIONS['MENU')[i]);
}
if (suggestions.length === 2) {
return suggestions;
}
}
return suggestions;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment