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:
Rajeh Taher 2021-10-30 06:33:38 +03:00 • committed by GitHub
commit 97a1d399ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;