Skip to content

Commit 4958926

Browse files
authored
fix: Fixed getGroupInfoFromInviteCode (close #2825, close #2827, close #2828) (#2829)
* Interface update on sendQueryGroupInvite.ts * Updated interface on getGroupInfoFromInviteCode.ts
1 parent 1e4a2d0 commit 4958926

File tree

2 files changed

+37
-34
lines changed

2 files changed

+37
-34
lines changed

src/group/functions/getGroupInfoFromInviteCode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export async function getGroupInfoFromInviteCode(inviteCode: string) {
3333
inviteCode = inviteCode.replace('https://', '');
3434
inviteCode = inviteCode.replace('http://', '');
3535

36-
const result = await sendQueryGroupInvite(inviteCode).catch(() => null);
36+
const result = (await sendQueryGroupInvite(inviteCode).catch(() => null))?.groupInfo;
3737

3838
if (!result) {
3939
throw new WPPError('invalid_invite_code', 'Invalid Invite Code', {
@@ -43,7 +43,7 @@ export async function getGroupInfoFromInviteCode(inviteCode: string) {
4343

4444
return {
4545
...result,
46-
descOwner: result.descOwner?.toString(),
46+
descOwner: result.subjectOwner?.toString(),
4747
id: result.id.toString(),
4848
owner: result.owner?.toString(),
4949
participants: result.participants.map((p) => ({

src/whatsapp/functions/sendQueryGroupInvite.ts

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,40 +18,43 @@ import { Wid } from '..';
1818
import { exportModule } from '../exportModule';
1919

2020
export interface QueryGroupInviteResult {
21-
announce: boolean;
22-
creation: number;
23-
/** description of the group; linebreaks are formatted using `"\n"` */
24-
desc: string;
25-
descId: string;
26-
descOwner?: Wid;
27-
descTime: number;
28-
id: Wid;
29-
noFrequentlyForwarded: boolean;
30-
owner?: Wid;
31-
parent: boolean;
32-
participants: {
21+
groupInfo: {
22+
announce: boolean;
23+
creation: number;
24+
/** description of the group; linebreaks are formatted using `"\n"` */
25+
desc: string;
26+
descId: string;
27+
descOwner?: Wid;
28+
descTime: number;
3329
id: Wid;
34-
isAdmin: boolean;
35-
isSuperAdmin: boolean;
36-
}[];
37-
pvId?: string;
38-
restrict: boolean;
39-
/** how many members the group currently has */
40-
size: number;
30+
noFrequentlyForwarded: boolean;
31+
owner?: Wid;
32+
parent: boolean;
33+
participants: {
34+
id: Wid;
35+
isAdmin: boolean;
36+
isSuperAdmin: boolean;
37+
}[];
38+
pvId?: string;
39+
restrict: boolean;
40+
/** how many members the group currently has */
41+
size: number;
42+
status: number;
43+
/** title of the group */
44+
subject: string;
45+
subjectOwner?: Wid;
46+
subjectTime: number;
47+
support: boolean;
48+
suspended: boolean;
49+
isParentGroup: boolean;
50+
isParentGroupClosed: boolean;
51+
defaultSubgroup: boolean;
52+
generalSubgroup: boolean;
53+
membershipApprovalMode: boolean;
54+
isLidAddressingMode: boolean;
55+
generalChatAutoAddDisabled: boolean;
56+
};
4157
status: number;
42-
/** title of the group */
43-
subject: string;
44-
subjectOwner?: Wid;
45-
subjectTime: number;
46-
support: boolean;
47-
suspended: boolean;
48-
isParentGroup: boolean;
49-
isParentGroupClosed: boolean;
50-
defaultSubgroup: boolean;
51-
generalSubgroup: boolean;
52-
membershipApprovalMode: boolean;
53-
isLidAddressingMode: boolean;
54-
generalChatAutoAddDisabled: boolean;
5558
}
5659

5760
/** @whatsapp 10790

0 commit comments

Comments
 (0)