diff --git a/src/lib/wapi/functions/get-group-invite-link.js b/src/lib/wapi/functions/get-group-invite-link.js index 7ab094ffe..e2bfc6b10 100644 --- a/src/lib/wapi/functions/get-group-invite-link.js +++ b/src/lib/wapi/functions/get-group-invite-link.js @@ -17,7 +17,16 @@ export async function getGroupInviteLink(chatId) { var chat = Store.Chat.get(chatId); - if (!chat.isGroup) return ''; - await Store.GroupInvite.queryGroupInviteCode(chat); - return `https://chat.whatsapp.com/${chat.inviteCode}`; + if (!chat.isGroup) { + return ''; + } + let inviteCode = ''; + + if (chat.groupMetadata && chat.groupMetadata.inviteCode) { + inviteCode = chat.groupMetadata.inviteCode; + } else { + inviteCode = await Store.GroupInvite.sendQueryGroupInviteCode(chat.id); + } + + return `https://chat.whatsapp.com/${inviteCode}`; } diff --git a/src/lib/wapi/functions/revoke-invite-link.js b/src/lib/wapi/functions/revoke-invite-link.js index 54cd4e255..6f71467ff 100644 --- a/src/lib/wapi/functions/revoke-invite-link.js +++ b/src/lib/wapi/functions/revoke-invite-link.js @@ -18,6 +18,5 @@ export async function revokeGroupInviteLink(chatId) { var chat = Store.Chat.get(chatId); if (!chat.isGroup) return false; - await Store.GroupInvite.revokeGroupInvite(chat); - return true; + return await Store.GroupInvite.sendRevokeGroupInviteCode(chat.id); } diff --git a/src/lib/wapi/store/store-objects.js b/src/lib/wapi/store/store-objects.js index 8343865c9..6ccec59eb 100644 --- a/src/lib/wapi/store/store-objects.js +++ b/src/lib/wapi/store/store-objects.js @@ -43,7 +43,7 @@ export const storeObjects = [ }, { id: 'GroupInvite', - conditions: (module) => (module.queryGroupInviteCode ? module : null), + conditions: (module) => (module.sendQueryGroupInviteCode ? module : null), }, { id: 'Wap',