Commit b6240cbd authored by Eric Meier's avatar Eric Meier
parents 33bc65ff 6150f9f7
......@@ -66,8 +66,12 @@ topicPrompt.setup(bot, recognizer);
* Dialogs
*/
bot.dialog("welcome", require("./dialogs/welcome"));
bot.dialog("settings", require("./dialogs/welcome"));
<<<<<<< HEAD
bot.dialog("openSettings", require("./dialogs/settings")).triggerAction({
matches: "settings"
});
=======
bot
.dialog("learning", require("./dialogs/learning"))
.triggerAction({ matches: "learn" });
......@@ -79,13 +83,11 @@ bot
.triggerAction({
matches: "settings"
});
>>>>>>> 41a92cd8dcc059fc54be4ac7ab4ea9e199e7e2ab
bot.on("conversationUpdate", function(activity) {
bot.on("conversationUpdate", activity => {
if (activity.membersAdded) {
const hello = new builder.Message()
.address(activity.address)
.text("Welcome....");
activity.membersAdded.forEach(function(identity) {
activity.membersAdded.forEach(identity => {
// say hello only when bot joins and not when user joins
if (identity.id === activity.address.bot.id) {
bot.beginDialog(activity.address, "welcome");
......
......@@ -2,24 +2,35 @@ var builder = require("botbuilder");
module.exports = [
(session, args, next) => {
// const entUserData = builder.EntityRecognizer.findEntity(
// args.intent.entities,
// "settings.userData"
// );
const msg = new builder.Message(session).addAttachment(
const choices = ["deleteUserData", "changeName"];
var reply = new builder.Message(session).addAttachment(
settingsCard(session)
);
session.send(msg);
builder.Prompts.choice(session, reply, choices);
},
(session, results, next) => {
switch (results.response) {
case "deleteUserData": {
break;
}
case "changeName": {
break;
}
}
session.send(JSON.stringify(results));
}
];
const settingsCard = session => {
return new builder.HeroCard(session)
.title('BotFramework Hero Card')
.subtitle('Your bots — wherever your users are talking')
.title("Settings")
.buttons([
builder.CardAction.
builder.CardAction.postBack(
session,
"deleteUserData",
"Delete User"
),
builder.CardAction.postBack(session, "changeName", "Change Name")
]);
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment