Skip to content

Commit

Permalink
fix: Added missing group chat properties (#2362)
Browse files Browse the repository at this point in the history
  • Loading branch information
gekkedev authored Oct 24, 2024
1 parent 95137f0 commit 9fbc5ae
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/api/layers/group.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export class GroupLayer extends RetrieverLayer {
}

/**
* Returns group members [Contact] objects
* Returns current group members as [Contact] objects
* For previous members, see `groupMetadata.pastParticipants`.
* @category Group
* @param groupId
*/
Expand Down
6 changes: 6 additions & 0 deletions src/api/model/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ export interface Chat {
lastReceivedKey: MessageId;
t: number;
unreadCount: number;
/** whether the message was archived */
archive: boolean;
muteExpiration: number;
name: string;
/** Whatsapp provides us with built-in spam detection and this is its indicator */
notSpam: boolean;
pin: number;
msgs: null;
kind: string;
isAnnounceGrpRestrict: boolean;
ephemeralDuration: number;
/** whether the chat is visually open in WhatsApp Web (see `UILayer.openChat()`) */
hasChatBeenOpened: boolean;
unreadMentionCount: number;
hasUnreadMention: boolean;
Expand All @@ -47,4 +50,7 @@ export interface Chat {
contact: Contact;
groupMetadata: GroupMetadata;
presence: Presence;
restricted: boolean;
/** if you can send messages into the chat without having to be an admin (refers to group chats, see the `isGroup` attribute) */
hasOpened: boolean;
}
16 changes: 14 additions & 2 deletions src/api/model/group-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface GroupMetadata {
descTime: number;
descOwner: Wid;
restrict: boolean;
/** whether it is an announcement channel of a community */
announce: boolean;
noFrequentlyForwarded: boolean;
ephemeralDuration: number;
Expand All @@ -58,11 +59,22 @@ export interface GroupMetadata {
incognito: boolean;
hasCapi: boolean;
displayCadminPromotion: boolean;
participants: any[];
/** Current members of the group. See `pastParticipants` for former members. */
participants: {
id: Wid;
isAdmin: boolean;
isSuperAdmin: boolean;
}[];
/** members who applied for membership but still need admin approval */
pendingParticipants: any[];
/** former members who left the group or were kicked out */
pastParticipants: any[];
pastParticipants: {
id: Wid;
/** UNIX timestamp in seconds of when the leaving occurred */
leaveTs: number;
/** was leaving volumtary (`"Left"`) or forceful (`"Removed"`) */
leaveReason: 'Left' | 'Removed';
}[];
membershipApprovalRequests: any[];
subgroupSuggestions: any[];
}

0 comments on commit 9fbc5ae

Please sign in to comment.