mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
refactoring of "MediaContent"
This commit is contained in:
parent
ac39032f50
commit
4a1ece53b5
@ -65,6 +65,7 @@ of `]` in links titles
|
|||||||
### 0.12.5
|
### 0.12.5
|
||||||
|
|
||||||
* Now `MediaGroupContent` is `MediaContent`
|
* Now `MediaGroupContent` is `MediaContent`
|
||||||
|
* All `MedaContent` now have no generics and have basic `TelegramMediaFile` media field
|
||||||
|
|
||||||
## 0.11.0
|
## 0.11.0
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message
|
|||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MediaGroupIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat
|
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.MediaGroupMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
||||||
|
@ -2,6 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.Chat
|
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.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaGroupContent
|
||||||
import org.joda.time.DateTime
|
import org.joda.time.DateTime
|
||||||
|
@ -2,6 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstrac
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
|
||||||
|
|
||||||
interface MediaCollectionContent<T: TelegramMediaFile>: MessageContent, MediaContent<T> {
|
interface MediaCollectionContent<T: TelegramMediaFile>: MessageContent, MediaContent {
|
||||||
val mediaCollection: List<T>
|
val mediaCollection: List<T>
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstrac
|
|||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
|
||||||
|
|
||||||
interface MediaContent<T: TelegramMediaFile>: MessageContent {
|
interface MediaContent: MessageContent {
|
||||||
val media: T
|
val media: TelegramMediaFile
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.MediaGroupMemberInputMedia
|
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.MediaGroupMemberInputMedia
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
|
|
||||||
|
|
||||||
interface MediaGroupContent<T : TelegramMediaFile> : MediaContent<T>, MessageContent {
|
interface MediaGroupContent : MediaContent, MessageContent {
|
||||||
fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia
|
fun toMediaGroupMemberInputMedia(): MediaGroupMemberInputMedia
|
||||||
}
|
}
|
@ -14,7 +14,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstract
|
|||||||
data class AnimationContent(
|
data class AnimationContent(
|
||||||
override val media: AnimationFile,
|
override val media: AnimationFile,
|
||||||
val includedDocument: DocumentFile?
|
val includedDocument: DocumentFile?
|
||||||
) : MediaContent<AnimationFile> {
|
) : MediaContent {
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
|
@ -17,7 +17,7 @@ data class AudioContent(
|
|||||||
override val media: AudioFile,
|
override val media: AudioFile,
|
||||||
override val caption: String? = null,
|
override val caption: String? = null,
|
||||||
override val captionEntities: List<MessageEntity> = emptyList()
|
override val captionEntities: List<MessageEntity> = emptyList()
|
||||||
) : MediaContent<AudioFile>, CaptionedMediaContent {
|
) : MediaContent, CaptionedMediaContent {
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
|
@ -17,7 +17,7 @@ data class DocumentContent(
|
|||||||
override val media: DocumentFile,
|
override val media: DocumentFile,
|
||||||
override val caption: String? = null,
|
override val caption: String? = null,
|
||||||
override val captionEntities: List<MessageEntity> = emptyList()
|
override val captionEntities: List<MessageEntity> = emptyList()
|
||||||
) : MediaContent<DocumentFile>, CaptionedMediaContent {
|
) : MediaContent, CaptionedMediaContent {
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
|
@ -19,7 +19,7 @@ data class PhotoContent(
|
|||||||
override val mediaCollection: List<PhotoSize>,
|
override val mediaCollection: List<PhotoSize>,
|
||||||
override val caption: String? = null,
|
override val caption: String? = null,
|
||||||
override val captionEntities: List<MessageEntity> = emptyList()
|
override val captionEntities: List<MessageEntity> = emptyList()
|
||||||
) : MediaCollectionContent<PhotoSize>, CaptionedMediaContent, MediaGroupContent<PhotoSize> {
|
) : MediaCollectionContent<PhotoSize>, CaptionedMediaContent, MediaGroupContent {
|
||||||
override val media: PhotoSize = mediaCollection.biggest() ?: throw IllegalStateException("Can't locate any photo size for this content")
|
override val media: PhotoSize = mediaCollection.biggest() ?: throw IllegalStateException("Can't locate any photo size for this content")
|
||||||
|
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
|
@ -11,7 +11,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstract
|
|||||||
|
|
||||||
data class StickerContent(
|
data class StickerContent(
|
||||||
override val media: Sticker
|
override val media: Sticker
|
||||||
) : MediaContent<Sticker> {
|
) : MediaContent {
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
|
@ -18,7 +18,7 @@ data class VideoContent(
|
|||||||
override val media: VideoFile,
|
override val media: VideoFile,
|
||||||
override val caption: String? = null,
|
override val caption: String? = null,
|
||||||
override val captionEntities: List<MessageEntity> = emptyList()
|
override val captionEntities: List<MessageEntity> = emptyList()
|
||||||
) : CaptionedMediaContent, MediaGroupContent<VideoFile> {
|
) : CaptionedMediaContent, MediaGroupContent {
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
|
@ -12,7 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstract
|
|||||||
|
|
||||||
data class VideoNoteContent(
|
data class VideoNoteContent(
|
||||||
override val media: VideoNoteFile
|
override val media: VideoNoteFile
|
||||||
) : MediaContent<VideoNoteFile> {
|
) : MediaContent {
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
|
@ -17,7 +17,7 @@ data class VoiceContent(
|
|||||||
override val media: VoiceFile,
|
override val media: VoiceFile,
|
||||||
override val caption: String? = null,
|
override val caption: String? = null,
|
||||||
override val captionEntities: List<MessageEntity> = emptyList()
|
override val captionEntities: List<MessageEntity> = emptyList()
|
||||||
) : MediaContent<VoiceFile>, CaptionedMediaContent {
|
) : MediaContent, CaptionedMediaContent {
|
||||||
override fun createResend(
|
override fun createResend(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
disableNotification: Boolean,
|
disableNotification: Boolean,
|
||||||
|
Loading…
Reference in New Issue
Block a user