forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
45 lines (37 loc) · 1.21 KB
/
app.js
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
36
37
38
39
40
41
42
require('dotenv-extended').load();
require('./config.js')();
require('./connectorSetup.js')();
require('./searchHelpers.js')();
require('./dialogs/results.js')();
require('./dialogs/musicianExplorer.js')();
require('./dialogs/musicianSearch.js')();
var request = require('request');
// Entry point of the bot
bot.dialog('/', [
function (session) {
session.replaceDialog('/promptButtons');
}
]);
bot.dialog('/promptButtons', [
function (session) {
var choices = ["Musician Explorer", "Musician Search"]
builder.Prompts.choice(session, "How would you like to explore the classical music bot?", choices);
},
function (session, results) {
if (results.response) {
var selection = results.response.entity;
// route to corresponding dialogs
switch (selection) {
case "Musician Explorer":
session.replaceDialog('/musicianExplorer');
break;
case "Musician Search":
session.replaceDialog('/musicianSearch');
break;
default:
session.reset('/');
break;
}
}
}
]);