chore: cleanup, ci workflows and formatting (#127064)
* ci: setup workflows, dependabot, labeler and commit linting * docs: update README, community files and issue templates * chore: configure prettier, editorconfig and format codebase * chore: restore changes lost during rebase * docs: adjust url for new logo * fix: align badges * chore: resolve conflicts and re-add temp lint
This commit is contained in:
parent
c2d978fd0a
commit
807efd502d
94 changed files with 6790 additions and 3547 deletions
|
|
@ -18,7 +18,7 @@ class Contact extends Base {
|
|||
constructor(client, data) {
|
||||
super(client);
|
||||
|
||||
if(data) this._patch(data);
|
||||
if (data) this._patch(data);
|
||||
}
|
||||
|
||||
_patch(data) {
|
||||
|
|
@ -108,7 +108,7 @@ class Contact extends Base {
|
|||
* @type {boolean}
|
||||
*/
|
||||
this.isBlocked = data.isBlocked;
|
||||
|
||||
|
||||
return super._patch(data);
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ class Contact extends Base {
|
|||
async getFormattedNumber() {
|
||||
return await this.client.getFormattedNumber(this.id._serialized);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the contact's countrycode, (1541859685@c.us) => (1)
|
||||
* @returns {Promise<string>}
|
||||
|
|
@ -135,14 +135,14 @@ class Contact extends Base {
|
|||
async getCountryCode() {
|
||||
return await this.client.getCountryCode(this.id._serialized);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the Chat that corresponds to this Contact.
|
||||
* Returns the Chat that corresponds to this Contact.
|
||||
* Will return null when getting chat for currently logged in user.
|
||||
* @returns {Promise<Chat>}
|
||||
*/
|
||||
async getChat() {
|
||||
if(this.isMe) return null;
|
||||
if (this.isMe) return null;
|
||||
|
||||
return await this.client.getChatById(this.id._serialized);
|
||||
}
|
||||
|
|
@ -152,11 +152,13 @@ class Contact extends Base {
|
|||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async block() {
|
||||
if(this.isGroup) return false;
|
||||
if (this.isGroup) return false;
|
||||
|
||||
await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const chat = await window.WWebJS.getChat(contactId);
|
||||
await (window.require('WAWebBlockContactAction')).blockContact({'contact':chat});
|
||||
await window
|
||||
.require('WAWebBlockContactAction')
|
||||
.blockContact({ contact: chat });
|
||||
}, this.id._serialized);
|
||||
|
||||
this.isBlocked = true;
|
||||
|
|
@ -168,11 +170,15 @@ class Contact extends Base {
|
|||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
async unblock() {
|
||||
if(this.isGroup) return false;
|
||||
if (this.isGroup) return false;
|
||||
|
||||
await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const contact = (window.require('WAWebCollections')).Contact.get(contactId);
|
||||
await (window.require('WAWebBlockContactAction')).unblockContact(contact);
|
||||
const contact = window
|
||||
.require('WAWebCollections')
|
||||
.Contact.get(contactId);
|
||||
await window
|
||||
.require('WAWebBlockContactAction')
|
||||
.unblockContact(contact);
|
||||
}, this.id._serialized);
|
||||
|
||||
this.isBlocked = false;
|
||||
|
|
@ -186,11 +192,12 @@ class Contact extends Base {
|
|||
async getAbout() {
|
||||
const about = await this.client.pupPage.evaluate(async (contactId) => {
|
||||
const wid = window.require('WAWebWidFactory').createWid(contactId);
|
||||
return (window.require('WAWebContactStatusBridge')).getStatus({'token':'', 'wid': wid});
|
||||
return window
|
||||
.require('WAWebContactStatusBridge')
|
||||
.getStatus({ token: '', wid: wid });
|
||||
}, this.id._serialized);
|
||||
|
||||
if (typeof about.status !== 'string')
|
||||
return null;
|
||||
if (typeof about.status !== 'string') return null;
|
||||
|
||||
return about.status;
|
||||
}
|
||||
|
|
@ -206,7 +213,7 @@ class Contact extends Base {
|
|||
/**
|
||||
* Gets the Contact's current status broadcast.
|
||||
* @returns {Promise<Broadcast>}
|
||||
*/
|
||||
*/
|
||||
async getBroadcast() {
|
||||
return await this.client.getBroadcastById(this.id._serialized);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue