Skip to content

Instantly share code, notes, and snippets.

@frogermcs
Created November 29, 2017 18:13
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 frogermcs/40196d1d61f5e3cabbfac1210e1db732 to your computer and use it in GitHub Desktop.
Save frogermcs/40196d1d61f5e3cabbfac1210e1db732 to your computer and use it in GitHub Desktop.
class Conversation {
//...
_greetNewUser() {
if (this._isScreenAvailable()) {
this._askWithSuggestionChips(Str.GREETING_NEW_USER, Str.GREETING_USER_SUGGESTION_CHIPS)
} else {
this.dialogflowApp.ask(Str.GREETING_NEW_USER, Str.GREETING_NEW_USER_NO_INPUT_PROMPT);
}
}
_isScreenAvailable() {
return this.dialogflowApp.hasSurfaceCapability(this.dialogflowApp.SurfaceCapabilities.SCREEN_OUTPUT);
}
_askWithSuggestionChips(speech, suggestions) {
this.dialogflowApp.ask(this.dialogflowApp
.buildRichResponse()
.addSimpleResponse(speech)
.addSuggestions(suggestions)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment