UNPKG

1.32 kBJavaScriptView Raw
1"use strict";
2/**
3 * @module botbuilder
4 */
5/**
6 * Copyright (c) Microsoft Corporation. All rights reserved.
7 * Licensed under the MIT License.
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10/**
11 * Activity helper methods for Teams.
12 */
13function teamsGetChannelId(activity) {
14 if (!activity) {
15 throw new Error('Missing activity parameter');
16 }
17 const channelData = activity.channelData;
18 const channel = channelData ? channelData.channel : null;
19 return channel && channel.id ? channel.id : null;
20}
21exports.teamsGetChannelId = teamsGetChannelId;
22function teamsGetTeamId(activity) {
23 if (!activity) {
24 throw new Error('Missing activity parameter');
25 }
26 const channelData = activity.channelData;
27 const team = channelData ? channelData.team : null;
28 return team && team.id ? team.id : null;
29}
30exports.teamsGetTeamId = teamsGetTeamId;
31function teamsNotifyUser(activity) {
32 if (!activity) {
33 throw new Error('Missing activity parameter');
34 }
35 if (!activity.channelData || typeof activity.channelData !== 'object') {
36 activity.channelData = {};
37 }
38 const channelData = activity.channelData;
39 channelData.notification = { alert: true };
40}
41exports.teamsNotifyUser = teamsNotifyUser;
42//# sourceMappingURL=teamsActivityHelpers.js.map
\No newline at end of file