From 4a1ece53b5829d327b449404cadf1c31dce6ba7b Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 4 Apr 2019 22:10:52 +0800 Subject: [PATCH] refactoring of "MediaContent" --- CHANGELOG.md | 1 + .../TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt | 1 + .../TelegramBotAPI/types/message/CommonMediaGroupMessage.kt | 1 + .../types/message/content/abstracts/MediaCollectionContent.kt | 2 +- .../types/message/content/abstracts/MediaContent.kt | 4 ++-- .../types/message/content/abstracts/MediaGroupContent.kt | 3 +-- .../types/message/content/media/AnimationContent.kt | 2 +- .../types/message/content/media/AudioContent.kt | 2 +- .../types/message/content/media/DocumentContent.kt | 2 +- .../types/message/content/media/PhotoContent.kt | 2 +- .../types/message/content/media/StickerContent.kt | 2 +- .../types/message/content/media/VideoContent.kt | 2 +- .../types/message/content/media/VideoNoteContent.kt | 2 +- .../types/message/content/media/VoiceContent.kt | 2 +- 14 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 635609422b..1542909f43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -65,6 +65,7 @@ of `]` in links titles ### 0.12.5 * Now `MediaGroupContent` is `MediaContent` +* All `MedaContent` now have no generics and have basic `TelegramMediaFile` media field ## 0.11.0 diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt index 1a10980a8c..719ac6ad14 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt @@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat +import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt index 736eba1fc9..4bf354d277 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt @@ -2,6 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat +import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent import org.joda.time.DateTime diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt index 7e673c624b..9ee62114d8 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt @@ -2,6 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstrac import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile -interface MediaCollectionContent: MessageContent, MediaContent { +interface MediaCollectionContent: MessageContent, MediaContent { val mediaCollection: List } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt index fe3d48b712..9248dc721a 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt @@ -2,6 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstrac import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile -interface MediaContent: MessageContent { - val media: T +interface MediaContent: MessageContent { + val media: TelegramMediaFile } diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt index 69909ef758..333c115997 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt @@ -1,8 +1,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.MediaGroupMemberInputMedia -import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile -interface MediaGroupContent : MediaContent, MessageContent { +interface MediaGroupContent : MediaContent, MessageContent { fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia } \ No newline at end of file diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt index d4676b1c7b..5a43c7185b 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt @@ -14,7 +14,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstract data class AnimationContent( override val media: AnimationFile, val includedDocument: DocumentFile? -) : MediaContent { +) : MediaContent { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt index bdfaa2c4c3..8ab8411d54 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt @@ -17,7 +17,7 @@ data class AudioContent( override val media: AudioFile, override val caption: String? = null, override val captionEntities: List = emptyList() -) : MediaContent, CaptionedMediaContent { +) : MediaContent, CaptionedMediaContent { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt index 49d1721691..2f901939f7 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt @@ -17,7 +17,7 @@ data class DocumentContent( override val media: DocumentFile, override val caption: String? = null, override val captionEntities: List = emptyList() -) : MediaContent, CaptionedMediaContent { +) : MediaContent, CaptionedMediaContent { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt index 13b2df8a12..ff79b8572d 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt @@ -19,7 +19,7 @@ data class PhotoContent( override val mediaCollection: List, override val caption: String? = null, override val captionEntities: List = emptyList() -) : MediaCollectionContent, CaptionedMediaContent, MediaGroupContent { +) : MediaCollectionContent, CaptionedMediaContent, MediaGroupContent { override val media: PhotoSize = mediaCollection.biggest() ?: throw IllegalStateException("Can't locate any photo size for this content") override fun createResend( diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt index d326e63521..70d87d4fec 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt @@ -11,7 +11,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstract data class StickerContent( override val media: Sticker -) : MediaContent { +) : MediaContent { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt index 0660cec228..4da13cf41f 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt @@ -18,7 +18,7 @@ data class VideoContent( override val media: VideoFile, override val caption: String? = null, override val captionEntities: List = emptyList() -) : CaptionedMediaContent, MediaGroupContent { +) : CaptionedMediaContent, MediaGroupContent { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt index 9e0ba9731b..7a52e92e08 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt @@ -12,7 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstract data class VideoNoteContent( override val media: VideoNoteFile -) : MediaContent { +) : MediaContent { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean, diff --git a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt index ba44511753..ecc524e975 100644 --- a/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt +++ b/src/main/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt @@ -17,7 +17,7 @@ data class VoiceContent( override val media: VoiceFile, override val caption: String? = null, override val captionEntities: List = emptyList() -) : MediaContent, CaptionedMediaContent { +) : MediaContent, CaptionedMediaContent { override fun createResend( chatId: ChatIdentifier, disableNotification: Boolean,