This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates a {@code SpeechletResponse} for the hello intent. | |
* | |
* @return SpeechletResponse spoken and visual response for the given intent | |
*/ | |
private SpeechletResponse getHelloResponse(Session session) { | |
String speechText = "Hello world"; | |
// Create the Simple card content. | |
SimpleCard card = new SimpleCard(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.simpleFunction = bst.Logless.capture("<YOUR_SECRET_KEY>", simpleFunction); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.simpleFunction = functions.https.onRequest(bst.Logless.capture("<YOUR_SECRET_KEY>", simpleFunction)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("Launches and plays", (done) => { | |
// Launch the skill | |
alexa.launch().then((payload) => { | |
// Test the correct text response comes back | |
expect(payload.response.outputSpeech.ssml).toContain("We show you images we got from Giphy"); | |
// Once it launches, say Yes | |
return alexa.utter("yes"); | |
}).then((payload) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let alexa = virtualAlexa.VirtualAlexa.Builder() | |
.handler("src/index.handler") // Lambda function file and name | |
.intentSchemaFile("./speechAssets/IntentSchema.json") // Path to IntentSchema.json | |
.sampleUtterancesFile("./speechAssets/SampleUtterances.txt") // Path to SampleUtterances | |
.create(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("Plays once", (done) => { | |
alexa.utter("get started").then((payload) => { | |
expect(payload.response.outputSpeech.ssml).toContain("What is the search term for it"); | |
return alexa.utter("incorrect guess"); | |
}).then((payload) => { | |
expect(payload.response.outputSpeech.ssml).toContain("Nice try"); | |
return alexa.utter("incorrect guess"); | |
}).then((payload) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Launch Proxy", | |
"program": "${workspaceRoot}/node_modules/bespoken-tools/bin/bst-proxy.js", | |
"args": ["lambda", "src/index.js"], | |
"cwd": "${workspaceRoot}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("Launches successfully", async function() { | |
const bvd = require("virtual-alexa"); | |
const alexa = bvd.VirtualAlexa.Builder() | |
.handler("index.handler") // Lambda function file and name | |
.intentSchemaFile("./speechAssets/IntentSchema.json") | |
.sampleUtterancesFile("./speechAssets/SampleUtterances.txt") | |
.create(); | |
let reply = await alexa.launch(); | |
assert.include(reply.response.outputSpeech.ssml, "Welcome to guess the price"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'DescriptionState': { | |
'YesIntent': function () { | |
var P = new Pokedex(); | |
var number = app.getSessionAttribute('pokemonNo'); | |
var img = app.getSessionAttribute('pokemonImg'); | |
P.getPokemonSpeciesByName(number) // with Promise | |
.then(function (response) { | |
var dexEntry = response.flavor_text_entries.filter(function (entry) { | |
return (entry.language.name === 'en'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const repromptMessage = 'Ask me which number of pokemon you want to know about'; | |
const errorMessage = 'There was an error with your request, please try again'; | |
const goodbyeMessage = 'Thank you for using my pokedex! Remember to catch them all!'; | |
const pikachuAudio = 'https://s3.us-east-2.amazonaws.com/diego-bst-generalbucket/pikachu.mp3'; | |
const handlers = { | |
'LAUNCH': function () { | |
var welcome = 'Welcome to my pokedex. ' + repromptMessage; | |
app.ask(welcome, repromptMessage); |
OlderNewer