I have an intent set up with a list of the planets in the solar system.
{
"intent": "PlanetIntent",
"slots": [
{
"name": "Planet",
"type": "LIST_OF_PLANETS"
}
]
},
I'm trying to set it up so that when a user names a planet my code simply returns the name of that planet back to them. If they say a planet not in the list then it'll return with an error (or go to unhandled which is what I initially assumed would happen).
But no matter what I try, from the most basic to the most complex code, my code will always return any word that is said, rather than just the relevant slot value.
So neither
'PlanetIntent': function () {
var selection = this.event.request.intent.slots.Planet.value;
this.response.speak(selection);
this.emit(':responseReady');
}
nor this
'PlanetIntent': function () {
var selection = '';
if ( !this.event.request.intent.slots.Planet ||
this.event.request.intent.slots.Planet.value == '') {
this.emitWithState('AMAZON.HelpIntent');
} else {
selection = this.event.request.intent.slots.Planet.value;
this.response.speak(selection);
this.emit(':responseReady');
}
},
Seem to stop random values from getting through. If you say Mars, it returns Mars, if you say turnip, it returns turnip. Any ideas. I just want to limit it to return only responses from my list of planets!