Skip to content

Commit

Permalink
fix: Fixed WPP.chat.mute function (close #1772) (#1780)
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Mar 27, 2024
1 parent 77ee255 commit e5e293d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
9 changes: 6 additions & 3 deletions src/chat/functions/mute.ts
Expand Up @@ -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,
};
}
2 changes: 1 addition & 1 deletion src/chat/functions/unmute.ts
Expand Up @@ -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 });
}
18 changes: 11 additions & 7 deletions src/whatsapp/models/MuteModel.ts
Expand Up @@ -54,14 +54,18 @@ export declare class MuteModel extends Model<MuteCollection> {
proterties?: ModelPropertiesContructor<MuteModel>,
options?: ModelOptions
);
setMute(e?: any, t?: any): any;
mute(
expiration: number,
sendAction?: boolean,
sequence?: number
): Promise<number>;
setMute(
expiration?: number,
isAutoMuted?: boolean,
sendDevice?: boolean
): any;
mute(args: {
expiration: number;
sendDevice?: boolean;
isAutoMuted?: boolean;
}): Promise<number>;
canMute(): boolean;
unmute(sendAction?: boolean, sequence?: number): Promise<void>;
unmute(args: { sendDevice?: boolean }): Promise<void>;
getCollection(): MuteCollection;
}

Expand Down

0 comments on commit e5e293d

Please sign in to comment.