From cd596cc66d8cf3cd1e409eee97c2cdc7605194e8 Mon Sep 17 00:00:00 2001 From: madhead Date: Fri, 3 Feb 2023 22:14:35 +0100 Subject: [PATCH] Replaced the fields `can_send_media_messages` in the classes `RestrictedChatMember` and `ChatPermissions` with separate fields `can_send_audios`, `can_send_documents`, `can_send_photos`, `can_send_videos`, `can_send_video_notes`, and `can_send_voice_notes` for different media types. --- CHANGELOG.md | 4 +++ .../kotlin/dev/inmo/tgbotapi/types/Common.kt | 7 ++++- .../tgbotapi/types/chat/ChatPermissions.kt | 28 ++++++++++++++++--- .../types/chat/member/RestrictedChatMember.kt | 14 ++++++++-- 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 454365a007..3697567e16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 5.1.0 +* `Core`: + * [Bot API 6.5](https://core.telegram.org/bots/api#february-3-2023) support + * Replaced the fields `can_send_media_messages` in the classes `ChatMemberRestricted` and `ChatPermissions` with separate fields `can_send_audios`, `can_send_documents`, `can_send_photos`, `can_send_videos`, `can_send_video_notes`, and `can_send_voice_notes` for different media types. + ## 5.0.1 * `Versions`: 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 8a3d8b8d85..7a768ba8ab 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 @@ -327,7 +327,12 @@ const val scopeField = "scope" const val isMemberField = "is_member" const val isForumField = "is_forum" const val canSendMessagesField = "can_send_messages" -const val canSendMediaMessagesField = "can_send_media_messages" +const val canSendAudiosField = "can_send_audios" +const val canSendDocumentsField = "can_send_documents" +const val canSendPhotosField = "can_send_photos" +const val canSendVideosField = "can_send_videos" +const val canSendVideoNotesField = "can_send_video_notes" +const val canSendVoiceNotesField = "can_send_voice_notes" const val canSendOtherMessagesField = "can_send_other_messages" const val canSendPollsField = "can_send_polls" const val canAddWebPagePreviewsField = "can_add_web_page_previews" diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt index 67091d9bd4..1813594891 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatPermissions.kt @@ -8,8 +8,18 @@ import kotlinx.serialization.Serializable data class ChatPermissions( @SerialName(canSendMessagesField) val canSendMessages: Boolean = false, - @SerialName(canSendMediaMessagesField) - val canSendMediaMessages: Boolean = false, + @SerialName(canSendAudiosField) + val canSendAudios: Boolean = false, + @SerialName(canSendDocumentsField) + val canSendDocuments: Boolean = false, + @SerialName(canSendPhotosField) + val canSendPhotos: Boolean = false, + @SerialName(canSendVideosField) + val canSendVideos: Boolean = false, + @SerialName(canSendVideoNotesField) + val canSendVideoNotes: Boolean = false, + @SerialName(canSendVoiceNotesField) + val canSendVoiceNotes: Boolean = false, @SerialName(canSendPollsField) val canSendPolls: Boolean = false, @SerialName(canSendOtherMessagesField) @@ -26,7 +36,12 @@ data class ChatPermissions( val LeftRestrictionsChatPermissions = ChatPermissions( canSendMessages = true, - canSendMediaMessages = true, + canSendAudios = true, + canSendDocuments = true, + canSendPhotos = true, + canSendVideos = true, + canSendVideoNotes = true, + canSendVoiceNotes = true, canSendPolls = true, canSendOtherMessages = true, canAddWebPagePreviews = true, @@ -37,7 +52,12 @@ val LeftRestrictionsChatPermissions = ChatPermissions( val RestrictionsChatPermissions = ChatPermissions( canSendMessages = false, - canSendMediaMessages = false, + canSendAudios = false, + canSendDocuments = false, + canSendPhotos = false, + canSendVideos = false, + canSendVideoNotes = false, + canSendVoiceNotes = false, canSendPolls = false, canSendOtherMessages = false, canAddWebPagePreviews = false, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt index c3449784c8..610ef1ca7a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/RestrictedChatMember.kt @@ -14,8 +14,18 @@ data class RestrictedChatMember( val isMember: Boolean = false, @SerialName(canSendMessagesField) val canSendMessages: Boolean = false, - @SerialName(canSendMediaMessagesField) - val canSendMediaMessages: Boolean = false, + @SerialName(canSendAudiosField) + val canSendAudios: Boolean = false, + @SerialName(canSendDocumentsField) + val canSendDocuments: Boolean = false, + @SerialName(canSendPhotosField) + val canSendPhotos: Boolean = false, + @SerialName(canSendVideosField) + val canSendVideos: Boolean = false, + @SerialName(canSendVideoNotesField) + val canSendVideoNotes: Boolean = false, + @SerialName(canSendVoiceNotesField) + val canSendVoiceNotes: Boolean = false, @SerialName(canSendPollsField) val canSendPolls: Boolean = false, @SerialName(canSendOtherMessagesField)