fix: Chat.isMuted (#2999)

* fix: isMuted returns true or false

* docs: add missing parts

* refactor: apply simplification

* fix: update chat instance after calling mute/unmute

* stylee: clarify and fix docs

* fix: fix convertation of Date to timestamp

* refactor: small code refactor
This commit is contained in:
alechkos 2025-05-30 16:41:31 +03:00 • committed by GitHub
commit 91217f87ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -95,7 +95,7 @@ class Chat extends Base {
}
/**
* Set the message as seen
* Set the chat as seen
* @returns {Promise<Boolean>} result
*/
async sendSeen() {
@ -154,17 +154,25 @@ class Chat extends Base {
/**
* Mutes this chat forever, unless a date is specified
* @param {?Date} unmuteDate Date at which the Chat will be unmuted, leave as is to mute forever
* @param {?Date} unmuteDate Date when the chat will be unmuted, don't provide a value to mute forever
* @returns {Promise<{isMuted: boolean, muteExpiration: number}>}
*/
async mute(unmuteDate) {
return this.client.muteChat(this.id._serialized, unmuteDate);
const result = await this.client.muteChat(this.id._serialized, unmuteDate);
this.isMuted = result.isMuted;
this.muteExpiration = result.muteExpiration;
return result;
}
/**
* Unmutes this chat
* @returns {Promise<{isMuted: boolean, muteExpiration: number}>}
*/
async unmute() {
return this.client.unmuteChat(this.id._serialized);
const result = await this.client.unmuteChat(this.id._serialized);
this.isMuted = result.isMuted;
this.muteExpiration = result.muteExpiration;
return result;
}
/**