diff --git a/lib/simple.js b/lib/simple.js index ba1946cf0..e2a405a64 100644 --- a/lib/simple.js +++ b/lib/simple.js @@ -1468,20 +1468,20 @@ export function serialize() { }, cMod: { - /** + /** * Modify quoted Message * @param {String} jid * @param {String} text * @param {String} sender * @param {Object} options */ - value(jid, text = '', sender = this.sender, options = {}) { - return self.conn?.cMod(jid, this.vM, text, sender, options); - }, - enumerable: true, - - }, - delete: { + value(jid, text = '', sender = this.sender, options = {}) { + return self.conn?.cMod(jid, this.vM, text, sender, options) + }, + enumerable: true, + + }, + delete: { /** * Delete quoted message */ @@ -1513,93 +1513,91 @@ export function serialize() { writable: true, }, text: { - get() { - const msg = this.msg; - const text = (typeof msg === 'string' ? msg : msg?.text) || msg?.caption || msg?.contentText || ''; - return typeof this._text === 'string' ? this._text : '' || (typeof text === 'string' ? text : ( + get() { + const msg = this.msg + const text = (typeof msg === 'string' ? msg : msg?.text) || msg?.caption || msg?.contentText || '' + return typeof this._text === 'string' ? this._text : '' || (typeof text === 'string' ? text : ( text?.selectedDisplayText || text?.hydratedTemplate?.hydratedContentText || text - )) || ''; - }, - set(str) { - return this._text = str; - }, - enumerable: true, - }, - mentionedJid: { - get() { - return this.msg?.contextInfo?.mentionedJid?.length && this.msg.contextInfo.mentionedJid || []; - }, - enumerable: true, - }, - name: { - get() { - return !nullish(this.pushName) && this.pushName || this.conn?.getName(this.sender); - }, - enumerable: true, - }, - download: { - value(saveToFile = false) { - const mtype = this.mediaType; - return this.conn?.downloadM(this.mediaMessage[mtype], mtype.replace(/message/i, ''), saveToFile); - }, - enumerable: true, - configurable: true, - }, - reply: { - value(text, chatId, options) { - return this.conn?.reply(chatId ? chatId : this.chat, text, this, options); - }, - }, - copy: { - value() { - const M = proto.WebMessageInfo; - return smsg(this.conn, M.fromObject(M.toObject(this))); - }, - enumerable: true, - }, - forward: { - value(jid, force = false, options = {}) { - return this.conn?.sendMessage(jid, { - forward: this, force, ...options, - }, {...options}); - }, - enumerable: true, - }, - copyNForward: { - value(jid, forceForward = false, options = {}) { - return this.conn?.copyNForward(jid, this, forceForward, options); - }, - enumerable: true, - }, - cMod: { - value(jid, text = '', sender = this.sender, options = {}) { - return this.conn?.cMod(jid, this, text, sender, options); - }, - enumerable: true, - }, - getQuotedObj: { - value() { - if (!this.quoted.id) return null; - const q = proto.WebMessageInfo.fromObject(this.conn?.loadMessage(this.quoted.id) || this.quoted.vM); - return smsg(this.conn, q); - }, - enumerable: true, - }, - getQuotedMessage: { - get() { - return this.getQuotedObj; - }, - }, - delete: { - value() { - return this.conn?.sendMessage(this.chat, {delete: this.key}); - }, - enumerable: true, - }, - }); -} + )) || '' + }, + set(str) { + return this._text = str + }, + enumerable: true + }, + mentionedJid: { + get() { + return this.msg?.contextInfo?.mentionedJid?.length && this.msg.contextInfo.mentionedJid || [] + }, + enumerable: true + }, + name: { + get() { + return !nullish(this.pushName) && this.pushName || this.conn?.getName(this.sender) + }, + enumerable: true + }, + download: { + value(saveToFile = false) { + const mtype = this.mediaType + return this.conn?.downloadM(this.mediaMessage[mtype], mtype.replace(/message/i, ''), saveToFile) + }, + enumerable: true, + configurable: true + }, + reply: { + value(text, chatId, options) { + return this.conn?.reply(chatId ? chatId : this.chat, text, this, options) + } + }, + copy: { + value() { + const M = proto.WebMessageInfo + return smsg(this.conn, M.fromObject(M.toObject(this))) + }, + enumerable: true + }, + forward: { + value(jid, force = false, options = {}) { + return this.conn?.sendMessage(jid, { + forward: this, force, ...options + }, { ...options }) + }, + enumerable: true + }, + copyNForward: { + value(jid, forceForward = false, options = {}) { + return this.conn?.copyNForward(jid, this, forceForward, options) + }, + enumerable: true + }, + cMod: { + value(jid, text = '', sender = this.sender, options = {}) { + return this.conn?.cMod(jid, this, text, sender, options) + }, + enumerable: true + }, + getQuotedObj: { + value() { + if (!this.quoted.id) return null + const q = proto.WebMessageInfo.fromObject(this.conn?.loadMessage(this.quoted.id) || this.quoted.vM) + return smsg(this.conn, q) + }, + enumerable: true + }, + getQuotedMessage: { + get() { + return this.getQuotedObj + } + }, + delete: { + value() { + return this.conn?.sendMessage(this.chat, { delete: this.key }) + }, + enumerable: true + }, //react react: { value(text) {