2020-10-04 11:06:30 +00:00
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
2019-02-07 04:15:16 +00:00
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.InlineQueryResultMpeg4Gif
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.inlineQueryResultMpeg4GifType
2021-05-29 09:34:14 +00:00
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
2022-05-01 14:36:07 +00:00
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
2022-05-01 14:43:03 +00:00
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.parseModeField
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
2022-05-01 14:36:07 +00:00
import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.types.message.RawMessageEntity
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.utils.MimeType
2021-08-08 12:00:42 +00:00
import dev.inmo.tgbotapi.utils.extensions.makeString
2019-04-13 02:21:19 +00:00
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
2019-02-07 04:15:16 +00:00
2020-11-05 14:18:16 +00:00
fun InlineQueryResultMpeg4GifImpl (
2024-03-16 15:17:36 +00:00
id : InlineQueryId ,
2020-11-05 14:18:16 +00:00
url : String ,
2023-03-10 06:24:12 +00:00
thumbnailUrl : String ,
thumbnailMimeType : MimeType ? = null ,
2020-11-05 14:18:16 +00:00
width : Int ? = null ,
height : Int ? = null ,
duration : Int ? = null ,
title : String ? = null ,
text : String ? = null ,
parseMode : ParseMode ? = null ,
replyMarkup : InlineKeyboardMarkup ? = null ,
inputMessageContent : InputMessageContent ? = null
2023-03-10 06:24:12 +00:00
) = InlineQueryResultMpeg4GifImpl ( id , url , thumbnailUrl , thumbnailMimeType , width , height , duration , title , text , parseMode , null , replyMarkup , inputMessageContent )
2020-11-05 14:18:16 +00:00
fun InlineQueryResultMpeg4GifImpl (
2024-03-16 15:17:36 +00:00
id : InlineQueryId ,
2020-11-05 14:18:16 +00:00
url : String ,
2023-03-10 06:24:12 +00:00
thumbnailUrl : String ,
thumbnailMimeType : MimeType ? = null ,
2020-11-05 14:18:16 +00:00
width : Int ? = null ,
height : Int ? = null ,
duration : Int ? = null ,
title : String ? = null ,
2021-05-29 09:34:14 +00:00
entities : TextSourcesList ,
2020-11-05 14:18:16 +00:00
replyMarkup : InlineKeyboardMarkup ? = null ,
inputMessageContent : InputMessageContent ? = null
2021-05-29 10:02:55 +00:00
) = InlineQueryResultMpeg4GifImpl (
id ,
url ,
2023-03-10 06:24:12 +00:00
thumbnailUrl ,
thumbnailMimeType ,
2021-05-29 10:02:55 +00:00
width ,
height ,
duration ,
title ,
entities . makeString ( ) ,
null ,
entities . toRawMessageEntities ( ) ,
replyMarkup ,
inputMessageContent
)
2020-11-05 14:18:16 +00:00
2019-02-07 11:32:31 +00:00
@Serializable
2020-11-05 14:18:16 +00:00
data class InlineQueryResultMpeg4GifImpl internal constructor (
2019-02-07 04:15:16 +00:00
@SerialName ( idField )
2024-03-16 15:17:36 +00:00
override val id : InlineQueryId ,
2019-02-07 04:15:16 +00:00
@SerialName ( mpeg4GifUrlField )
override val url : String ,
2023-03-10 06:24:12 +00:00
@SerialName ( thumbnailUrlField )
override val thumbnailUrl : String ,
@SerialName ( thumbnailMimeTypeField )
override val thumbnailMimeType : MimeType ? = null ,
2019-02-07 04:15:16 +00:00
@SerialName ( mpeg4GifWidthField )
override val width : Int ? = null ,
@SerialName ( mpeg4GifHeightField )
override val height : Int ? = null ,
@SerialName ( mpeg4GifDurationField )
override val duration : Int ? = null ,
@SerialName ( titleField )
override val title : String ? = null ,
@SerialName ( captionField )
2020-11-05 14:18:16 +00:00
override val text : String ? = null ,
2019-02-07 04:15:16 +00:00
@SerialName ( parseModeField )
override val parseMode : ParseMode ? = null ,
2020-11-05 14:18:16 +00:00
@SerialName ( captionEntitiesField )
private val rawEntities : List < RawMessageEntity > ? = null ,
2019-02-07 04:15:16 +00:00
@SerialName ( replyMarkupField )
override val replyMarkup : InlineKeyboardMarkup ? = null ,
@SerialName ( inputMessageContentField )
override val inputMessageContent : InputMessageContent ? = null
2019-02-07 11:50:08 +00:00
) : InlineQueryResultMpeg4Gif {
override val type : String = inlineQueryResultMpeg4GifType
2021-05-29 09:34:14 +00:00
override val textSources : TextSourcesList ? by lazy {
2021-04-28 13:54:57 +00:00
rawEntities ?. asTextSources ( text ?: return @lazy null )
2020-11-05 14:18:16 +00:00
}
2020-06-05 08:01:19 +00:00
init {
2023-03-10 06:24:12 +00:00
if ( thumbnailMimeType != null && thumbnailMimeType !in telegramInlineModeGifPermittedMimeTypes ) {
error ( " Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbnailMimeType , but permitted $telegramInlineModeGifPermittedMimeTypes " )
2020-06-05 08:01:19 +00:00
}
}
2019-02-07 11:50:08 +00:00
}