BotFramework Nodejs示例

关于Bot Framework知识,可以参考《Nodejs Bot学习

本文是根据bot framework sample《https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node》写出的个人学习资料


示例一:core-SendAttachment(发送附件)(https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-SendAttachment

发送附件时,有两种方式

一种是将本地图片base64化,发送出去

一种是将网络图片直接发送出去,使用图片URL


示例二:core-ReceiveAttachment(接收附件)(https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-ReceiveAttachment

通过接收session.message.attachmentsp[0]获取附件


示例三:core-CreateNewConversation(新创建对话)(https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-CreateNewConversation) 

第一次用户创建对话时,保存用户的地址,然后创建一个新对话,并将地址加入至临时区

待五秒后,会循环临时区,获取用户的地址,并开户一个新的对话,使用对应的地址


示例三:core-GetConversationMembers(获取对话的对象)(https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-GetConversationMembers

在conversationUpdate事件中,获取用户的信息


示例五:core-MultiDialogs(多对话)(https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-MultiDialogs

选择一时,故意抛出错误

选择二时,就是普通的瀑布流对话


示例六:core-State(保存数据)(https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-State) 

通过保存和提取用户数据(userData),会话数据(privateConversationData)

提取和保存userData

提取和保存privateConversationData


示例七:core-CustomState(用户自定义状态)(https://github.com/Microsoft/BotBuilder-Samples/tree/master/Node/core-CustomState

原文地址:https://www.cnblogs.com/weschen/p/7403078.html