@microsoft/teams-ai
Version:
SDK focused on building AI based applications for Microsoft Teams.
91 lines • 3.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Meetings = void 0;
const botbuilder_1 = require("botbuilder");
/**
* Provides a set of methods for handling Teams meeting events.
*/
class Meetings {
_app;
constructor(app) {
this._app = app;
}
/**
* Handles meeting start events for Microsoft Teams.
* @template TState
* @param {Function} handler - Function to call when the handler is triggered.
* @returns {Application<TState>} The application for chaining purposes.
*/
start(handler) {
const selector = (context) => {
return Promise.resolve(context.activity.type === botbuilder_1.ActivityTypes.Event &&
context.activity.channelId === 'msteams' &&
context.activity.name === 'application/vnd.microsoft.meetingStart');
};
const handlerWrapper = (context, state) => {
const meeting = context.activity.value;
return handler(context, state, meeting);
};
this._app.addRoute(selector, handlerWrapper);
return this._app;
}
/**
* Handles meeting end events for Microsoft Teams.
* @template TState - The type of TurnState
* @param {Function} handler - Function to call when the handler is triggered.
* @returns {Application<TState>} The application for chaining purposes.
*/
end(handler) {
const selector = (context) => {
return Promise.resolve(context.activity.type === botbuilder_1.ActivityTypes.Event &&
context.activity.channelId === 'msteams' &&
context.activity.name === 'application/vnd.microsoft.meetingEnd');
};
const handlerWrapper = (context, state) => {
const meeting = context.activity.value;
return handler(context, state, meeting);
};
this._app.addRoute(selector, handlerWrapper);
return this._app;
}
/**
* Handles meeting participant join events for Microsoft Teams.
* @template TState
* @param {Function} handler - Function to call when the handler is triggered.
* @returns {Application<TState>} The application for chaining purposes.
*/
participantsJoin(handler) {
const selector = (context) => {
return Promise.resolve(context.activity.type === botbuilder_1.ActivityTypes.Event &&
context.activity.channelId === 'msteams' &&
context.activity.name === 'application/vnd.microsoft.meetingParticipantsJoin');
};
const handlerWrapper = (context, state) => {
const meeting = context.activity.value;
return handler(context, state, meeting);
};
this._app.addRoute(selector, handlerWrapper);
return this._app;
}
/**
* Handles meeting participant leave events for Microsoft Teams.
* @template TState - The type of TurnState
* @param {Function} handler - Function to call when the handler is triggered.
* @returns {Application<TState>} The application for chaining purposes.
*/
participantsLeave(handler) {
const selector = (context) => {
return Promise.resolve(context.activity.type === botbuilder_1.ActivityTypes.Event &&
context.activity.channelId === 'msteams' &&
context.activity.name === 'application/vnd.microsoft.meetingParticipantsLeave');
};
const handlerWrapper = (context, state) => {
const meeting = context.activity.value;
return handler(context, state, meeting);
};
this._app.addRoute(selector, handlerWrapper);
return this._app;
}
}
exports.Meetings = Meetings;
//# sourceMappingURL=Meetings.js.map