fix: support new permissions in ChatPermissions

This commit is contained in:
alina 🌸 2023-10-12 04:50:47 +03:00
parent 1ba366a12b
commit 0ca62ab375
Signed by: teidesu
SSH key fingerprint: SHA256:uNeCpw6aTSU4aIObXLvHfLkDa82HWH9EiOj9AXOIRpI

View file

@ -55,6 +55,60 @@ export class ChatPermissions {
return !this.raw.sendGifs
}
/**
* Whether users can send photos.
*
* Implies {@link canSendMedia}
*/
get canSendPhotos(): boolean {
return !this.raw.sendPhotos
}
/**
* Whether users can send videos.
*
* Implies {@link canSendMedia}
*/
get canSendVideos(): boolean {
return !this.raw.sendVideos
}
/**
* Whether users can send round videos (i.e. video notes).
*
* Implies {@link canSendMedia}
*/
get canSendRoundVideos(): boolean {
return !this.raw.sendRoundvideos
}
/**
* Whether users can send audio files.
*
* Implies {@link canSendMedia}
*/
get canSendAudios(): boolean {
return !this.raw.sendAudios
}
/**
* Whether users can send voice notes.
*
* Implies {@link canSendMedia}
*/
get canSendVoices(): boolean {
return !this.raw.sendVoices
}
/**
* Whether users can send files.
*
* Implies {@link canSendMedia}
*/
get canSendFiles(): boolean {
return !this.raw.sendDocs
}
/**
* Whether users can send games.
*
@ -82,6 +136,15 @@ export class ChatPermissions {
return !this.raw.embedLinks
}
/**
* Whether users can send text messages.
*
* Implies {@link canSendMessages}
*/
get canSendText(): boolean {
return !this.raw.sendPlain
}
/**
* Whether users can send polls.
*
@ -113,6 +176,13 @@ export class ChatPermissions {
return !this.raw.pinMessages
}
/**
* Whether users can pin messages
*/
get canManageTopics(): boolean {
return !this.raw.manageTopics
}
/**
* UNIX date until which these permissions are valid,
* or `null` if forever.
@ -126,10 +196,3 @@ export class ChatPermissions {
}
makeInspectable(ChatPermissions)
/**
* Chat permissions that are used as an input for API methods.
*/
export type InputChatPermissions = {
[k in Exclude<keyof ChatPermissions, 'raw'>]?: boolean
}