Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function flight(agent) {
- const city = agent.parameters['geo-city'];
- const time = agent.parameters['time'];
- const gotCity = city.length > 0;
- const gotTime = time.length > 0;
- if(gotCity && gotTime) {
- agent.add(`Nice, you want to fly to ${city} at ${time}.`);
- } else if (gotCity && !gotTime) {
- agent.add('Let me know which time you want to fly');
- } else if (gotTime && !gotCity) {
- agent.add('Let me know which city you want to fly to');
- } else {
- agent.add('Let me know which city and time you want to fly');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement