fix: support new permissions in ChatPermissions
This commit is contained in:
parent
1ba366a12b
commit
0ca62ab375
1 changed files with 70 additions and 7 deletions
|
@ -55,6 +55,60 @@ export class ChatPermissions {
|
||||||
return !this.raw.sendGifs
|
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.
|
* Whether users can send games.
|
||||||
*
|
*
|
||||||
|
@ -82,6 +136,15 @@ export class ChatPermissions {
|
||||||
return !this.raw.embedLinks
|
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.
|
* Whether users can send polls.
|
||||||
*
|
*
|
||||||
|
@ -113,6 +176,13 @@ export class ChatPermissions {
|
||||||
return !this.raw.pinMessages
|
return !this.raw.pinMessages
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether users can pin messages
|
||||||
|
*/
|
||||||
|
get canManageTopics(): boolean {
|
||||||
|
return !this.raw.manageTopics
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UNIX date until which these permissions are valid,
|
* UNIX date until which these permissions are valid,
|
||||||
* or `null` if forever.
|
* or `null` if forever.
|
||||||
|
@ -126,10 +196,3 @@ export class ChatPermissions {
|
||||||
}
|
}
|
||||||
|
|
||||||
makeInspectable(ChatPermissions)
|
makeInspectable(ChatPermissions)
|
||||||
|
|
||||||
/**
|
|
||||||
* Chat permissions that are used as an input for API methods.
|
|
||||||
*/
|
|
||||||
export type InputChatPermissions = {
|
|
||||||
[k in Exclude<keyof ChatPermissions, 'raw'>]?: boolean
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue