From 5215e8a31598ff6e1c3e8332355dd7be000ff1cd Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Fri, 22 Sep 2023 22:53:14 +0600 Subject: [PATCH] add support of stories rights --- .../commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt | 3 +++ .../types/chat/member/AdministratorChatMemberImpl.kt | 8 +++++++- .../tgbotapi/types/chat/member/ChatAdministratorRights.kt | 3 +++ .../types/chat/member/ChatAdministratorRightsImpl.kt | 8 +++++++- .../inmo/tgbotapi/types/chat/member/OwnerChatMember.kt | 6 ++++++ 5 files changed, 26 insertions(+), 2 deletions(-) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt index 91c69503c8..2faba470e1 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/Common.kt @@ -275,6 +275,9 @@ const val correctOptionIdField = "correct_option_id" const val allowsMultipleAnswersField = "allows_multiple_answers" const val isAnonymousField = "is_anonymous" const val canManageTopicsField = "can_manage_topics" +const val canPostStoriesField = "can_post_stories" +const val canEditStoriesField = "can_edit_stories" +const val canDeleteStoriesField = "can_delete_stories" const val captionEntitiesField = "caption_entities" const val hasSpoilerField = "has_spoiler" const val loginUrlField = "login_url" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt index 4e2cf26eac..587f64e815 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/AdministratorChatMemberImpl.kt @@ -35,7 +35,13 @@ data class AdministratorChatMemberImpl( @SerialName(customTitleField) override val customTitle: String? = null, @SerialName(canManageTopicsField) - override val canManageTopics: Boolean = false + override val canManageTopics: Boolean = false, + @SerialName(canPostStoriesField) + override val canPostStories: Boolean = false, + @SerialName(canEditStoriesField) + override val canEditStories: Boolean = false, + @SerialName(canDeleteStoriesField) + override val canDeleteStories: Boolean = false ) : AdministratorChatMember { @SerialName(statusField) @Required diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRights.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRights.kt index 4e68b58147..1436523014 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRights.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRights.kt @@ -16,4 +16,7 @@ sealed interface ChatAdministratorRights : SpecialChatAdministratorRights { val canPromoteMembers: Boolean val canPostMessages: Boolean val canEditMessages: Boolean + val canPostStories: Boolean + val canEditStories: Boolean + val canDeleteStories: Boolean } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt index 823f3ebebb..287f45f021 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatAdministratorRightsImpl.kt @@ -29,5 +29,11 @@ data class ChatAdministratorRightsImpl( @SerialName(isAnonymousField) override val isAnonymous: Boolean = false, @SerialName(canManageTopicsField) - override val canManageTopics: Boolean = false + override val canManageTopics: Boolean = false, + @SerialName(canPostStoriesField) + override val canPostStories: Boolean = false, + @SerialName(canEditStoriesField) + override val canEditStories: Boolean = false, + @SerialName(canDeleteStoriesField) + override val canDeleteStories: Boolean = false ) : ChatAdministratorRights diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt index 428aedd0d8..446af8be73 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/OwnerChatMember.kt @@ -36,6 +36,12 @@ data class OwnerChatMember( override val canManageChat: Boolean = true @Transient override val canManageTopics: Boolean = true + @Transient + override val canPostStories: Boolean = true + @Transient + override val canEditStories: Boolean = true + @Transient + override val canDeleteStories: Boolean = true @SerialName(statusField) @Required private val type: String = "creator"