forked from microsoft/BotBuilder-Samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteamsActivityHandler.js
More file actions
30 lines (26 loc) · 889 Bytes
/
teamsActivityHandler.js
File metadata and controls
30 lines (26 loc) · 889 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const { ActivityHandler, ActivityTypes } = require('botbuilder');
class TeamsActivityHandler extends ActivityHandler {
constructor() {
super();
this.onUnrecognizedActivityType(async (context, next) => {
const runDialogs = async () => {
await this.handle(context, 'Dialog', async () => {
// noop
});
};
switch (context.activity.type) {
case ActivityTypes.Invoke:
await this.handle(context, 'Invoke', runDialogs);
break;
default:
await next();
}
});
}
onInvoke(handler) {
return this.on('Invoke', handler);
}
}
module.exports.TeamsActivityHandler = TeamsActivityHandler;