mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
Added "ResendableContent"
This commit is contained in:
parent
b4ef91cc77
commit
54c55d2dc6
@ -19,3 +19,12 @@
|
|||||||
## 0.8.4
|
## 0.8.4
|
||||||
|
|
||||||
* Added `createMarkdownText` and extensions for `CaptionedMediaContent` and `TextContent`
|
* Added `createMarkdownText` and extensions for `CaptionedMediaContent` and `TextContent`
|
||||||
|
* Added `ResendableContent` and realize in different contents
|
||||||
|
* Animation
|
||||||
|
* Audio
|
||||||
|
* Document
|
||||||
|
* Photo
|
||||||
|
* Sticker
|
||||||
|
* Video
|
||||||
|
* VideoNote
|
||||||
|
* Voice
|
||||||
|
@ -4,5 +4,5 @@ interface DuratedSendMessageRequest<T: Any>: SendMessageRequest<T> {
|
|||||||
/**
|
/**
|
||||||
* Duration of media, usually in seconds
|
* Duration of media, usually in seconds
|
||||||
*/
|
*/
|
||||||
val duration: Int?
|
val duration: Long?
|
||||||
}
|
}
|
@ -17,7 +17,7 @@ fun SendAnimation(
|
|||||||
thumb: InputFile?,
|
thumb: InputFile?,
|
||||||
caption: String? = null,
|
caption: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Int? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@ -71,7 +71,7 @@ data class SendAnimationData internal constructor(
|
|||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
@Optional
|
@Optional
|
||||||
override val duration: Int? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(widthField)
|
@SerialName(widthField)
|
||||||
@Optional
|
@Optional
|
||||||
override val width: Int? = null,
|
override val width: Int? = null,
|
||||||
|
@ -17,7 +17,7 @@ fun SendAudio(
|
|||||||
thumb: InputFile?,
|
thumb: InputFile?,
|
||||||
caption: String? = null,
|
caption: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Int? = null,
|
duration: Long? = null,
|
||||||
performer: String? = null,
|
performer: String? = null,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@ -71,7 +71,7 @@ data class SendAudioData internal constructor(
|
|||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
@Optional
|
@Optional
|
||||||
override val duration: Int? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(performerField)
|
@SerialName(performerField)
|
||||||
@Optional
|
@Optional
|
||||||
val performer: String? = null,
|
val performer: String? = null,
|
||||||
|
@ -17,7 +17,7 @@ fun SendVideo(
|
|||||||
thumb: InputFile?,
|
thumb: InputFile?,
|
||||||
caption: String? = null,
|
caption: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Int? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
supportStreaming: Boolean? = null,
|
supportStreaming: Boolean? = null,
|
||||||
@ -73,7 +73,7 @@ data class SendVideoData internal constructor(
|
|||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
@Optional
|
@Optional
|
||||||
override val duration: Int? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(widthField)
|
@SerialName(widthField)
|
||||||
@Optional
|
@Optional
|
||||||
override val width: Int? = null,
|
override val width: Int? = null,
|
||||||
|
@ -17,7 +17,7 @@ fun SendVideoNote(
|
|||||||
thumb: InputFile?,
|
thumb: InputFile?,
|
||||||
caption: String? = null,
|
caption: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Int? = null,
|
duration: Long? = null,
|
||||||
size: Int? = null, // in documentation - length (size of video side)
|
size: Int? = null, // in documentation - length (size of video side)
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
@ -69,7 +69,7 @@ data class SendVideoNoteData internal constructor(
|
|||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
@Optional
|
@Optional
|
||||||
override val duration: Int? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(lengthField)
|
@SerialName(lengthField)
|
||||||
@Optional
|
@Optional
|
||||||
override val width: Int? = null,
|
override val width: Int? = null,
|
||||||
|
@ -17,7 +17,7 @@ fun SendVoice(
|
|||||||
thumb: InputFile?,
|
thumb: InputFile?,
|
||||||
caption: String? = null,
|
caption: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
duration: Int? = null,
|
duration: Long? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
@ -67,7 +67,7 @@ data class SendVoiceData internal constructor(
|
|||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(durationField)
|
@SerialName(durationField)
|
||||||
@Optional
|
@Optional
|
||||||
override val duration: Int? = null,
|
override val duration: Long? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
@Optional
|
@Optional
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
|
@ -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 {
|
interface MediaCollectionContent<T: TelegramMediaFile>: MessageContent, ResendableContent {
|
||||||
val media: List<T>
|
val media: 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<T: TelegramMediaFile>: MessageContent, ResendableContent {
|
||||||
val media: T
|
val media: T
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
|
|
||||||
|
interface ResendableContent {
|
||||||
|
fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<RawMessage>
|
||||||
|
}
|
@ -1,10 +1,46 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
|
||||||
data class AnimationContent(
|
data class AnimationContent(
|
||||||
override val media: AnimationFile,
|
override val media: AnimationFile,
|
||||||
val includedDocument: DocumentFile?
|
val includedDocument: DocumentFile?
|
||||||
) : MediaContent<AnimationFile>
|
) : MediaContent<AnimationFile> {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = createResend(chatId, null, null, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
|
fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
caption: String?,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<RawMessage> = SendAnimation(
|
||||||
|
chatId,
|
||||||
|
media.fileId,
|
||||||
|
media.thumb ?.fileId,
|
||||||
|
caption,
|
||||||
|
parseMode,
|
||||||
|
media.duration,
|
||||||
|
media.width,
|
||||||
|
media.height,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
@ -1,12 +1,39 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption
|
||||||
|
|
||||||
data class AudioContent(
|
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<AudioFile>, CaptionedMediaContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = SendAudio(
|
||||||
|
chatId,
|
||||||
|
media.fileId,
|
||||||
|
media.thumb ?.fileId,
|
||||||
|
toMarkdownCaption(),
|
||||||
|
MarkdownParseMode,
|
||||||
|
media.duration,
|
||||||
|
media.performer,
|
||||||
|
media.title,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -1,12 +1,36 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption
|
||||||
|
|
||||||
data class DocumentContent(
|
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<DocumentFile>, CaptionedMediaContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = SendDocument(
|
||||||
|
chatId,
|
||||||
|
media.fileId,
|
||||||
|
media.thumb ?.fileId,
|
||||||
|
toMarkdownCaption(),
|
||||||
|
MarkdownParseMode,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -1,11 +1,35 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.biggest
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption
|
||||||
|
|
||||||
data class PhotoContent(
|
data class PhotoContent(
|
||||||
override val media: List<PhotoSize>,
|
override val media: 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
|
) : MediaCollectionContent<PhotoSize>, CaptionedMediaContent, MediaGroupContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = SendPhoto(
|
||||||
|
chatId,
|
||||||
|
media.biggest() ?.fileId ?: throw IllegalStateException("Empty list of media"),
|
||||||
|
toMarkdownCaption(),
|
||||||
|
MarkdownParseMode,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -1,8 +1,27 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendSticker
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
|
||||||
data class StickerContent(
|
data class StickerContent(
|
||||||
override val media: Sticker
|
override val media: Sticker
|
||||||
) : MediaContent<Sticker>
|
) : MediaContent<Sticker> {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = SendSticker(
|
||||||
|
chatId,
|
||||||
|
media.fileId,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -1,11 +1,39 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.*
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.*
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption
|
||||||
|
|
||||||
data class VideoContent(
|
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()
|
||||||
) : MediaContent<VideoFile>, CaptionedMediaContent, MediaGroupContent
|
) : MediaContent<VideoFile>, CaptionedMediaContent, MediaGroupContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = SendVideo(
|
||||||
|
chatId,
|
||||||
|
media.fileId,
|
||||||
|
media.thumb ?.fileId,
|
||||||
|
toMarkdownCaption(),
|
||||||
|
MarkdownParseMode,
|
||||||
|
media.duration,
|
||||||
|
media.width,
|
||||||
|
media.height,
|
||||||
|
null,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -1,8 +1,42 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideoNote
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoNoteFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoNoteFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
|
||||||
data class VideoNoteContent(
|
data class VideoNoteContent(
|
||||||
override val media: VideoNoteFile
|
override val media: VideoNoteFile
|
||||||
) : MediaContent<VideoNoteFile>
|
) : MediaContent<VideoNoteFile> {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = createResend(chatId, null, null, disableNotification, replyToMessageId, replyMarkup)
|
||||||
|
|
||||||
|
fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
caption: String?,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
replyToMessageId: MessageIdentifier? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Request<RawMessage> = SendVideoNote(
|
||||||
|
chatId,
|
||||||
|
media.fileId,
|
||||||
|
media.thumb ?.fileId,
|
||||||
|
caption,
|
||||||
|
parseMode,
|
||||||
|
media.duration,
|
||||||
|
media.width,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
@ -1,12 +1,37 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
package com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media
|
||||||
|
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.MessageEntity
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.MarkdownParseMode
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VoiceFile
|
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VoiceFile
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.CaptionedMediaContent
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||||
|
import com.github.insanusmokrassar.TelegramBotAPI.utils.toMarkdownCaption
|
||||||
|
|
||||||
data class VoiceContent(
|
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<VoiceFile>, CaptionedMediaContent {
|
||||||
|
override fun createResend(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
disableNotification: Boolean,
|
||||||
|
replyToMessageId: MessageIdentifier?,
|
||||||
|
replyMarkup: KeyboardMarkup?
|
||||||
|
): Request<RawMessage> = SendVoice(
|
||||||
|
chatId,
|
||||||
|
media.fileId,
|
||||||
|
null,
|
||||||
|
toMarkdownCaption(),
|
||||||
|
MarkdownParseMode,
|
||||||
|
media.duration,
|
||||||
|
disableNotification,
|
||||||
|
replyToMessageId,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user