From e5e293debd4a99a537919a7285c86ad674e19f47 Mon Sep 17 00:00:00 2001 From: Cleiton Carvalho Date: Tue, 26 Mar 2024 23:42:45 -0300 Subject: [PATCH] fix: Fixed WPP.chat.mute function (close #1772) (#1780) --- src/chat/functions/mute.ts | 9 ++++++--- src/chat/functions/unmute.ts | 2 +- src/whatsapp/models/MuteModel.ts | 18 +++++++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/chat/functions/mute.ts b/src/chat/functions/mute.ts index 0551fad709..55c1337b38 100644 --- a/src/chat/functions/mute.ts +++ b/src/chat/functions/mute.ts @@ -67,11 +67,14 @@ export async function mute( }); } - await chat.mute.setMute(expiration); - + await chat.mute.mute({ + expiration, + isAutoMuted: false, + sendDevice: true, + }); return { wid, expiration: chat.mute.expiration, - isMuted: chat.mute.isMuted, + isMuted: chat.mute.expiration !== 0, }; } diff --git a/src/chat/functions/unmute.ts b/src/chat/functions/unmute.ts index 5a84dedfef..fb7ec28857 100644 --- a/src/chat/functions/unmute.ts +++ b/src/chat/functions/unmute.ts @@ -32,5 +32,5 @@ export async function unmute(chatId: string | Wid) { const chat = assertGetChat(wid); - return chat.mute.unmute(true); + return chat.mute.unmute({ sendDevice: true }); } diff --git a/src/whatsapp/models/MuteModel.ts b/src/whatsapp/models/MuteModel.ts index db1cddf627..f102774fe3 100644 --- a/src/whatsapp/models/MuteModel.ts +++ b/src/whatsapp/models/MuteModel.ts @@ -54,14 +54,18 @@ export declare class MuteModel extends Model { proterties?: ModelPropertiesContructor, options?: ModelOptions ); - setMute(e?: any, t?: any): any; - mute( - expiration: number, - sendAction?: boolean, - sequence?: number - ): Promise; + setMute( + expiration?: number, + isAutoMuted?: boolean, + sendDevice?: boolean + ): any; + mute(args: { + expiration: number; + sendDevice?: boolean; + isAutoMuted?: boolean; + }): Promise; canMute(): boolean; - unmute(sendAction?: boolean, sequence?: number): Promise; + unmute(args: { sendDevice?: boolean }): Promise; getCollection(): MuteCollection; }