Skip to content

Commit

Permalink
feat: getAllChatsTransmission
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Feb 27, 2021
1 parent b703462 commit 6461f1f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,9 @@ await client.setChatState('[email protected]', 0 | 1 | 2);
## Retrieving Data

```javascript
//Retrieves all chats Transmission list
const transmission = await client.getAllChatsTransmission();

// Returns a list of mute and non-mute users
// "all" List all mutes
// "toMute" List all silent chats
Expand Down
12 changes: 12 additions & 0 deletions src/api/layers/retriever.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ export class RetrieverLayer extends SenderLayer {
return await this.page.evaluate(() => WAPI.getAllContacts());
}

/**
* Retrieves all chats Transmission list
* @returns array of [Chat]
*/
public async getAllChatsTransmission() {
return await this.page.evaluate(() => {
let chats = WAPI.getAllChats(),
filter = chats.filter((chat) => chat.kind === 'broadcast');
return filter;
});
}

/**
* Retrieves chat object of given contact id
* @param contactId
Expand Down

0 comments on commit 6461f1f

Please sign in to comment.