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: Chat.isMuted #2999

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

fix: Chat.isMuted #2999

wants to merge 12 commits into from

Conversation

alechkos
Copy link
Collaborator

@alechkos alechkos commented May 1, 2024

PR Details

Description

Changes:

  1. Chat.isMuted property now shows valid value (and not undefined)
  2. Each time the Chat.mute or Chat.unmute methods are called, the isMuted and muteExpiration properties of Chat instance are updated as expected
  3. Methods Chat.mute, Chat.unmute, Client.muteChat, Client.unmuteChat now return
    Promise<{ isMuted: boolean, muteExpiration: number }> instead of Promise<void>, for more clarity

Related Issues

The PR closes #2781, closes #2800, closes #2801

You can try the fix by running one of the following commands:

  • NPM
npm install github:alechkos/whatsapp-web.js#fix-ismuted
  • YARN
yarn add github:alechkos/whatsapp-web.js#fix-ismuted

How Has The PR Been Tested

// client initialization...

client.on('message', async (msg) => {
    const chat = await msg.getChat(); // chat is unmuted here
    console.log(chat.mute(new Date(2038, 0, 19, 3, 14, 7))); // expected output: { isMuted: true, muteExpiration: 2147476447 }
    console.log(chat.isMuted, chat.muteExpiration); // expected output: true 2147476447
    console.log(chat.unmute()); // expected output: { isMuted: false, muteExpiration: 0 }
    console.log(chat.isMuted, chat.muteExpiration); // expected output: false 0
});

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/feature that would cause existing functionality to change)

Checklist

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

@alechkos alechkos marked this pull request as draft July 3, 2024 20:55
@cabiamdos

This comment was marked as outdated.

@alechkos alechkos marked this pull request as ready for review October 23, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants