1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

improve copying functions in chat permissions

This commit is contained in:
InsanusMokrassar 2023-02-06 11:36:00 +06:00
parent 3be8ddae74
commit cb7a343208

View File

@ -190,7 +190,7 @@ interface ChatPermissions {
* Copying current instance as [ChatPermissions], but realizations of this interface may differently override this * Copying current instance as [ChatPermissions], but realizations of this interface may differently override this
* method * method
*/ */
fun copyDefault( fun copyGranular(
canSendMessages: Boolean? = this.canSendMessages, canSendMessages: Boolean? = this.canSendMessages,
canSendAudios: Boolean? = this.canSendAudios, canSendAudios: Boolean? = this.canSendAudios,
canSendDocuments: Boolean? = this.canSendDocuments, canSendDocuments: Boolean? = this.canSendDocuments,
@ -219,6 +219,33 @@ interface ChatPermissions {
canInviteUsers = canInviteUsers, canInviteUsers = canInviteUsers,
canPinMessages = canPinMessages canPinMessages = canPinMessages
) )
/**
* Copying current instance as [ChatPermissions], but realizations of this interface may differently override this
* method
*/
fun copyCommon(
canSendPolls: Boolean? = this.canSendPolls,
canSendOtherMessages: Boolean? = this.canSendOtherMessages,
canAddWebPagePreviews: Boolean? = this.canAddWebPagePreviews,
canChangeInfo: Boolean? = this.canChangeInfo,
canInviteUsers: Boolean? = this.canInviteUsers,
canPinMessages: Boolean? = this.canPinMessages
): ChatPermissions = ChatPermissions(
canSendMessages = null,
canSendAudios = null,
canSendDocuments = null,
canSendPhotos = null,
canSendVideos = null,
canSendVideoNotes = null,
canSendVoiceNotes = null,
canSendPolls = canSendPolls,
canSendOtherMessages = canSendOtherMessages,
canAddWebPagePreviews = canAddWebPagePreviews,
canChangeInfo = canChangeInfo,
canInviteUsers = canInviteUsers,
canPinMessages = canPinMessages
)
} }
val LeftRestrictionsChatPermissions = ChatPermissions( val LeftRestrictionsChatPermissions = ChatPermissions(