Get Mentions (#35)
This commit is contained in:
parent
0cbc24fc6c
commit
4b1768450f
1 changed files with 19 additions and 1 deletions
|
|
@ -90,6 +90,16 @@ class Message extends Base {
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
@ -113,6 +123,14 @@ class Message extends Base {
|
|||
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 {Promise<Message>}
|
||||
|
|
|
|||
Loading…
Reference in a new issue