iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 7
0

參考
https://docs.microsoft.com/en-us/bot-framework/nodejs/bot-builder-nodejs-dialog-overview
allow you to model conversations and manage conversation
也就是說 所有的 對話腳本邏輯 都是由此決定

var builder = require('botbuilder');
var connector = new builder.ConsoleConnector().listen();
var bot = new builder.UniversalBot(connector, function (session) {
session.send("you:"+s.message.text)
});

註 在3.5以前,是寫成這樣

var bot = new builder.UniversalBot(connector);
bot.dialog(“/", s => {
s.send("you:"+s.message.text)
})

但目前還是可以這樣寫

dialog裡定義waterfalls
waterfalls的表現方式,
就是照排序的 array ,
然後照這

waterfalls
// Ask the user for their name and greet them by name.

bot.dialog('greetings', [
function (session) {
builder.Prompts.text(session, 'Hi! What is your name?');
},
function (session, results) {
session.endDialog(`Hello ${results.response}!`);
}
]);

順序做為對話順序的安排


上一篇
Debug a bot with Visual Studio Code (typescript)
下一篇
Dialog , Prompt
系列文
Microsoft Bot Framework 30天上手 + 自幹 Line Builder 串接 + Line Bot Demo30

尚未有邦友留言

立即登入留言