We can start dealing with our whichCar intent. We start by creating the WhichCarHandler and adding it to the list in addRequestHandlers():
const WhichCarHandler = { canHandle(handlerInput) { return handlerInput.requestEnvelope.request.type === 'IntentRequest' && handlerInput.requestEnvelope.request.intent.name === 'whichCar'; }, async handle(handlerInput) {}}
Inside this handler function, the first thing that we need to do is to get the slots from the event. We can use es6 destructuring to simplify our code:
const slots = handlerInput.requestEnvelope.request.intent.slots;const {size, cost, gears, doors} = slots;
We now have access to all four of our slot variables. Even though we created our slot types, we need ...