UNPKG

@microsoft/teams.api

Version:

<p> <a href="https://www.npmjs.com/package/@microsoft/teams.api" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.api/latest" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.api?activeTab=code" t

76 lines (73 loc) • 1.73 kB
'use strict'; var activity = require('../activity'); class MessageReactionActivity extends activity.Activity { /** * The collection of reactions added to the conversation. */ reactionsAdded; /** * The collection of reactions removed from the conversation. */ reactionsRemoved; constructor(value = {}) { super({ ...value, type: "messageReaction" }); Object.assign(this, value); } /** * initialize from interface */ static from(activity) { return new MessageReactionActivity(activity); } /** * convert to interface */ toInterface() { return Object.assign({}, this); } /** * copy to a new instance */ clone(options = {}) { return new MessageReactionActivity({ ...this.toInterface(), ...options }); } /** * Add a message reaction. * @deprecated Use api.conversations.addReaction instead. */ addReaction(reaction) { if (!this.reactionsAdded) { this.reactionsAdded = []; } this.reactionsAdded.push(reaction); return this; } /** * Remove a message reaction. * @deprecated Use api.conversations.deleteReaction instead. */ removeReaction(reaction) { if (!this.reactionsRemoved) { this.reactionsRemoved = []; } if (this.reactionsAdded) { const i = this.reactionsAdded.findIndex( (r) => r.type === reaction.type && r.user?.id === reaction.user?.id ); if (i > -1) { this.reactionsAdded.splice(i, 1); } } this.reactionsRemoved.push(reaction); return this; } } exports.MessageReactionActivity = MessageReactionActivity; //# sourceMappingURL=message-reaction.js.map //# sourceMappingURL=message-reaction.js.map