发布于 2019-01-16 21:38:08
BotAdapter
基类公开use
方法以注册中间件。因此,在启动逻辑中,您将创建一个特定的BotAdapter
实现,通常是BotFrameworkAdapter
,然后将中间件添加到其中。如下所示:
const botAdapter = new BotFrameworkAdapter( { /* credential stuff here*/ });
// Simple handler based
botAdapter.use(async (turnContext, next) => {
// pre logic
await next();
// post logic
});
// Or class based
botAdapter.use(new MyMiddleware());
https://stackoverflow.com/questions/54225716
复制相似问题