Skip to content

Commit

Permalink
feat: getChatGroupNewMsg
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Feb 27, 2021
1 parent 06e641c commit 04f2200
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,9 @@ const chats = await client.getAllChats();
// Retrieve all groups
const chats = await client.getAllChatsGroups();

//Retrieve all groups new messages
const groupNewMsg = await client.getChatGroupNewMsg();

// Retrieve profile fic (as url)
const url = await client.getProfilePicFromServer('000000000000@c.us');

Expand Down
11 changes: 11 additions & 0 deletions src/api/layers/group.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,17 @@ export class GroupLayer extends RetrieverLayer {
});
}

/**
* Retrieve all groups new messages
* @returns array of groups
*/
public async getChatGroupNewMsg() {
return await this.page.evaluate(() => {
let chats = WAPI.getAllChatsWithNewMsg();
return chats.filter((chat) => chat.kind === 'group');
});
}

/**
* Removes the host device from the group
* @param groupId group id
Expand Down

0 comments on commit 04f2200

Please sign in to comment.