mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
add ReplyParameters
This commit is contained in:
parent
f637b480b1
commit
e28f3492ef
@ -220,6 +220,10 @@ const val protectContentField = "protect_content"
|
|||||||
const val removeCaptionField = "remove_caption"
|
const val removeCaptionField = "remove_caption"
|
||||||
const val replyToMessageIdField = "reply_to_message_id"
|
const val replyToMessageIdField = "reply_to_message_id"
|
||||||
const val allowSendingWithoutReplyField = "allow_sending_without_reply"
|
const val allowSendingWithoutReplyField = "allow_sending_without_reply"
|
||||||
|
const val quoteField = "quote"
|
||||||
|
const val quoteParseModeField = "quote_parse_mode"
|
||||||
|
const val quoteEntitiesField = "quote_entities"
|
||||||
|
const val quotePositionField = "quote_position"
|
||||||
const val replyMarkupField = "reply_markup"
|
const val replyMarkupField = "reply_markup"
|
||||||
const val disableContentTypeDetectionField = "disable_content_type_detection"
|
const val disableContentTypeDetectionField = "disable_content_type_detection"
|
||||||
const val supportStreamingField = "support_streaming"
|
const val supportStreamingField = "support_streaming"
|
||||||
|
@ -0,0 +1,121 @@
|
|||||||
|
package dev.inmo.tgbotapi.types
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.TextedInput
|
||||||
|
import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
|
||||||
|
import dev.inmo.tgbotapi.abstracts.WithMessageId
|
||||||
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
|
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.message.asTextSources
|
||||||
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
|
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeSourceString
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ReplyParameters internal constructor(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
val chatIdentifier: ChatIdentifier,
|
||||||
|
@SerialName(messageIdField)
|
||||||
|
override val messageId: MessageId,
|
||||||
|
@SerialName(allowSendingWithoutReplyField)
|
||||||
|
val allowSendingWithoutReply: Boolean = false,
|
||||||
|
@SerialName(quoteField)
|
||||||
|
val quote: String? = null,
|
||||||
|
@SerialName(quoteParseModeField)
|
||||||
|
val quoteParseMode: ParseMode? = null,
|
||||||
|
@SerialName(quoteEntitiesField)
|
||||||
|
private val quoteEntities: List<RawMessageEntity>? = null,
|
||||||
|
@SerialName(quotePositionField)
|
||||||
|
val quotePosition: Int?
|
||||||
|
) : WithMessageId, TextedInput {
|
||||||
|
override val text: String?
|
||||||
|
get() = quote
|
||||||
|
override val textSources: List<TextSource> by lazy {
|
||||||
|
quoteEntities ?.asTextSources(quote ?: return@lazy emptyList()) ?: emptyList()
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
chatIdentifier: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
allowSendingWithoutReply: Boolean = false,
|
||||||
|
quotePosition: Int? = null
|
||||||
|
) : this(
|
||||||
|
chatIdentifier,
|
||||||
|
messageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
entities.makeSourceString(),
|
||||||
|
null,
|
||||||
|
entities.toRawMessageEntities(),
|
||||||
|
quotePosition
|
||||||
|
)
|
||||||
|
constructor(
|
||||||
|
metaInfo: Message.MetaInfo,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
allowSendingWithoutReply: Boolean = false,
|
||||||
|
quotePosition: Int? = null
|
||||||
|
) : this(
|
||||||
|
metaInfo.chatId,
|
||||||
|
metaInfo.messageId,
|
||||||
|
entities,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
quotePosition
|
||||||
|
)
|
||||||
|
constructor(
|
||||||
|
chatIdentifier: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
quote: String,
|
||||||
|
quoteParseMode: ParseMode,
|
||||||
|
allowSendingWithoutReply: Boolean = false,
|
||||||
|
quotePosition: Int? = null
|
||||||
|
) : this(
|
||||||
|
chatIdentifier,
|
||||||
|
messageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
quote,
|
||||||
|
quoteParseMode,
|
||||||
|
null,
|
||||||
|
quotePosition
|
||||||
|
)
|
||||||
|
constructor(
|
||||||
|
metaInfo: Message.MetaInfo,
|
||||||
|
quote: String,
|
||||||
|
quoteParseMode: ParseMode,
|
||||||
|
allowSendingWithoutReply: Boolean = false,
|
||||||
|
quotePosition: Int? = null
|
||||||
|
) : this(
|
||||||
|
metaInfo.chatId,
|
||||||
|
metaInfo.messageId,
|
||||||
|
quote,
|
||||||
|
quoteParseMode,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
quotePosition
|
||||||
|
)
|
||||||
|
constructor(
|
||||||
|
chatIdentifier: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
allowSendingWithoutReply: Boolean = false,
|
||||||
|
quotePosition: Int? = null
|
||||||
|
) : this(
|
||||||
|
chatIdentifier,
|
||||||
|
messageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
quotePosition
|
||||||
|
)
|
||||||
|
constructor(
|
||||||
|
metaInfo: Message.MetaInfo,
|
||||||
|
allowSendingWithoutReply: Boolean = false,
|
||||||
|
quotePosition: Int? = null
|
||||||
|
) : this(
|
||||||
|
metaInfo.chatId,
|
||||||
|
metaInfo.messageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
quotePosition
|
||||||
|
)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user