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

fix getInviteCode for group (#3007) #3029

Merged
merged 6 commits into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/structures/GroupChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,18 @@ class GroupChat extends Chat {
async getInviteCode() {
const codeRes = await this.client.pupPage.evaluate(async chatId => {
const chatWid = window.Store.WidFactory.createWid(chatId);
return window.Store.GroupInvite.queryGroupInviteCode(chatWid);
try {
return window.WWebJS.compareWwebVersions(window.Debug.VERSION, '>=', '2.3000.0')
? await window.Store.GroupInvite.queryGroupInviteCode(chatWid, true)
: await window.Store.GroupInvite.queryGroupInviteCode(chatWid);
}
catch (err) {
if(err.name === 'ServerStatusCodeError') return undefined;
throw err;
}
}, this.id._serialized);

return codeRes.code;
return codeRes?.code;
}

/**
Expand Down