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 "group_membership_request" event #2813

Merged
merged 2 commits into from
Apr 28, 2024
Merged

Conversation

Bauguelson
Copy link
Contributor

PR Details

Fix "group_membership_request" event #2516

Description

After investigating, I noticed replace "created_membership_requests" to "membership_approval_request" in src/Client.js solve the issue.

Motivation and Context

No event when there are new incoming membership requests

I was not receiving events using the demo code in #2516

client.on('group_membership_request', async (notification) => {
    /**
     * The example of the {@link notification} output:
     * {
     *     id: {
     *         fromMe: false,
     *         remote: 'groupId@g.us',
     *         id: '123123123132132132',
     *         participant: 'number@c.us',
     *         _serialized: 'false_groupId@g.us_123123123132132132_number@c.us'
     *     },
     *     body: '',
     *     type: 'created_membership_requests',
     *     timestamp: 1694456538,
     *     chatId: 'groupId@g.us',
     *     author: 'number@c.us',
     *     recipientIds: []
     * }
     *
     */
    console.log(notification);
    /** You can approve or reject the newly appeared membership request: */
    await client.approveGroupMembershipRequests(notification.chatId, notification.author);
    await client.rejectGroupMembershipRequests(notification.chatId, notification.author);
});

How Has This Been Tested

Types of account:

  • Business

Environement:

  • Windows Server 2016
    • Whatsapp Web Version 2.2410.1
    • whatsapp-web.js@1.23.0
    • puppeteer@22.2.0
  • Puppeteer

Types of changes

  • Dependency change
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation accordingly (index.d.ts).

Sorry, something went wrong.

Bauguelson and others added 2 commits March 11, 2024 19:49

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link
Collaborator

@alechkos alechkos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job, thank you
Tested on WWeb v2.2412.54

Copy link
Collaborator

@shirser121 shirser121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot

@alechkos alechkos merged commit aa26876 into pedroslopez:main Apr 28, 2024
1 check passed
neekaru pushed a commit to KDevRev/whatsapp-web.js that referenced this pull request May 2, 2024
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
aleborile added a commit to Condo-AI/whatsapp-web.js that referenced this pull request Jun 14, 2024

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
* fix: logo link (pedroslopez#2994)

* fix: logo link

* fix: fix broken link in readme file

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Update Client.js (pedroslopez#2813)

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Add members settings (pedroslopez#2788)

* Update GroupChat.js

* Update index.d.ts

* style: clarify method doc

* refactor: add additional check

* fix: provide valid error name

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Fix: delete lines that remove data from this._data (pedroslopez#2958)

* feat: `vote_update` event (pedroslopez#2596)

* Merge branch 'add-polls' into polls-ext

* added listener to poll votes

* added isUnvote property

* added option for custom message secret

* usage example updated

* added logic for catching removed votes

* usage example updated

* fixed logic for poll vote events

* temp usage example

* No more `isCurrentState`

* messageSecret converted to array

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>

* docs updated

* we already have messageSecret in vote.parentMessage

* PollVote.selectedOptions changed to be similar to pollOptions

* docs fixed

* window.injectToFunction clarifications

* minor clarifications

* fix: typo

* style: fix broken link in readme file

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>

* 1.23.1-alpha.6

* Expose chat `pinned` property (pedroslopez#2771)

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Make an NPM release via GitHub (pedroslopez#2942)

* Update release.yml

* Update publish

* Update release.yml

* Update publish

* Update publish: publish new docs before new version release

* Update publish

* Update publish

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* 1.24.0

---------

Co-authored-by: dark <61346219+qzdark@users.noreply.github.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Bauguelson <143646733+Bauguelson@users.noreply.github.com>
Co-authored-by: Gulg <65360617+GulgDev@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: WWebJS Bot <hello@wwebjs.dev>
Co-authored-by: Thomas <1688389+Rakambda@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
aleborile added a commit to Condo-AI/whatsapp-web.js that referenced this pull request Jun 14, 2024

Partially verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
* fix: logo link (pedroslopez#2994)

* fix: logo link

* fix: fix broken link in readme file

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Update Client.js (pedroslopez#2813)

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Add members settings (pedroslopez#2788)

* Update GroupChat.js

* Update index.d.ts

* style: clarify method doc

* refactor: add additional check

* fix: provide valid error name

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Fix: delete lines that remove data from this._data (pedroslopez#2958)

* feat: `vote_update` event (pedroslopez#2596)

* Merge branch 'add-polls' into polls-ext

* added listener to poll votes

* added isUnvote property

* added option for custom message secret

* usage example updated

* added logic for catching removed votes

* usage example updated

* fixed logic for poll vote events

* temp usage example

* No more `isCurrentState`

* messageSecret converted to array

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>

* docs updated

* we already have messageSecret in vote.parentMessage

* PollVote.selectedOptions changed to be similar to pollOptions

* docs fixed

* window.injectToFunction clarifications

* minor clarifications

* fix: typo

* style: fix broken link in readme file

---------

Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>

* 1.23.1-alpha.6

* Expose chat `pinned` property (pedroslopez#2771)

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* Make an NPM release via GitHub (pedroslopez#2942)

* Update release.yml

* Update publish

* Update release.yml

* Update publish

* Update publish: publish new docs before new version release

* Update publish

* Update publish

---------

Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>

* 1.24.0

---------

Co-authored-by: dark <61346219+qzdark@users.noreply.github.com>
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
Co-authored-by: Bauguelson <143646733+Bauguelson@users.noreply.github.com>
Co-authored-by: Gulg <65360617+GulgDev@users.noreply.github.com>
Co-authored-by: Shir Serlui <70711723+shirser121@users.noreply.github.com>
Co-authored-by: tuyuribr <45042245+tuyuribr@users.noreply.github.com>
Co-authored-by: WWebJS Bot <hello@wwebjs.dev>
Co-authored-by: Thomas <1688389+Rakambda@users.noreply.github.com>
Co-authored-by: Rajeh Taher <rajeh@reforward.dev>
longgtruong pushed a commit to OpenDeur/whatsapp-web.js that referenced this pull request Jul 1, 2024
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
longgtruong pushed a commit to OpenDeur/whatsapp that referenced this pull request Jul 17, 2024
Co-authored-by: alechkos <93551621+alechkos@users.noreply.github.com>
augustos0204 pushed a commit to augustos0204/whatsapp-web.js that referenced this pull request Jul 20, 2024
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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants