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:
parent
d29eaf7def
commit
91217f87ba
1 changed files with 41 additions and 20 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue