2020-10-04 11:06:30 +00:00
|
|
|
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult
|
2019-02-07 04:47:08 +00:00
|
|
|
|
2020-10-04 11:06:30 +00:00
|
|
|
import dev.inmo.tgbotapi.types.*
|
|
|
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.InlineQueryResultAudio
|
|
|
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.inlineQueryResultAudioType
|
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
|
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:47:08 +00:00
|
|
|
|
2020-11-05 14:18:16 +00:00
|
|
|
fun InlineQueryResultAudioImpl(
|
2024-03-16 15:17:36 +00:00
|
|
|
id: InlineQueryId,
|
2020-11-05 14:18:16 +00:00
|
|
|
url: String,
|
|
|
|
title: String,
|
|
|
|
performer: String? = null,
|
|
|
|
duration: Int? = null,
|
|
|
|
text: String? = null,
|
|
|
|
parseMode: ParseMode? = null,
|
|
|
|
replyMarkup: InlineKeyboardMarkup? = null,
|
|
|
|
inputMessageContent: InputMessageContent? = null
|
|
|
|
) = InlineQueryResultAudioImpl(id, url, title, performer, duration, text, parseMode, null, replyMarkup, inputMessageContent)
|
|
|
|
|
|
|
|
fun InlineQueryResultAudioImpl(
|
2024-03-16 15:17:36 +00:00
|
|
|
id: InlineQueryId,
|
2020-11-05 14:18:16 +00:00
|
|
|
url: String,
|
|
|
|
title: String,
|
|
|
|
performer: String? = null,
|
|
|
|
duration: Int? = 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
|
|
|
) = InlineQueryResultAudioImpl(
|
|
|
|
id,
|
|
|
|
url,
|
|
|
|
title,
|
|
|
|
performer,
|
|
|
|
duration,
|
|
|
|
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 InlineQueryResultAudioImpl internal constructor(
|
2019-02-07 04:47:08 +00:00
|
|
|
@SerialName(idField)
|
2024-03-16 15:17:36 +00:00
|
|
|
override val id: InlineQueryId,
|
2019-02-07 04:47:08 +00:00
|
|
|
@SerialName(audioUrlField)
|
|
|
|
override val url: String,
|
2019-02-07 05:55:29 +00:00
|
|
|
@SerialName(titleField)
|
|
|
|
override val title: String,
|
2019-02-07 04:47:08 +00:00
|
|
|
@SerialName(performerField)
|
2019-02-07 05:10:15 +00:00
|
|
|
override val performer: String? = null,
|
2019-02-07 04:47:08 +00:00
|
|
|
@SerialName(audioDurationField)
|
|
|
|
override val duration: Int? = null,
|
|
|
|
@SerialName(captionField)
|
2020-11-05 14:18:16 +00:00
|
|
|
override val text: String? = null,
|
2019-02-07 04:47:08 +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:47:08 +00:00
|
|
|
@SerialName(replyMarkupField)
|
|
|
|
override val replyMarkup: InlineKeyboardMarkup? = null,
|
|
|
|
@SerialName(inputMessageContentField)
|
|
|
|
override val inputMessageContent: InputMessageContent? = null
|
2019-02-07 11:50:08 +00:00
|
|
|
) : InlineQueryResultAudio {
|
|
|
|
override val type: String = inlineQueryResultAudioType
|
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
|
|
|
}
|
2019-02-07 11:50:08 +00:00
|
|
|
}
|