-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackageFinder.js
More file actions
35 lines (31 loc) · 1.32 KB
/
Copy pathpackageFinder.js
File metadata and controls
35 lines (31 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const builder = require('botbuilder');
const searchHelper = require('./searchHelper.js');
const messageHelper = require('./messageHelper.js');
const locationHelper = require('./locationHelper.js');
module.exports = {
id: 'packageSearch',
title: 'Package Search',
dialog: [
(session) => {
//Prompt for string input
builder.Prompts.text(session, 'Whose Package are you searching for?');
},
(session, results) => {
//Sets name equal to resulting input
const keyword = results.response;
searchHelper.searchQuery(keyword, (err, result) => {
if (err) {
console.log(`Search query failed with ${err}`);
session.endConversation(`Sorry, I had an error when talking to the server.`);
} else if (result) {
console.log(`Search query failed with ${result}`);
const message = messageHelper.getPackageCarousel(session, result);
session.endConversation(message);
//get location from result and send a map to the user session
//const location = locationHelper.getLocationCarousel(session, result);
}
session.reset('/');
});
}
]
}