本文整理汇总了TypeScript中botbuilder.BotFrameworkAdapter.use方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BotFrameworkAdapter.use方法的具体用法?TypeScript BotFrameworkAdapter.use怎么用?TypeScript BotFrameworkAdapter.use使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类botbuilder.BotFrameworkAdapter
的用法示例。
在下文中一共展示了BotFrameworkAdapter.use方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: BotFrameworkAdapter
// Create adapter
const adapter = new BotFrameworkAdapter( {
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
// Add conversation state middleware
interface CafeBotConvState {
dialogStack: any[];
cafeLocation: string;
dateTime: string;
partySize: string;
Name: string;
}
const conversationState = new ConversationState<CafeBotConvState>(new MemoryStorage());
adapter.use(conversationState);
// Create empty dialog set
const dialogs = new DialogSet();
// Listen for incoming requests
server.post('/api/messages', (req, res) => {
// Route received request to adapter for processing
adapter.processActivity(req, res, async (context) => {
const isMessage = context.activity.type === 'message';
// Create dialog context
const state = conversationState.get(context);
const dc = dialogs.createContext(context, state);
if (!isMessage) {