mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-20 04:29:15 +00:00
feat: get Contact's "About" text (close #491)
This commit is contained in:
4
index.d.ts
vendored
4
index.d.ts
vendored
@@ -679,6 +679,10 @@ declare namespace WAWebJS {
|
|||||||
block: () => Promise<boolean>,
|
block: () => Promise<boolean>,
|
||||||
/** Unlocks this contact from WhatsApp */
|
/** Unlocks this contact from WhatsApp */
|
||||||
unblock: () => Promise<boolean>,
|
unblock: () => Promise<boolean>,
|
||||||
|
|
||||||
|
/** Gets the Contact's current "about" info. Returns null if you don't have permission to read their status. */
|
||||||
|
getAbout: () => Promise<string | null>,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ContactId {
|
export interface ContactId {
|
||||||
|
|||||||
@@ -153,6 +153,21 @@ class Contact extends Base {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the Contact's current "about" info. Returns null if you don't have permission to read their status.
|
||||||
|
* @returns {Promise<?string>}
|
||||||
|
*/
|
||||||
|
async getAbout() {
|
||||||
|
const about = await this.client.pupPage.evaluate(async (contactId) => {
|
||||||
|
return window.Store.Wap.statusFind(contactId);
|
||||||
|
}, this.id._serialized);
|
||||||
|
|
||||||
|
if (typeof about.status !== 'string')
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return about.status;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Contact;
|
module.exports = Contact;
|
||||||
Reference in New Issue
Block a user