mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 03:29:14 +00:00
Allow a chat to be muted indefinitely (#849)
* muteChat fixed * Update src/Client.js Co-authored-by: Pedro S. Lopez <pedroslopez@me.com> * Update src/Client.js Co-authored-by: Pedro S. Lopez <pedroslopez@me.com> * date fix Co-authored-by: Pedro S. Lopez <pedroslopez@me.com>
This commit is contained in:
@@ -765,15 +765,16 @@ class Client extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Mutes the Chat until a specified date
|
||||
* Mutes this chat forever, unless a date is specified
|
||||
* @param {string} chatId ID of the chat that will be muted
|
||||
* @param {Date} unmuteDate Date when the chat will be unmuted
|
||||
* @param {?Date} unmuteDate Date when the chat will be unmuted, leave as is to mute forever
|
||||
*/
|
||||
async muteChat(chatId, unmuteDate) {
|
||||
unmuteDate = unmuteDate ? unmuteDate.getTime() / 1000 : -1;
|
||||
await this.pupPage.evaluate(async (chatId, timestamp) => {
|
||||
let chat = await window.Store.Chat.get(chatId);
|
||||
await chat.mute.mute(timestamp, !0);
|
||||
}, chatId, unmuteDate.getTime() / 1000);
|
||||
}, chatId, unmuteDate || -1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user