Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes some wrong types, also added a lot variable that is not exists in the type, but exists in the message object #3213

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
167 changes: 140 additions & 27 deletions src/api/model/group-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,28 @@ import { Contact } from './contact'

export interface Participant {
contact: Contact,
id: NonSerializedId,
id: ContactId,
isAdmin: boolean,
isSuperAdmin: boolean
}

export interface PastParticipant {
id: ContactId,
leaveTs: number,
leaveReason: "Removed" | "Left"
}

export interface membershipApprovalRequest {
id: ContactId,
t: number
addedBy: ContactId
/**
* The only known value is 'LinkedGroupJoin'
*/
requestMethod: string
parentGroupId: GroupId
}

export interface GroupMetadata {
/**
* The chat id of the group [[GroupChatId]]
Expand All @@ -20,55 +37,151 @@ export interface GroupMetadata {
/**
* The id of the owner of the group [[ContactId]]
*/
owner: NonSerializedId;
owner: ContactId;
/**
* An array of participants in the group
* The name of the Group
*/
participants: Participant[];
subject: string;
/**
* Unknown.
* The creation time of the group
*/
pendingParticipants: Participant[];
subjectTime: number;
/**
* The description of the group
*/
desc ?: string;
/**
* Unknown
*/
descId ?: string;
/**
* The timestamp of when the description was last updated, it appear to be only exists within communities group?
*/
descTime ?: number;
/**
* The account that set the description last.
*/
descOwner ?: ContactId;
/**
*
* Unknown use
*/
trusted ?: boolean;
restrict : boolean;
/**
* Unknown use
*/
announce : boolean;
/**
* Unknown use
*/
noFrequentlyForwarded : boolean;
/**
* Unknown use
*/
ephemeralDuration : number;
/**
* Is member need to be approved to join
*/
membershipApprovalMode : boolean;
/**
* Member add mode
*/
memberAddMode ?: "all_member_add" | "admin_add"
/**
* Unknown use
*/
reportToAdminMode ?: boolean;
/**
* Group size
*/
size : number;
/**
* Not sure what this represents
*/
support ?: boolean;
/**
* Not sure what this represents
*/
suspended ?: boolean;
/**
* Not sure what this represents
*/
support ?: boolean;
terminated ?: boolean;
/**
* Not sure what this represents
*/
uniqueShortNameMap : Record<any, any>;
/**
* Not sure what this represents
*/
isLidAddressingMode : boolean;
/**
* Is this group a parent group (a.k.a community)
*/
isParentGroup ?: boolean
/**
* The type of group
*/
groupType: 'DEAFULT' | 'SUBGROUP' | 'COMMUNITY'
/**
* Communities have a default group chat
*/
defaultSubgroup: boolean
/**
*
*/
isParentGroupClosed: boolean
/**
* List of Group IDs that the host account has joined as part of this community
*/
joinedSubgroups: GroupId[]
isParentGroup : boolean
/**
*
*/
isParentGroupClosed: boolean
/**
* The id of the parent group [[GroupId]]
*/
parentGroup: GroupId
/**
* Communities have a default group chat
*/
defaultSubgroup: boolean
/**
* Unknown
*/
generalSubgroup: boolean
/**
* Unknown
*/
generalChatAutoAddDisabled: boolean
/**
* Allow non admin to create subgroups
*/
allowNonAdminSubGroupCreation: boolean
/**
* Unknown
*/
lastActivityTimestamp?: number
/**
* Unknown
*/
incognito: boolean
/**
* Unknown
*/
hasCapi ?: boolean
/**
* An array of participants in the group
*/
participants: Participant[];
/**
* Unknown.
*/
pendingParticipants: Participant[];
/**
* An array of past participants, could be an empty array
*/
pastParticipants: PastParticipant[];
/**
* members that is not approved to join group yet, could be an empty array if the bot is not an admin
*/
membershipApprovalRequests: membershipApprovalRequest[];
/**
* Unknown, usually an empty array, please check if you found any value
*/
subgroupSuggestions: []
/**
* The type of group - it seems to never appeared in the message
*/
groupType?: 'DEFAULT' | 'SUBGROUP' | 'COMMUNITY'
/**
* List of Group IDs that the host account has joined as part of this community - it seems to never appeared in the message
*/
joinedSubgroups: GroupId[]
}

export enum groupChangeEvent {
Expand Down Expand Up @@ -128,4 +241,4 @@ export interface GenericGroupChangeEvent {
* Type of the event
*/
type: 'picutre' | 'create' | 'delete' | 'subject' | 'revoke_invite' | 'description' | 'restrict' | 'announce' | 'no_frequently_forwarded' | 'announce_msg_bounce' | 'add' | 'remove' | 'demote' | 'promote' | 'invite' | 'leave' | 'modify' | 'v4_add_invite_sent' | 'v4_add_invite_join' | 'growth_locked' | 'growth_unlocked' | 'linked_group_join'
}
}