mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
69 lines
1.3 KiB
JavaScript
69 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const Base = require('./Base');
|
|
|
|
/**
|
|
* Represents a Reaction on WhatsApp
|
|
* @extends {Base}
|
|
*/
|
|
class Reaction extends Base {
|
|
constructor(client, data) {
|
|
super(client);
|
|
|
|
if (data) this._patch(data);
|
|
}
|
|
|
|
_patch(data) {
|
|
/**
|
|
* Reaction ID
|
|
* @type {object}
|
|
*/
|
|
this.id = data.msgKey;
|
|
/**
|
|
* Orphan
|
|
* @type {number}
|
|
*/
|
|
this.orphan = data.orphan;
|
|
/**
|
|
* Orphan reason
|
|
* @type {?string}
|
|
*/
|
|
this.orphanReason = data.orphanReason;
|
|
/**
|
|
* Unix timestamp for when the reaction was created
|
|
* @type {number}
|
|
*/
|
|
this.timestamp = data.timestamp;
|
|
/**
|
|
* Reaction
|
|
* @type {string}
|
|
*/
|
|
this.reaction = data.reactionText;
|
|
/**
|
|
* Read
|
|
* @type {boolean}
|
|
*/
|
|
this.read = data.read;
|
|
/**
|
|
* Message ID
|
|
* @type {object}
|
|
*/
|
|
this.msgId = data.parentMsgKey;
|
|
/**
|
|
* Sender ID
|
|
* @type {string}
|
|
*/
|
|
this.senderId = data.senderUserJid;
|
|
/**
|
|
* ACK
|
|
* @type {?number}
|
|
*/
|
|
this.ack = data.ack;
|
|
|
|
|
|
return super._patch(data);
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = Reaction; |