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

getInviteCode method is not working on 2.3000.xx #3007

Closed
1 task done
khsoh opened this issue May 4, 2024 · 4 comments · Fixed by #3029
Closed
1 task done

getInviteCode method is not working on 2.3000.xx #3007

khsoh opened this issue May 4, 2024 · 4 comments · Fixed by #3029
Labels
bug Something isn't working v2.3000.xx The issue specifically relates to WWeb v2.3000.xx

Comments

@khsoh
Copy link

khsoh commented May 4, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

My code has been working for a long time and then stopped working about 1 day ago. I found that the getInviteCode() method for GroupChat is not working - even though the bot is an admin of the chat group (I know that this method should only be called if the bot is part of the chat group)``

Expected behavior

I expected the invite code to be returned when this method is called.

Steps to Reproduce the Bug or Issue

  1. Get group chats that this bot belongs to
  2. call getInviteCode of chats where bot is admin of group

Relevant Code

let chats = await client.getChats();
chats = chats.filter(c => c.isGroup && !c.groupMetadata.isParentGroup && !c.groupMetadata.announce);
for (const chat of chats) {
  // get participant info of this bot for this chat
  let pid = chat.participants.find(p => p.id._serialized == client.info.wid._serialized);
  if (pid.isAdmin) {
    // Only print invite code if bot is admin of this group
    let inviteCode = await chat.getInviteCode();
    console.log(`Invite code: ${inviteCode}`);
  }
}

Browser Type

Chromium

WhatsApp Account Type

Standard

Does your WhatsApp account have multidevice enabled?

Yes, I am using Multi Device

Environment

Linux, Ubuntu 22.04.4 LTS
Node 20.11.1
WhatsApp Web version 2.3000.1013269842

Additional context

No response

@khsoh khsoh added the bug Something isn't working label May 4, 2024
@alechkos alechkos changed the title getInviteCode method is not working for GroupChat getInviteCode method is not working on 2.3000.xx May 4, 2024
@alechkos alechkos added the v2.3000.xx The issue specifically relates to WWeb v2.3000.xx label May 4, 2024
@MaitoV
Copy link

MaitoV commented May 6, 2024

I'm experiencing the same issue with version 2.3000.xx and webpack-exodus.

@smsoousa

This comment was marked as off-topic.

themazim pushed a commit to themazim/whatsapp-web.js that referenced this issue May 12, 2024
themazim pushed a commit to themazim/whatsapp-web.js that referenced this issue May 12, 2024
@themazim
Copy link

themazim commented May 12, 2024

Feel free to test and review this fix: themazim@5e94f29

PR: #3029

@smsoousa

This comment was marked as off-topic.

@alechkos alechkos linked a pull request May 14, 2024 that will close this issue
6 tasks
alechkos added a commit that referenced this issue May 15, 2024
* fix getInviteCode for group (#3007)

* move changes to proper getInviteCode method.

* style fix

* refactor: add try-catch in a case the user is not a group admin

* refactor: handle promise properly

---------

Co-authored-by: Sven Neumann <s.neumann@websix.de>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working v2.3000.xx The issue specifically relates to WWeb v2.3000.xx
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants