@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
74 lines (72 loc) • 1.69 kB
JavaScript
import { Activity } from '../activity.mjs';
class MessageReactionActivity extends 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;
}
}
export { MessageReactionActivity };
//# sourceMappingURL=message-reaction.mjs.map
//# sourceMappingURL=message-reaction.mjs.map