mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
Format phone numbers (#650)
* 📦 Declared NumberInfo in store * 📝 Add client.js functionality * 🚨 eslint just admires singlequote strings * 📝 Add shortcuts to using client method * ♿ Adding parity between the ids * ♿ Same method name parity * 🚨 ESLint indentation error. * 🚨 ESLint doublequote string error. * 🎨 Proposed changes * 🎨 Fixed badly done code :v and applied proposed changes. * ⚡ fixed calling the wrong function (sigh) * ⚡ Fixed missing try-catch code. * 🚨 Fixes ESLint indentation errors. * ⚡ fix the documentation issues. * 🏷️ typescript * 🏷️ Typo in function name Co-authored-by: Rajeh Taher <rajeh@reforward.tk>
This commit is contained in:
@@ -108,7 +108,7 @@ class Contact extends Base {
|
||||
* @type {boolean}
|
||||
*/
|
||||
this.isBlocked = data.isBlocked;
|
||||
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
@@ -120,6 +120,22 @@ class Contact extends Base {
|
||||
return await this.client.getProfilePicUrl(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contact's formatted phone number, (12345678901@c.us) => (+1 (234) 5678-901)
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getFormattedNumber() {
|
||||
return await this.client.getFormattedNumber(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the contact's countrycode, (1541859685@c.us) => (1)
|
||||
* @returns {Promise<string>}
|
||||
*/
|
||||
async getCountryCode() {
|
||||
return await this.client.getCountryCode(this.id._serialized);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Chat that corresponds to this Contact.
|
||||
* Will return null when getting chat for currently logged in user.
|
||||
@@ -178,4 +194,4 @@ class Contact extends Base {
|
||||
|
||||
}
|
||||
|
||||
module.exports = Contact;
|
||||
module.exports = Contact;
|
||||
|
||||
Reference in New Issue
Block a user