mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-04-21 17:32:30 +00:00
add support of pollOptionId in ReplyParameters and reply_to_poll_option_id
This commit is contained in:
@@ -175,6 +175,7 @@ const val quoteParseModeField = "quote_parse_mode"
|
||||
const val quoteEntitiesField = "quote_entities"
|
||||
const val quotePositionField = "quote_position"
|
||||
const val checklistTaskIdField = "checklist_task_id"
|
||||
const val pollOptionIdField = "poll_option_id"
|
||||
const val replyMarkupField = "reply_markup"
|
||||
const val disableContentTypeDetectionField = "disable_content_type_detection"
|
||||
const val supportStreamingField = "support_streaming"
|
||||
|
||||
@@ -16,6 +16,7 @@ import dev.inmo.tgbotapi.types.message.MessageOrigin
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.payments.Invoice
|
||||
import dev.inmo.tgbotapi.types.polls.Poll
|
||||
import dev.inmo.tgbotapi.types.polls.PollOptionPersistentId
|
||||
import dev.inmo.tgbotapi.types.stories.Story
|
||||
import dev.inmo.tgbotapi.types.venue.Venue
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
@@ -30,10 +31,12 @@ import kotlinx.serialization.encoding.Encoder
|
||||
sealed interface ReplyInfo {
|
||||
val messageMeta: Message.MetaInfo?
|
||||
val checklistTaskId: ChecklistTaskId?
|
||||
val pollOptionId: PollOptionPersistentId?
|
||||
|
||||
data class Internal(
|
||||
val message: Message,
|
||||
override val checklistTaskId: ChecklistTaskId? = null,
|
||||
override val pollOptionId: PollOptionPersistentId? = null,
|
||||
): ReplyInfo {
|
||||
override val messageMeta: Message.MetaInfo
|
||||
get() = message.metaInfo
|
||||
@@ -47,6 +50,8 @@ sealed interface ReplyInfo {
|
||||
get() = null
|
||||
override val checklistTaskId: ChecklistTaskId?
|
||||
get() = null
|
||||
override val pollOptionId: PollOptionPersistentId?
|
||||
get() = null
|
||||
}
|
||||
|
||||
@Serializable(External.Companion::class)
|
||||
@@ -64,6 +69,7 @@ sealed interface ReplyInfo {
|
||||
override val messageMeta: Message.MetaInfo?,
|
||||
val linkPreviewOptions: LinkPreviewOptions?,
|
||||
override val checklistTaskId: ChecklistTaskId? = null,
|
||||
override val pollOptionId: PollOptionPersistentId? = null,
|
||||
) : External
|
||||
|
||||
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
|
||||
@@ -80,6 +86,7 @@ sealed interface ReplyInfo {
|
||||
override val messageMeta: Message.MetaInfo?,
|
||||
override val content: ContentVariant,
|
||||
override val checklistTaskId: ChecklistTaskId? = null,
|
||||
override val pollOptionId: PollOptionPersistentId? = null,
|
||||
) : Content
|
||||
|
||||
@Serializable
|
||||
@@ -91,6 +98,7 @@ sealed interface ReplyInfo {
|
||||
override val spoilered: Boolean,
|
||||
override val content: MediaContentVariant,
|
||||
override val checklistTaskId: ChecklistTaskId? = null,
|
||||
override val pollOptionId: PollOptionPersistentId? = null,
|
||||
) : Content, SpoilerableData
|
||||
}
|
||||
|
||||
@@ -199,4 +207,4 @@ sealed interface ReplyInfo {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.types
|
||||
import dev.inmo.tgbotapi.abstracts.TextedInput
|
||||
import dev.inmo.tgbotapi.abstracts.WithMessageId
|
||||
import dev.inmo.tgbotapi.types.checklists.ChecklistTaskId
|
||||
import dev.inmo.tgbotapi.types.polls.PollOptionPersistentId
|
||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||
import dev.inmo.tgbotapi.types.message.RawMessageEntity
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
@@ -32,7 +33,9 @@ data class ReplyParameters internal constructor(
|
||||
@SerialName(quotePositionField)
|
||||
val quotePosition: Int? = null,
|
||||
@SerialName(checklistTaskIdField)
|
||||
val checklistTaskId: ChecklistTaskId? = null
|
||||
val checklistTaskId: ChecklistTaskId? = null,
|
||||
@SerialName(pollOptionIdField)
|
||||
val pollOptionId: PollOptionPersistentId? = null,
|
||||
) : WithMessageId, TextedInput {
|
||||
override val text: String?
|
||||
get() = quote
|
||||
@@ -47,6 +50,7 @@ data class ReplyParameters internal constructor(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
chatIdentifier,
|
||||
messageId,
|
||||
@@ -55,7 +59,8 @@ data class ReplyParameters internal constructor(
|
||||
null,
|
||||
entities.toRawMessageEntities(),
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
metaInfo: Message.MetaInfo,
|
||||
@@ -63,13 +68,15 @@ data class ReplyParameters internal constructor(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
metaInfo.chatId,
|
||||
metaInfo.messageId,
|
||||
entities,
|
||||
allowSendingWithoutReply,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
message: Message,
|
||||
@@ -77,12 +84,14 @@ data class ReplyParameters internal constructor(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
message.metaInfo,
|
||||
entities,
|
||||
allowSendingWithoutReply,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
chatIdentifier: ChatIdentifier,
|
||||
@@ -92,6 +101,7 @@ data class ReplyParameters internal constructor(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
chatIdentifier,
|
||||
messageId,
|
||||
@@ -100,7 +110,8 @@ data class ReplyParameters internal constructor(
|
||||
quoteParseMode,
|
||||
null,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
metaInfo: Message.MetaInfo,
|
||||
@@ -109,6 +120,7 @@ data class ReplyParameters internal constructor(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
metaInfo.chatId,
|
||||
metaInfo.messageId,
|
||||
@@ -116,7 +128,8 @@ data class ReplyParameters internal constructor(
|
||||
quoteParseMode,
|
||||
allowSendingWithoutReply,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
message: Message,
|
||||
@@ -125,13 +138,15 @@ data class ReplyParameters internal constructor(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
message.metaInfo,
|
||||
quote,
|
||||
quoteParseMode,
|
||||
allowSendingWithoutReply,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
chatIdentifier: ChatIdentifier,
|
||||
@@ -139,6 +154,7 @@ data class ReplyParameters internal constructor(
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
chatIdentifier,
|
||||
messageId,
|
||||
@@ -147,29 +163,34 @@ data class ReplyParameters internal constructor(
|
||||
null,
|
||||
null,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
metaInfo: Message.MetaInfo,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
metaInfo.chatId,
|
||||
metaInfo.messageId,
|
||||
allowSendingWithoutReply,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
constructor(
|
||||
message: Message,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
quotePosition: Int? = null,
|
||||
checklistTaskId: ChecklistTaskId? = null,
|
||||
pollOptionId: PollOptionPersistentId? = null,
|
||||
) : this(
|
||||
message.metaInfo,
|
||||
allowSendingWithoutReply,
|
||||
quotePosition,
|
||||
checklistTaskId
|
||||
checklistTaskId,
|
||||
pollOptionId
|
||||
)
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import dev.inmo.tgbotapi.types.payments.Invoice
|
||||
import dev.inmo.tgbotapi.types.payments.RefundedPayment
|
||||
import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
|
||||
import dev.inmo.tgbotapi.types.polls.Poll
|
||||
import dev.inmo.tgbotapi.types.polls.PollOptionPersistentId
|
||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||
import dev.inmo.tgbotapi.types.stories.Story
|
||||
@@ -78,6 +79,7 @@ internal data class RawMessage(
|
||||
private val reply_to_message: RawMessage? = null,
|
||||
private val reply_to_story: Story? = null,
|
||||
private val reply_to_checklist_task_id: ChecklistTaskId? = null,
|
||||
private val reply_to_poll_option_id: PollOptionPersistentId? = null,
|
||||
private val external_reply: ReplyInfo.External? = null,
|
||||
private val quote: TextQuote? = null,
|
||||
private val via_bot: CommonBot? = null,
|
||||
@@ -431,8 +433,9 @@ internal data class RawMessage(
|
||||
} ?: content?.let { content ->
|
||||
val replyInfo: ReplyInfo? = when {
|
||||
reply_to_message != null -> ReplyInfo.Internal(
|
||||
reply_to_message.asMessage,
|
||||
reply_to_checklist_task_id
|
||||
message = reply_to_message.asMessage,
|
||||
checklistTaskId = reply_to_checklist_task_id,
|
||||
pollOptionId = reply_to_poll_option_id
|
||||
)
|
||||
reply_to_story != null -> ReplyInfo.ToStory(reply_to_story)
|
||||
external_reply != null -> external_reply
|
||||
|
||||
Reference in New Issue
Block a user