diff --git a/packages/client/src/types/peers/chat-permissions.ts b/packages/client/src/types/peers/chat-permissions.ts index 104d0478..fde3d14e 100644 --- a/packages/client/src/types/peers/chat-permissions.ts +++ b/packages/client/src/types/peers/chat-permissions.ts @@ -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]?: boolean -}