diff --git a/CHANGELOG.md b/CHANGELOG.md index b3a38f3188..9fc5ca4fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,11 @@ **Breaking changes**: -* `ReplyParameters.chatIdentifier`/`ReplyParameters.messageId` are now nullable (an ephemeral reply addresses its target only via the new `ephemeralMessageId`, without `chatIdentifier`/`messageId`); `ReplyParameters` no longer implements `WithMessageId` — code relying on `ReplyParameters` being a `WithMessageId`, or on `messageId`/`chatIdentifier` being non-null, must be updated +* `ReplyParameters` is now a sealed interface with nested `ReplyParameters.Chat` and `ReplyParameters.Ephemeral` implementations; migrate regular-message constructor calls to `ReplyParameters.Chat(...)` and ephemeral-message constructor calls to `ReplyParameters.Ephemeral(...)` * The 4 group-family message implementations (`CommonGroupContentMessageImpl`, `CommonForumContentMessageImpl`, `CommonChannelDirectMessagesContentMessageImpl`, `CommonSuggestedChannelDirectMessagesContentMessageImpl`) gained trailing `receiverUser`/`ephemeralMessageId` primary-constructor parameters (defaulted to `null`) — positional construction of these classes must be updated * `reply(to = ...)` overloads for the 13 ephemeral-capable senders (see below) now detect an ephemeral `to` target (`to is PossiblyEphemeralMessage && to.ephemeralMessageId != null`) and automatically address the reply through `ephemeral_message_id`, sending the outgoing message itself as ephemeral to the same receiver — this is a behavior change for any existing code that replies to a message carrying a non-null `ephemeralMessageId` -**Migration advice**: Build `ReplyParameters` through its public constructors (unaffected by the nullability change); pass `receiverUser`/`ephemeralMessageId` explicitly (or rely on their `null` default) when constructing the 4 group-family message implementations positionally +**Migration advice**: Replace `ReplyParameters(...)` with `ReplyParameters.Chat(...)` for chat messages or `ReplyParameters.Ephemeral(...)` for ephemeral messages; pass `receiverUser`/`ephemeralMessageId` explicitly (or rely on their `null` default) when constructing the 4 group-family message implementations positionally * `Core`: * (`Rich Messages`) Added `InputRichBlock` hierarchy with all 21 `InputRichBlock*` types (mirroring the received `RichBlock*` hierarchy and reusing `RichText`/`RichBlockCaption`/`RichBlockTableCell`), the label-less `InputRichBlockListItem` and the `InputRichBlockSerializer`; every `InputRichBlock` exposes `subBlocks` navigation @@ -22,7 +22,7 @@ * (`Ephemeral Messages`) Added `EphemeralMessageId` value class, `PossiblyEphemeralMessage` (`receiverUser`/`ephemeralMessageId`) and `EphemeralMessageAction` (`receiverUserId`/`ephemeralMessageId`) abstractions * (`Ephemeral Messages`) `RawMessage` parses `receiver_user`/`ephemeral_message_id`; the 4 group-family `Common*ContentMessage` types (`CommonGroupContentMessage`, `CommonForumContentMessage`, `CommonChannelDirectMessagesContentMessage`, `CommonSuggestedChannelDirectMessagesContentMessage`, via the shared `PotentiallyFromUserGroupContentMessage`) now also implement `PossiblyEphemeralMessage` * (`Ephemeral Messages`) `BotCommand` gained the `isEphemeral` field - * (`Ephemeral Messages`) `ReplyParameters` gained the `ephemeralMessageId` field and a new `(EphemeralMessageId, allowSendingWithoutReply)` constructor for replying to an ephemeral message; added the `Message.ephemeralReplyParametersOrNull()`/`Message.ephemeralReplyReceiverUserIdOrNull` helpers used by the `reply(to = ...)` smart-branch + * (`Ephemeral Messages`) `ReplyParameters` became a sealed interface with nested `Chat` and `Ephemeral` implementations and a shared surrogate-backed serializer preserving the flat Bot API JSON shape; added the `Message.ephemeralReplyParametersOrNull()`/`Message.ephemeralReplyReceiverUserIdOrNull` helpers used by the `reply(to = ...)` smart-branch * (`Ephemeral Messages`) Added `receiverUserId`/`callbackQueryId` params (via the new `OptionallyEphemeralSendRequest`) to the 13 ephemeral-capable send requests: `SendTextMessage`, `SendContact`, `SendLocation` (`Static`/`Live`), `SendVenue`, `SendPhotoData`, `SendLivePhotoData`, `SendAudioData`, `SendDocumentData`, `SendVideoData`, `SendAnimationData`, `SendVoiceData`, `SendVideoNoteData`, `SendStickerByFileId` * (`Ephemeral Messages`) Added `EditEphemeralMessageText`/`EditEphemeralMessageMedia`/`EditEphemeralMessageCaption`/`EditEphemeralMessageReplyMarkup` and `DeleteEphemeralMessage` requests (all return `Unit`, mirroring the inline-message edit family); `EditEphemeralMessageMedia` rejects `MultipartFile` media (new file upload is not supported for ephemeral edits) * (`Ephemeral Messages`) Added `EphemeralChatId` (`IdChatIdentifier`, carrying `chatId`/`receiverUser`/`ephemeralMessageId`) and the `ChatIdentifier.receiverUser`/`ChatIdentifier.ephemeralMessageId` extensions (mirroring `ChatIdentifier.threadId`); `FullChatIdentifierSerializer` gained the `chatId/eph/receiverUserChatId/ephemeralMessageId` string format. The nullable `receiverUserId` param of the 13 ephemeral-capable send requests still defaults from the passed `chatId` when it is an `EphemeralChatId`; `DeleteEphemeralMessage` and `EditEphemeralMessageText`/`EditEphemeralMessageCaption`/`EditEphemeralMessageMedia`/`EditEphemeralMessageReplyMarkup` instead keep `receiverUserId`/`ephemeralMessageId` REQUIRED on their primary constructor/factory form, gaining `EphemeralChatId`-taking secondary constructors/factory overloads that source both params from the identifier (throwing `IllegalArgumentException` if it carries no `ephemeralMessageId`) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt index 360f3f743e..1921bb2b6d 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveLocationProvider.kt @@ -311,7 +311,7 @@ public suspend inline fun TelegramBot.replyWithLiveLocation( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), + replyParameters = ReplyParameters.Chat(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -353,6 +353,6 @@ public suspend inline fun TelegramBot.replyWithLiveLocation( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), + replyParameters = ReplyParameters.Chat(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), replyMarkup = replyMarkup ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt index ec6dae927e..c8111cf5d6 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt @@ -84,7 +84,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -128,7 +128,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -171,7 +171,7 @@ public suspend inline fun TelegramBot.replyWithDice( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -240,7 +240,7 @@ public suspend inline fun TelegramBot.replyWithChecklist( disableNotification = disableNotification, protectContent = protectContent, effectId = effectId, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -267,7 +267,7 @@ public suspend inline fun TelegramBot.replyWithChecklist( disableNotification = disableNotification, protectContent = protectContent, effectId = effectId, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -295,7 +295,7 @@ public suspend inline fun TelegramBot.reply( disableNotification = disableNotification, protectContent = protectContent, effectId = effectId, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -322,7 +322,7 @@ public suspend inline fun TelegramBot.reply( disableNotification = disableNotification, protectContent = protectContent, effectId = effectId, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -371,7 +371,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -415,7 +415,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -466,7 +466,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -512,7 +512,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -663,7 +663,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -716,7 +716,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -756,7 +756,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -795,7 +795,7 @@ public suspend inline fun TelegramBot.replyWithGame( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -831,7 +831,7 @@ public suspend inline fun TelegramBot.replyWithGame( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -924,7 +924,7 @@ public suspend inline fun TelegramBot.replyWithAnimation( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -978,7 +978,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1032,7 +1032,7 @@ public suspend inline fun TelegramBot.replyWithAnimation( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1084,7 +1084,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1139,7 +1139,7 @@ public suspend inline fun TelegramBot.replyWithAudio( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1185,7 +1185,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1235,7 +1235,7 @@ public suspend inline fun TelegramBot.replyWithAudio( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1279,7 +1279,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1329,7 +1329,7 @@ public suspend inline fun TelegramBot.replyWithDocument( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1375,7 +1375,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1421,7 +1421,7 @@ public suspend inline fun TelegramBot.replyWithDocument( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1465,7 +1465,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1505,7 +1505,7 @@ public suspend inline fun TelegramBot.replyWithMediaGroup( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1539,7 +1539,7 @@ public suspend inline fun TelegramBot.replyWithPlaylist( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1573,7 +1573,7 @@ public suspend inline fun TelegramBot.replyWithDocuments( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1607,7 +1607,7 @@ public suspend inline fun TelegramBot.replyWithGallery( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( metaInfo = to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1657,7 +1657,7 @@ public suspend inline fun TelegramBot.replyWithPhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1705,7 +1705,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1753,7 +1753,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1800,7 +1800,7 @@ public suspend inline fun TelegramBot.replyWithPhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1846,7 +1846,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1892,7 +1892,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1937,7 +1937,7 @@ public suspend inline fun TelegramBot.replyWithSticker( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -1979,7 +1979,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -2040,7 +2040,7 @@ public suspend inline fun TelegramBot.replyWithVideo( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -2090,7 +2090,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -2146,7 +2146,7 @@ public suspend inline fun TelegramBot.replyWithVideo( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -2194,7 +2194,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, @@ -2247,7 +2247,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -2295,7 +2295,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -2343,7 +2343,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, @@ -2389,7 +2389,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters( + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat( message = to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, @@ -2438,7 +2438,7 @@ public suspend inline fun TelegramBot.replyWithVideoNote( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2473,7 +2473,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2517,7 +2517,7 @@ public suspend inline fun TelegramBot.replyWithVoice( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2556,7 +2556,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2596,7 +2596,7 @@ public suspend inline fun TelegramBot.replyWithVoice( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2633,7 +2633,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = to.ephemeralReplyParametersOrNull(allowSendingWithoutReply) ?: ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2701,7 +2701,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2745,7 +2745,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2792,7 +2792,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2836,7 +2836,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2878,7 +2878,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2920,7 +2920,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2971,7 +2971,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3024,7 +3024,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3073,7 +3073,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3124,7 +3124,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3173,7 +3173,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3224,7 +3224,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3271,7 +3271,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3319,7 +3319,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.chat.id, to.messageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3503,7 +3503,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3613,7 +3613,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup, ) ) @@ -3651,7 +3651,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) /** @@ -3690,7 +3690,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) } @@ -3730,7 +3730,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(to, allowSendingWithoutReply = allowSendingWithoutReply == true, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) } @@ -4320,7 +4320,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, suggestedPostParameters = suggestedPostParameters, replyMarkup = replyMarkup, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( messageId = to.messageId, chatIdentifier = to.chat.id, allowSendingWithoutReply = allowSendingWithoutReply, @@ -4366,7 +4366,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, suggestedPostParameters = suggestedPostParameters, replyMarkup = replyMarkup, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( messageId = to.messageId, chatIdentifier = to.chat.id, allowSendingWithoutReply = allowSendingWithoutReply, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt index 2991d80e5b..48151e37e1 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt @@ -84,7 +84,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -124,7 +124,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -163,7 +163,7 @@ public suspend inline fun TelegramBot.replyWithDice( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -234,7 +234,7 @@ public suspend inline fun TelegramBot.replyWithChecklist( disableNotification = disableNotification, protectContent = protectContent, effectId = effectId, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -262,7 +262,7 @@ public suspend inline fun TelegramBot.reply( disableNotification = disableNotification, protectContent = protectContent, effectId = effectId, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -307,7 +307,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -347,7 +347,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -394,7 +394,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -436,7 +436,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -583,7 +583,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -632,7 +632,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -668,7 +668,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -703,7 +703,7 @@ public suspend inline fun TelegramBot.replyWithGame( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -735,7 +735,7 @@ public suspend inline fun TelegramBot.replyWithGame( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -826,7 +826,7 @@ public suspend inline fun TelegramBot.replyWithAnimation( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -876,7 +876,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -926,7 +926,7 @@ public suspend inline fun TelegramBot.replyWithAnimation( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -974,7 +974,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1025,7 +1025,7 @@ public suspend inline fun TelegramBot.replyWithAudio( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1067,7 +1067,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1113,7 +1113,7 @@ public suspend inline fun TelegramBot.replyWithAudio( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1153,7 +1153,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1199,7 +1199,7 @@ public suspend inline fun TelegramBot.replyWithDocument( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup, disableContentTypeDetection = disableContentTypeDetection ) @@ -1241,7 +1241,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup, disableContentTypeDetection = disableContentTypeDetection ) @@ -1283,7 +1283,7 @@ public suspend inline fun TelegramBot.replyWithDocument( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup, disableContentTypeDetection = disableContentTypeDetection ) @@ -1323,7 +1323,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup, disableContentTypeDetection = disableContentTypeDetection ) @@ -1359,7 +1359,7 @@ public suspend inline fun TelegramBot.replyWithMediaGroup( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) public suspend inline fun TelegramBot.replyWithPlaylist( @@ -1389,7 +1389,7 @@ public suspend inline fun TelegramBot.replyWithPlaylist( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) public suspend inline fun TelegramBot.replyWithDocuments( @@ -1419,7 +1419,7 @@ public suspend inline fun TelegramBot.replyWithDocuments( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) public suspend inline fun TelegramBot.replyWithGallery( @@ -1449,7 +1449,7 @@ public suspend inline fun TelegramBot.replyWithGallery( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) @@ -1495,7 +1495,7 @@ public suspend inline fun TelegramBot.replyWithPhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1539,7 +1539,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1583,7 +1583,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1626,7 +1626,7 @@ public suspend inline fun TelegramBot.replyWithPhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1668,7 +1668,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1710,7 +1710,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1751,7 +1751,7 @@ public suspend inline fun TelegramBot.replyWithSticker( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1789,7 +1789,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1844,7 +1844,7 @@ public suspend inline fun TelegramBot.replyWithVideo( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1888,7 +1888,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1938,7 +1938,7 @@ public suspend inline fun TelegramBot.replyWithVideo( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -1980,7 +1980,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2029,7 +2029,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2073,7 +2073,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2117,7 +2117,7 @@ public suspend inline fun TelegramBot.replyWithLivePhoto( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2159,7 +2159,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2204,7 +2204,7 @@ public suspend inline fun TelegramBot.replyWithVideoNote( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2240,7 +2240,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2285,7 +2285,7 @@ public suspend inline fun TelegramBot.replyWithVoice( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2325,7 +2325,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2366,7 +2366,7 @@ public suspend inline fun TelegramBot.replyWithVoice( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2404,7 +2404,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2473,7 +2473,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2520,7 +2520,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2565,7 +2565,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2608,7 +2608,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2651,7 +2651,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2703,7 +2703,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2757,7 +2757,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2807,7 +2807,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2859,7 +2859,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2909,7 +2909,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -2961,7 +2961,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3009,7 +3009,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3059,7 +3059,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3245,7 +3245,7 @@ public suspend inline fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup ) @@ -3361,7 +3361,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId), replyMarkup = replyMarkup, ) ) @@ -3401,7 +3401,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) /** @@ -3441,7 +3441,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) } @@ -3482,7 +3482,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, effectId = effectId, suggestedPostParameters = suggestedPostParameters, - replyParameters = ReplyParameters(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) + replyParameters = ReplyParameters.Chat(toChatId, toMessageId, allowSendingWithoutReply = allowSendingWithoutReply, checklistTaskId = checklistTaskId, pollOptionId = pollOptionId) ) } @@ -4096,7 +4096,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, suggestedPostParameters = suggestedPostParameters, replyMarkup = replyMarkup, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( messageId = toMessageId, chatIdentifier = toChatId, allowSendingWithoutReply = allowSendingWithoutReply, @@ -4143,7 +4143,7 @@ public suspend fun TelegramBot.reply( allowPaidBroadcast = allowPaidBroadcast, suggestedPostParameters = suggestedPostParameters, replyMarkup = replyMarkup, - replyParameters = ReplyParameters( + replyParameters = ReplyParameters.Chat( messageId = toMessageId, chatIdentifier = toChatId, allowSendingWithoutReply = allowSendingWithoutReply, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ReplyToEphemeral.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ReplyToEphemeral.kt index 96f1751752..050f6aaf60 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ReplyToEphemeral.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/ReplyToEphemeral.kt @@ -41,7 +41,7 @@ public suspend fun TelegramBot.replyToEphemeral( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -83,7 +83,7 @@ public suspend fun TelegramBot.replyToEphemeralWithPhoto( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -126,7 +126,7 @@ public suspend fun TelegramBot.replyToEphemeralWithLivePhoto( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -169,7 +169,7 @@ public suspend fun TelegramBot.replyToEphemeralWithAudio( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -210,7 +210,7 @@ public suspend fun TelegramBot.replyToEphemeralWithDocument( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -251,7 +251,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVideo( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -292,7 +292,7 @@ public suspend fun TelegramBot.replyToEphemeralWithAnimation( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -333,7 +333,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVoice( text = text, parseMode = parseMode, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -370,7 +370,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVideoNote( chatId = chatId, videoNote = videoNote, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -403,7 +403,7 @@ public suspend fun TelegramBot.replyToEphemeralWithSticker( chatId = chatId, sticker = sticker, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -441,7 +441,7 @@ public suspend fun TelegramBot.replyToEphemeralWithLocation( latitude = latitude, longitude = longitude, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -483,7 +483,7 @@ public suspend fun TelegramBot.replyToEphemeralWithVenue( title = title, address = address, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) @@ -526,7 +526,7 @@ public suspend fun TelegramBot.replyToEphemeralWithContact( firstName = firstName, lastName = lastName, receiverUserId = receiverUserId, - replyParameters = ReplyParameters(ephemeralMessageId, allowSendingWithoutReply), + replyParameters = ReplyParameters.Ephemeral(ephemeralMessageId, allowSendingWithoutReply), replyMarkup = replyMarkup ) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/extensions/EnablePrivacyPolicyCommand.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/extensions/EnablePrivacyPolicyCommand.kt index fdd8d4e85d..5949cf5d70 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/extensions/EnablePrivacyPolicyCommand.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/utils/extensions/EnablePrivacyPolicyCommand.kt @@ -67,7 +67,7 @@ suspend fun BC.onCommandPrivacy( it.chat.id, textSources, allowPaidBroadcast = allowPaidBroadcast, - replyParameters = ReplyParameters(it.metaInfo) + replyParameters = ReplyParameters.Chat(it.metaInfo) ) ) } @@ -100,7 +100,7 @@ suspend fun BC.onCommandPrivacy( text = text, parseMode = parseMode, allowPaidBroadcast = allowPaidBroadcast, - replyParameters = ReplyParameters(it.metaInfo) + replyParameters = ReplyParameters.Chat(it.metaInfo) ) ) } diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index aaec204a86..3a37f901fe 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -15313,17 +15313,21 @@ public final class dev/inmo/tgbotapi/types/ReplyInfo$ToStory$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/inmo/tgbotapi/types/ReplyParameters : dev/inmo/tgbotapi/abstracts/TextedInput { +public abstract interface class dev/inmo/tgbotapi/types/ReplyParameters { public static final field Companion Ldev/inmo/tgbotapi/types/ReplyParameters$Companion; - public synthetic fun (JLjava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (JLjava/lang/Boolean;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public abstract fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; + public abstract fun getMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; +} + +public final class dev/inmo/tgbotapi/types/ReplyParameters$Chat : dev/inmo/tgbotapi/abstracts/TextedInput, dev/inmo/tgbotapi/types/ReplyParameters { + public static final field Companion Ldev/inmo/tgbotapi/types/ReplyParameters$Chat$Companion; public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/Boolean;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/util/List;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/util/List;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;Ldev/inmo/tgbotapi/types/MessageId;Ljava/lang/Boolean;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;Ldev/inmo/tgbotapi/types/EphemeralMessageId;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V @@ -15337,20 +15341,21 @@ public final class dev/inmo/tgbotapi/types/ReplyParameters : dev/inmo/tgbotapi/a public synthetic fun (Lkotlin/Triple;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (Lkotlin/Triple;Ljava/util/List;Ljava/lang/Boolean;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; - public final fun component10-lUwSvXo ()Ldev/inmo/tgbotapi/types/EphemeralMessageId; - public final fun component2-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; + public final fun component2-APLFQys ()J public final fun component3 ()Ljava/lang/Boolean; public final fun component4 ()Ljava/lang/String; public final fun component5 ()Ldev/inmo/tgbotapi/types/message/ParseMode; public final fun component7 ()Ljava/lang/Integer; public final fun component8-Wby8Lsc ()Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId; public final fun component9-y3a_nt8 ()Ljava/lang/String; + public final fun copy-LVJNs80 (Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/Boolean;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;)Ldev/inmo/tgbotapi/types/ReplyParameters$Chat; + public static synthetic fun copy-LVJNs80$default (Ldev/inmo/tgbotapi/types/ReplyParameters$Chat;Ldev/inmo/tgbotapi/types/ChatIdentifier;JLjava/lang/Boolean;Ljava/lang/String;Ldev/inmo/tgbotapi/types/message/ParseMode;Ljava/util/List;Ljava/lang/Integer;Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/ReplyParameters$Chat; public fun equals (Ljava/lang/Object;)Z - public final fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; + public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; public final fun getChatIdentifier ()Ldev/inmo/tgbotapi/types/ChatIdentifier; public final fun getChecklistTaskId-Wby8Lsc ()Ldev/inmo/tgbotapi/types/checklists/ChecklistTaskId; - public final fun getEphemeralMessageId-lUwSvXo ()Ldev/inmo/tgbotapi/types/EphemeralMessageId; - public final fun getMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; + public fun getMessageId-APLFQys ()J + public synthetic fun getMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; public final fun getPollOptionId-y3a_nt8 ()Ljava/lang/String; public final fun getQuote ()Ljava/lang/String; public final fun getQuoteParseMode ()Ldev/inmo/tgbotapi/types/message/ParseMode; @@ -15361,21 +15366,43 @@ public final class dev/inmo/tgbotapi/types/ReplyParameters : dev/inmo/tgbotapi/a public fun toString ()Ljava/lang/String; } -public final synthetic class dev/inmo/tgbotapi/types/ReplyParameters$$serializer : kotlinx/serialization/internal/GeneratedSerializer { - public static final field INSTANCE Ldev/inmo/tgbotapi/types/ReplyParameters$$serializer; - public final fun childSerializers ()[Lkotlinx/serialization/KSerializer; - public final fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/types/ReplyParameters; - public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; - public final fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; - public final fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/types/ReplyParameters;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V - public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; +public final class dev/inmo/tgbotapi/types/ReplyParameters$Chat$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; } public final class dev/inmo/tgbotapi/types/ReplyParameters$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } +public final class dev/inmo/tgbotapi/types/ReplyParameters$Ephemeral : dev/inmo/tgbotapi/types/ReplyParameters { + public static final field Companion Ldev/inmo/tgbotapi/types/ReplyParameters$Ephemeral$Companion; + public synthetic fun (JLjava/lang/Boolean;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JLjava/lang/Boolean;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1-TazDcj0 ()J + public final fun component2 ()Ljava/lang/Boolean; + public final fun copy-DIpU5II (JLjava/lang/Boolean;)Ldev/inmo/tgbotapi/types/ReplyParameters$Ephemeral; + public static synthetic fun copy-DIpU5II$default (Ldev/inmo/tgbotapi/types/ReplyParameters$Ephemeral;JLjava/lang/Boolean;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/ReplyParameters$Ephemeral; + public fun equals (Ljava/lang/Object;)Z + public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; + public final fun getEphemeralMessageId-TazDcj0 ()J + public fun getMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/types/ReplyParameters$Ephemeral$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/types/ReplyParameters$Serializer : kotlinx/serialization/KSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/types/ReplyParameters$Serializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/types/ReplyParameters; + public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; + public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/types/ReplyParameters;)V + public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V +} + public final class dev/inmo/tgbotapi/types/ReplyParametersKt { public static final fun ephemeralReplyParametersOrNull (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Ljava/lang/Boolean;)Ldev/inmo/tgbotapi/types/ReplyParameters; public static synthetic fun ephemeralReplyParametersOrNull$default (Ldev/inmo/tgbotapi/types/message/abstracts/Message;Ljava/lang/Boolean;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/ReplyParameters; diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt index aaf7a05d07..73c4df77be 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ReplyParameters.kt @@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.types import dev.inmo.tgbotapi.abstracts.TextedInput 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 @@ -12,227 +11,148 @@ 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.types.polls.PollOptionPersistentId import dev.inmo.tgbotapi.utils.extensions.makeSourceString +import kotlinx.serialization.KSerializer import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +import kotlinx.serialization.SerializationException +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder -@ConsistentCopyVisibility -@Serializable -data class ReplyParameters internal constructor( - @SerialName(chatIdField) - val chatIdentifier: ChatIdentifier?, - @SerialName(messageIdField) - val messageId: MessageId?, - @SerialName(allowSendingWithoutReplyField) - val allowSendingWithoutReply: Boolean? = null, - @SerialName(quoteField) - val quote: String? = null, - @SerialName(quoteParseModeField) - val quoteParseMode: ParseMode? = null, - @SerialName(quoteEntitiesField) - private val quoteEntities: List? = null, - @SerialName(quotePositionField) - val quotePosition: Int? = null, - @SerialName(checklistTaskIdField) - val checklistTaskId: ChecklistTaskId? = null, - @SerialName(pollOptionIdField) - val pollOptionId: PollOptionPersistentId? = null, - @SerialName(ephemeralMessageIdField) - val ephemeralMessageId: EphemeralMessageId? = null, -) : TextedInput { - init { - require(messageId != null || ephemeralMessageId != null) { - "Either messageId or ephemeralMessageId must be specified for ReplyParameters" - } - } - - override val text: String? - get() = quote - override val textSources: List by lazy { - quoteEntities ?.asTextSources(quote ?: return@lazy emptyList()) ?: emptyList() - } +@Serializable(ReplyParameters.Serializer::class) +sealed interface ReplyParameters { + val messageId: MessageId? + val allowSendingWithoutReply: Boolean? /** - * Builds [ReplyParameters] targeting an ephemeral message by its [ephemeralMessageId]. The reply itself must - * also be sent as ephemeral (see `receiverUserId` of the corresponding send request); [chatIdentifier] and - * [quote]-related fields are not supported for such replies. + * Reply parameters targeting a regular message identified by [messageId]. A `null` [chatIdentifier] targets a + * message in the current chat; a non-null [chatIdentifier] targets a message in a different chat. */ - constructor( - ephemeralMessageId: EphemeralMessageId, - allowSendingWithoutReply: Boolean? = null, - ) : this( - chatIdentifier = null, - messageId = null, - allowSendingWithoutReply = allowSendingWithoutReply, - ephemeralMessageId = ephemeralMessageId - ) + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @ConsistentCopyVisibility + @Serializable(ReplyParameters.Serializer::class) + data class Chat internal constructor( + val chatIdentifier: ChatIdentifier?, + override val messageId: MessageId, + override val allowSendingWithoutReply: Boolean? = null, + val quote: String? = null, + val quoteParseMode: ParseMode? = null, + internal val quoteEntities: List? = null, + val quotePosition: Int? = null, + val checklistTaskId: ChecklistTaskId? = null, + val pollOptionId: PollOptionPersistentId? = null, + ) : ReplyParameters, TextedInput { + override val text: String? + get() = quote + override val textSources: List by lazy { + quoteEntities ?.asTextSources(quote ?: return@lazy emptyList()) ?: emptyList() + } - constructor( - chatIdentifier: ChatIdentifier, - messageId: MessageId, - entities: TextSourcesList, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - chatIdentifier, - messageId, - allowSendingWithoutReply, - entities.makeSourceString(), - null, - entities.toRawMessageEntities(), - quotePosition, - checklistTaskId, - pollOptionId - ) - constructor( - metaInfo: Message.MetaInfo, - entities: TextSourcesList, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - metaInfo.chatId, - metaInfo.messageId, - entities, - allowSendingWithoutReply, - quotePosition, - checklistTaskId, - pollOptionId - ) - constructor( - message: Message, - entities: TextSourcesList, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - message.metaInfo, - entities, - allowSendingWithoutReply, - quotePosition, - checklistTaskId, - pollOptionId - ) - constructor( - chatIdentifier: ChatIdentifier, - messageId: MessageId, - quote: String, - quoteParseMode: ParseMode, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - chatIdentifier, - messageId, - allowSendingWithoutReply, - quote, - quoteParseMode, - null, - quotePosition, - checklistTaskId, - pollOptionId - ) - constructor( - metaInfo: Message.MetaInfo, - quote: String, - quoteParseMode: ParseMode, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - metaInfo.chatId, - metaInfo.messageId, - quote, - quoteParseMode, - allowSendingWithoutReply, - quotePosition, - checklistTaskId, - pollOptionId - ) - constructor( - message: Message, - quote: String, - quoteParseMode: ParseMode, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - message.metaInfo, - quote, - quoteParseMode, - allowSendingWithoutReply, - quotePosition, - checklistTaskId, - pollOptionId - ) - constructor( - chatIdentifier: ChatIdentifier, - messageId: MessageId, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - chatIdentifier, - messageId, - allowSendingWithoutReply, - null, - null, - null, - quotePosition, - 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, - pollOptionId - ) - constructor( - message: Message, - allowSendingWithoutReply: Boolean? = null, - quotePosition: Int? = null, - checklistTaskId: ChecklistTaskId? = null, - pollOptionId: PollOptionPersistentId? = null, - ) : this( - message.metaInfo, - allowSendingWithoutReply, - quotePosition, - checklistTaskId, - pollOptionId - ) + constructor( + chatIdentifier: ChatIdentifier, + messageId: MessageId, + entities: TextSourcesList, + allowSendingWithoutReply: Boolean? = null, + quotePosition: Int? = null, + checklistTaskId: ChecklistTaskId? = null, + pollOptionId: PollOptionPersistentId? = null, + ) : this(chatIdentifier, messageId, allowSendingWithoutReply, entities.makeSourceString(), null, entities.toRawMessageEntities(), quotePosition, checklistTaskId, pollOptionId) + + constructor(metaInfo: Message.MetaInfo, entities: TextSourcesList, allowSendingWithoutReply: Boolean? = null, quotePosition: Int? = null, checklistTaskId: ChecklistTaskId? = null, pollOptionId: PollOptionPersistentId? = null) : + this(metaInfo.chatId, metaInfo.messageId, entities, allowSendingWithoutReply, quotePosition, checklistTaskId, pollOptionId) + + constructor(message: Message, entities: TextSourcesList, allowSendingWithoutReply: Boolean? = null, quotePosition: Int? = null, checklistTaskId: ChecklistTaskId? = null, pollOptionId: PollOptionPersistentId? = null) : + this(message.metaInfo, entities, allowSendingWithoutReply, quotePosition, checklistTaskId, pollOptionId) + + constructor(chatIdentifier: ChatIdentifier, messageId: MessageId, quote: String, quoteParseMode: ParseMode, allowSendingWithoutReply: Boolean? = null, quotePosition: Int? = null, checklistTaskId: ChecklistTaskId? = null, pollOptionId: PollOptionPersistentId? = null) : + this(chatIdentifier, messageId, allowSendingWithoutReply, quote, quoteParseMode, null, quotePosition, checklistTaskId, pollOptionId) + + constructor(metaInfo: Message.MetaInfo, quote: String, quoteParseMode: ParseMode, allowSendingWithoutReply: Boolean? = null, quotePosition: Int? = null, checklistTaskId: ChecklistTaskId? = null, pollOptionId: PollOptionPersistentId? = null) : + this(metaInfo.chatId, metaInfo.messageId, quote, quoteParseMode, allowSendingWithoutReply, quotePosition, checklistTaskId, pollOptionId) + + constructor(message: Message, quote: String, quoteParseMode: ParseMode, allowSendingWithoutReply: Boolean? = null, quotePosition: Int? = null, checklistTaskId: ChecklistTaskId? = null, pollOptionId: PollOptionPersistentId? = null) : + this(message.metaInfo, quote, quoteParseMode, allowSendingWithoutReply, quotePosition, checklistTaskId, pollOptionId) + + constructor(chatIdentifier: ChatIdentifier, messageId: MessageId, allowSendingWithoutReply: Boolean? = null, quotePosition: Int? = null, checklistTaskId: ChecklistTaskId? = null, pollOptionId: PollOptionPersistentId? = null) : + this(chatIdentifier, messageId, allowSendingWithoutReply, null, null, null, quotePosition, 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, pollOptionId) + + constructor(message: Message, allowSendingWithoutReply: Boolean? = null, quotePosition: Int? = null, checklistTaskId: ChecklistTaskId? = null, pollOptionId: PollOptionPersistentId? = null) : + this(message.metaInfo, allowSendingWithoutReply, quotePosition, checklistTaskId, pollOptionId) + } + + @Suppress("SERIALIZER_TYPE_INCOMPATIBLE") + @Serializable(ReplyParameters.Serializer::class) + /** + * Reply parameters targeting an incoming ephemeral message identified by [ephemeralMessageId]. The outgoing + * reply must also be ephemeral; chat and quote fields are unsupported for ephemeral replies. + */ + data class Ephemeral( + val ephemeralMessageId: EphemeralMessageId, + override val allowSendingWithoutReply: Boolean? = null, + ) : ReplyParameters { + override val messageId: MessageId? = null + } + + object Serializer : KSerializer { + @Serializable + private data class Surrogate( + @SerialName(chatIdField) val chatIdentifier: ChatIdentifier? = null, + @SerialName(messageIdField) val messageId: MessageId? = null, + @SerialName(allowSendingWithoutReplyField) val allowSendingWithoutReply: Boolean? = null, + @SerialName(quoteField) val quote: String? = null, + @SerialName(quoteParseModeField) val quoteParseMode: ParseMode? = null, + @SerialName(quoteEntitiesField) val quoteEntities: List? = null, + @SerialName(quotePositionField) val quotePosition: Int? = null, + @SerialName(checklistTaskIdField) val checklistTaskId: ChecklistTaskId? = null, + @SerialName(pollOptionIdField) val pollOptionId: PollOptionPersistentId? = null, + @SerialName(ephemeralMessageIdField) val ephemeralMessageId: EphemeralMessageId? = null, + ) + + override val descriptor: SerialDescriptor = Surrogate.serializer().descriptor + + override fun deserialize(decoder: Decoder): ReplyParameters { + val surrogate = decoder.decodeSerializableValue(Surrogate.serializer()) + if (surrogate.messageId != null && surrogate.ephemeralMessageId != null) { + throw SerializationException("ReplyParameters must contain either message_id or ephemeral_message_id, not both") + } + return when { + surrogate.ephemeralMessageId != null -> Ephemeral(surrogate.ephemeralMessageId, surrogate.allowSendingWithoutReply) + surrogate.messageId != null -> Chat( + surrogate.chatIdentifier, surrogate.messageId, surrogate.allowSendingWithoutReply, surrogate.quote, + surrogate.quoteParseMode, surrogate.quoteEntities, surrogate.quotePosition, surrogate.checklistTaskId, + surrogate.pollOptionId + ) + else -> throw SerializationException("ReplyParameters must contain message_id or ephemeral_message_id") + } + } + + override fun serialize(encoder: Encoder, value: ReplyParameters) { + val surrogate = when (value) { + is Chat -> Surrogate(value.chatIdentifier, value.messageId, value.allowSendingWithoutReply, value.quote, value.quoteParseMode, value.quoteEntities, value.quotePosition, value.checklistTaskId, value.pollOptionId) + is Ephemeral -> Surrogate(allowSendingWithoutReply = value.allowSendingWithoutReply, ephemeralMessageId = value.ephemeralMessageId) + } + encoder.encodeSerializableValue(Surrogate.serializer(), surrogate) + } + } } /** - * Builds [ReplyParameters] targeting [this] ephemeral message (via its [PossiblyEphemeralMessage.ephemeralMessageId]), - * or `null` if [this] is not an ephemeral message. Used by `reply(to = ...)` helpers to automatically address a - * reply through `ephemeral_message_id` when the target message is itself ephemeral. + * Builds [ReplyParameters] targeting the receiver's ephemeral message through + * [PossiblyEphemeralMessage.ephemeralMessageId], or returns `null` for a non-ephemeral receiver. */ fun Message.ephemeralReplyParametersOrNull(allowSendingWithoutReply: Boolean? = null): ReplyParameters? = (this as? PossiblyEphemeralMessage) ?.ephemeralMessageId ?.let { - ReplyParameters(it, allowSendingWithoutReply) + ReplyParameters.Ephemeral(it, allowSendingWithoutReply) } /** - * The [UserId] that should receive an ephemeral reply to [this] message (`null` if [this] is not ephemeral): - * the original ephemeral message's [PossiblyEphemeralMessage.receiverUser], falling back to the message sender - * ([OptionallyFromUserMessage.from]) when [PossiblyEphemeralMessage.receiverUser] is missing. + * Returns the receiver [UserId] for an ephemeral reply: [PossiblyEphemeralMessage.receiverUser] when available, + * otherwise [OptionallyFromUserMessage.from]; returns `null` for a non-ephemeral message. */ val Message.ephemeralReplyReceiverUserIdOrNull: UserId? get() = (this as? PossiblyEphemeralMessage) ?.takeIf { it.ephemeralMessageId != null } ?.let { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/Abstracts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/Abstracts.kt index a6231626ba..6e7869cc3d 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/Abstracts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/Abstracts.kt @@ -192,7 +192,7 @@ sealed interface ResendableContent { effectId = effectId, suggestedPostParameters = suggestedPostParameters, replyParameters = replyToMessageId ?.let { - ReplyParameters( + ReplyParameters.Chat( chatId, replyToMessageId, allowSendingWithoutReply = allowSendingWithoutReply diff --git a/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/ReplyParametersSerializationTest.kt b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/ReplyParametersSerializationTest.kt new file mode 100644 index 0000000000..246dfab75b --- /dev/null +++ b/tgbotapi.core/src/commonTest/kotlin/dev/inmo/tgbotapi/types/ReplyParametersSerializationTest.kt @@ -0,0 +1,70 @@ +package dev.inmo.tgbotapi.types + +import kotlinx.serialization.SerializationException +import kotlinx.serialization.decodeFromString +import kotlinx.serialization.encodeToString +import kotlinx.serialization.json.Json +import kotlinx.serialization.json.jsonObject +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertFalse +import kotlin.test.assertTrue + +class ReplyParametersSerializationTest { + private val json = Json { encodeDefaults = false } + + @Test + fun chatRoundTripUsesFlatShape() { + val value: ReplyParameters = ReplyParameters.Chat( + ChatId(RawChatId(123L)), + MessageId(456L), + allowSendingWithoutReply = true + ) + + val encoded = json.encodeToString(value) + val encodedObject = json.parseToJsonElement(encoded).jsonObject + + assertTrue("chat_id" in encodedObject) + assertTrue("message_id" in encodedObject) + assertFalse("ephemeral_message_id" in encodedObject) + assertEquals(value, json.decodeFromString(encoded)) + } + + @Test + fun ephemeralRoundTripUsesFlatShape() { + val value: ReplyParameters = ReplyParameters.Ephemeral(EphemeralMessageId(789L), true) + + val encoded = json.encodeToString(value) + val encodedObject = json.parseToJsonElement(encoded).jsonObject + + assertTrue("ephemeral_message_id" in encodedObject) + assertFalse("chat_id" in encodedObject) + assertFalse("message_id" in encodedObject) + assertEquals(value, json.decodeFromString(encoded)) + } + + @Test + fun currentChatPayloadWithoutChatIdDecodes() { + val decoded = json.decodeFromString("""{"message_id":456}""") + + assertEquals( + ReplyParameters.Chat(chatIdentifier = null, messageId = MessageId(456L)), + decoded + ) + } + + @Test + fun payloadWithBothTargetKindsIsRejected() { + assertFailsWith { + json.decodeFromString("""{"chat_id":123,"message_id":456,"ephemeral_message_id":789}""") + } + } + + @Test + fun payloadWithoutTargetIsRejected() { + assertFailsWith { + json.decodeFromString("""{"allow_sending_without_reply":true}""") + } + } +}