Step 7: Add several items

The user may want to order several items, for example three burgers or five burritos. Let’s update our voice command to support this behavior.

Add another pattern to invoke the voice command. Inside this pattern, we will use the $(NUM) slot to capture the number of ordered items. The command patterns are separated with a comma.

Dialog script
const itemList = "pepperoni, margherita, burrito, burger, taco, apple pie";

intent(`(I want|I will take|Add) $(NUM: 1, 2, 3...) $(ITEM: ${itemList}), please-`, p => {
    p.play(`Adding ${p.ITEM.value} for you`);
});