mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 12:39:20 +00:00
Get Mentions (#35)
This commit is contained in:
@@ -90,6 +90,16 @@ class Message extends Base {
|
|||||||
*/
|
*/
|
||||||
this.hasQuotedMsg = data.quotedMsg ? true : false;
|
this.hasQuotedMsg = data.quotedMsg ? true : false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates the mentions in the message body.
|
||||||
|
* @type {Array<string>}
|
||||||
|
*/
|
||||||
|
this.mentionedIds = [];
|
||||||
|
|
||||||
|
if (data.mentionedJidList) {
|
||||||
|
this.mentionedIds = data.mentionedJidList;
|
||||||
|
}
|
||||||
|
|
||||||
return super._patch(data);
|
return super._patch(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -113,6 +123,14 @@ class Message extends Base {
|
|||||||
return this.client.getContactById(this._getChatId());
|
return this.client.getContactById(this._getChatId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the Contacts mentioned in this message
|
||||||
|
* @returns {Promise<Array<Contact>>}
|
||||||
|
*/
|
||||||
|
async getMentions() {
|
||||||
|
return await Promise.all(this.mentionedIds.map(async m => await this.client.getContactById(m)));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the quoted message, if any
|
* Returns the quoted message, if any
|
||||||
* @returns {Promise<Message>}
|
* @returns {Promise<Message>}
|
||||||
@@ -178,4 +196,4 @@ class Message extends Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Message;
|
module.exports = Message;
|
||||||
|
|||||||
Reference in New Issue
Block a user