Create a gist now

Instantly share code, notes, and snippets.

Embed
class Conversation {
//...
//Intent facts_drinking_water
getFactForDrinkingWater() {
const waterFact = this.factsRepository.getRandomWaterFact();
let speechResponse;
if (this._isScreenAvailable()) {
speechResponse = this.factsRepository.getWaterFactRichResponse(waterFact);
} else {
speechResponse = this.factsRepository.getWaterFactAudioTextResponse(waterFact);
}
this.dialogflowApp.tell(speechResponse);
}
_isScreenAvailable() {
return this.dialogflowApp.hasSurfaceCapability(this.dialogflowApp.SurfaceCapabilities.SCREEN_OUTPUT);
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment