From 8a6e06bbf0a0e05d314231212f6c22d3c03fb82a Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Mon, 15 Jul 2024 02:19:50 +0600 Subject: [PATCH] update live/static locations --- .../extensions/api/LiveFlowLocation.kt | 9 +- .../tgbotapi/extensions/api/edit/Edits.kt | 12 +- .../live/EditChatMessageLiveLocation.kt | 13 +- .../live/StopChatMessageLiveLocation.kt | 7 +- .../tgbotapi/extensions/api/send/Replies.kt | 4 +- .../api/send/RepliesWithChatsAndMessages.kt | 4 +- .../extensions/api/send/SendLiveLocation.kt | 17 +- .../extensions/api/send/SendStaticLocation.kt | 17 +- .../tgbotapi/extensions/api/send/Sends.kt | 18 +-- tgbotapi.core/api/tgbotapi.core.api | 101 ++++++++++-- .../live/EditChatMessageLiveLocation.kt | 7 +- .../live/StopChatMessageLiveLocation.kt | 7 +- .../tgbotapi/requests/send/SendLocation.kt | 145 ++++++++++++------ 13 files changed, 240 insertions(+), 121 deletions(-) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt index 93852a49a0..db75a8d52f 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/LiveFlowLocation.kt @@ -17,6 +17,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.content.LiveLocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.currentCoroutineContext @@ -54,9 +55,9 @@ public suspend fun TelegramBot.handleLiveLocation( protectContent: Boolean = false, effectId: EffectId? = null, replyParameters: ReplyParameters? = null, - sentMessageFlow: FlowCollector>? = null + sentMessageFlow: FlowCollector>? = null ) { - var currentLiveLocationMessage: ContentMessage? = null + var currentLiveLocationMessage: ContentMessage? = null val updateMessageJob = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { // do not launch refreshing of message for indefinite live locations null } else { @@ -127,7 +128,7 @@ public suspend fun TelegramBot.handleLiveLocation( protectContent: Boolean = false, effectId: EffectId? = null, replyParameters: ReplyParameters? = null, - sentMessageFlow: FlowCollector>? = null + sentMessageFlow: FlowCollector>? = null ) { handleLiveLocation( chatId = chatId, @@ -168,7 +169,7 @@ public suspend fun TelegramBot.handleLiveLocation( protectContent: Boolean = false, effectId: EffectId? = null, replyParameters: ReplyParameters? = null, - sentMessageFlow: FlowCollector>? = null + sentMessageFlow: FlowCollector>? = null ) { handleLiveLocation( chatId = chatId, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt index a0934c868b..f0451beda8 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/Edits.kt @@ -66,7 +66,7 @@ public suspend fun TelegramBot.edit( proximityAlertRadius: Meters? = null, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(chatId, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(chatId, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -83,7 +83,7 @@ public suspend fun TelegramBot.edit( proximityAlertRadius: Meters? = null, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(chat, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(chat, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -99,7 +99,7 @@ public suspend fun TelegramBot.edit( proximityAlertRadius: Meters? = null, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(message, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(message, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -111,7 +111,7 @@ public suspend fun TelegramBot.edit( location: LiveLocation, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation( +): ContentMessage = editLiveLocation( chatId, messageId, location, businessConnectionId, replyMarkup ) @@ -125,7 +125,7 @@ public suspend fun TelegramBot.edit( location: LiveLocation, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(chat, messageId, location, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(chat, messageId, location, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -136,7 +136,7 @@ public suspend fun TelegramBot.edit( location: LiveLocation, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(message, location, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(message, location, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt index b4ef83dcb4..3cd521167d 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/EditChatMessageLiveLocation.kt @@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.content.LiveLocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent /** @@ -25,7 +26,7 @@ public suspend fun TelegramBot.editLiveLocation( proximityAlertRadius: Meters? = null, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = execute( +): ContentMessage = execute( EditChatMessageLiveLocation( chatId, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup ) @@ -46,7 +47,7 @@ public suspend fun TelegramBot.editLiveLocation( proximityAlertRadius: Meters? = null, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(chat.id, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(chat.id, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -62,7 +63,7 @@ public suspend fun TelegramBot.editLiveLocation( proximityAlertRadius: Meters? = null, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(message.chat, message.messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(message.chat, message.messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -74,7 +75,7 @@ public suspend fun TelegramBot.editLiveLocation( location: LiveLocation, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = execute( +): ContentMessage = execute( EditChatMessageLiveLocation( chatId, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, businessConnectionId, replyMarkup ) @@ -90,7 +91,7 @@ public suspend fun TelegramBot.editLiveLocation( location: LiveLocation, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -101,4 +102,4 @@ public suspend fun TelegramBot.editLiveLocation( location: LiveLocation, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, businessConnectionId, replyMarkup) +): ContentMessage = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, businessConnectionId, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/StopChatMessageLiveLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/StopChatMessageLiveLocation.kt index 4c9932d135..c1d000e10a 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/StopChatMessageLiveLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/edit/location/live/StopChatMessageLiveLocation.kt @@ -10,6 +10,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.LocationContent +import dev.inmo.tgbotapi.types.message.content.StaticLocationContent /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -20,7 +21,7 @@ public suspend fun TelegramBot.stopLiveLocation( messageId: MessageId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = execute( +): ContentMessage = execute( StopChatMessageLiveLocation( chatId, messageId, businessConnectionId, replyMarkup ) @@ -35,7 +36,7 @@ public suspend fun TelegramBot.stopLiveLocation( messageId: MessageId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = stopLiveLocation(chat.id, messageId, businessConnectionId, replyMarkup) +): ContentMessage = stopLiveLocation(chat.id, messageId, businessConnectionId, replyMarkup) /** * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] @@ -45,4 +46,4 @@ public suspend fun TelegramBot.stopLiveLocation( message: ContentMessage, businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId, replyMarkup: InlineKeyboardMarkup? = null -): ContentMessage = stopLiveLocation(message.chat, message.messageId, businessConnectionId, replyMarkup) +): ContentMessage = stopLiveLocation(message.chat, message.messageId, businessConnectionId, 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 515afb94ad..583aa60f1c 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 @@ -153,7 +153,7 @@ public suspend inline fun TelegramBot.reply( effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( replyInChatId, latitude, longitude, @@ -181,7 +181,7 @@ public suspend inline fun TelegramBot.reply( effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( replyInChatId, location, replyInThreadId, 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 9357b164db..8d3138e1c3 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 @@ -161,7 +161,7 @@ public suspend inline fun TelegramBot.reply( effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( replyInChatId, latitude, longitude, @@ -190,7 +190,7 @@ public suspend inline fun TelegramBot.reply( effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( replyInChatId, location, replyInThreadId, diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLiveLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLiveLocation.kt index 525256ff67..bf696643da 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLiveLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLiveLocation.kt @@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage +import dev.inmo.tgbotapi.types.message.content.LiveLocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent /** @@ -29,7 +30,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = execute( +): ContentMessage = execute( SendLiveLocation( chatId, latitude, @@ -66,7 +67,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( chatId, location.latitude, location.longitude, @@ -102,7 +103,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( chat.id, latitude, longitude, @@ -137,7 +138,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( chatId = chat.id, latitude = location.latitude, longitude = location.longitude, @@ -173,7 +174,7 @@ public suspend fun TelegramBot.sendLiveLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -193,7 +194,7 @@ public suspend fun TelegramBot.sendLiveLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -214,7 +215,7 @@ public suspend fun TelegramBot.sendLiveLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -234,4 +235,4 @@ public suspend fun TelegramBot.sendLiveLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendStaticLocation.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendStaticLocation.kt index 52817c8cfe..0d1c619264 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendStaticLocation.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendStaticLocation.kt @@ -9,6 +9,7 @@ import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.content.LocationContent +import dev.inmo.tgbotapi.types.message.content.StaticLocationContent /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -25,7 +26,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = execute( +): ContentMessage = execute( SendStaticLocation( chatId, latitude, @@ -54,7 +55,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( chatId, location.latitude, location.longitude, @@ -82,7 +83,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( chat.id, latitude, longitude, @@ -109,7 +110,7 @@ public suspend fun TelegramBot.sendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation( +): ContentMessage = sendLocation( chat.id, location.latitude, location.longitude, @@ -137,7 +138,7 @@ public suspend fun TelegramBot.sendStaticLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -153,7 +154,7 @@ public suspend fun TelegramBot.sendStaticLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chatId, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chatId, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -170,7 +171,7 @@ public suspend fun TelegramBot.sendStaticLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chat.id, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chat.id, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or @@ -186,4 +187,4 @@ public suspend fun TelegramBot.sendStaticLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLocation(chat.id, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendLocation(chat.id, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt index 22bad29ebb..304b739049 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt @@ -517,7 +517,7 @@ public suspend fun TelegramBot.send( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendStaticLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendStaticLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * Will execute [sendStaticLocation] request @@ -534,7 +534,7 @@ public suspend fun TelegramBot.send( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendStaticLocation(chatId, location, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendStaticLocation(chatId, location, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * Will execute [sendStaticLocation] request @@ -552,7 +552,7 @@ public suspend fun TelegramBot.send( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendStaticLocation(chat, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendStaticLocation(chat, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * Will execute [sendStaticLocation] request @@ -569,7 +569,7 @@ public suspend fun TelegramBot.send( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendStaticLocation(chat, location, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) +): ContentMessage = sendStaticLocation(chat, location, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) /** * Will execute [sendTextMessage] request @@ -1581,7 +1581,7 @@ public suspend fun TelegramBot.send( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLiveLocation( +): ContentMessage = sendLiveLocation( chatId = chatId, latitude = latitude, longitude = longitude, @@ -1617,7 +1617,7 @@ public suspend fun TelegramBot.send( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLiveLocation( +): ContentMessage = sendLiveLocation( chatId, location, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup ) @@ -1641,7 +1641,7 @@ public suspend fun TelegramBot.send( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLiveLocation( +): ContentMessage = sendLiveLocation( chat, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup ) @@ -1662,9 +1662,9 @@ public suspend fun TelegramBot.send( disableNotification: Boolean = false, protectContent: Boolean = false, effectId: EffectId? = null, - replyParameters: ReplyParameters? = null, + replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -): ContentMessage = sendLiveLocation( +): ContentMessage = sendLiveLocation( chat, location, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup ) diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index 445c74f35a..f5acd5432e 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -4684,9 +4684,24 @@ public final class dev/inmo/tgbotapi/requests/send/SendDice$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/inmo/tgbotapi/requests/send/SendLocation : dev/inmo/tgbotapi/abstracts/Headed, dev/inmo/tgbotapi/abstracts/HorizontallyAccured, dev/inmo/tgbotapi/abstracts/Livable, dev/inmo/tgbotapi/abstracts/ProximityAlertable, dev/inmo/tgbotapi/requests/send/abstracts/PositionedSendMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/ReplyingMarkupSendMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/SendContentMessageRequest { +public abstract interface class dev/inmo/tgbotapi/requests/send/SendLocation : dev/inmo/tgbotapi/abstracts/Headed, dev/inmo/tgbotapi/abstracts/HorizontallyAccured, dev/inmo/tgbotapi/abstracts/Livable, dev/inmo/tgbotapi/abstracts/ProximityAlertable, dev/inmo/tgbotapi/requests/send/abstracts/PositionedSendMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/ReplyingMarkupSendMessageRequest, dev/inmo/tgbotapi/requests/send/abstracts/SendContentMessageRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/send/SendLocation$Companion; - public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLjava/lang/Integer;Ljava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public abstract fun method ()Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/requests/send/SendLocation$Companion { + public final fun serializer (Lkotlinx/serialization/KSerializer;)Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/send/SendLocation$DefaultImpls { + public static fun getAllowSendingWithoutReply (Ldev/inmo/tgbotapi/requests/send/SendLocation;)Ljava/lang/Boolean; + public static fun getReplyToMessageId-CigXjpw (Ldev/inmo/tgbotapi/requests/send/SendLocation;)Ldev/inmo/tgbotapi/types/MessageId; + public static fun method (Ldev/inmo/tgbotapi/requests/send/SendLocation;)Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/requests/send/SendLocation$Live : dev/inmo/tgbotapi/requests/send/SendLocation { + public static final field Companion Ldev/inmo/tgbotapi/requests/send/SendLocation$Live$Companion; + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; public final fun component10 ()Z public final fun component11 ()Z @@ -4695,14 +4710,14 @@ public final class dev/inmo/tgbotapi/requests/send/SendLocation : dev/inmo/tgbot public final fun component14 ()Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup; public final fun component2 ()D public final fun component3 ()D - public final fun component4 ()Ljava/lang/Integer; + public final fun component4 ()I public final fun component5 ()Ljava/lang/Float; public final fun component6 ()Ljava/lang/Integer; public final fun component7 ()Ljava/lang/Float; public final fun component8-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; public final fun component9-nXr5wdE ()Ljava/lang/String; - public final fun copy-3sgDXH4 (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLjava/lang/Integer;Ljava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation; - public static synthetic fun copy-3sgDXH4$default (Ldev/inmo/tgbotapi/requests/send/SendLocation;Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLjava/lang/Integer;Ljava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation; + public final fun copy-3sgDXH4 (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Live; + public static synthetic fun copy-3sgDXH4$default (Ldev/inmo/tgbotapi/requests/send/SendLocation$Live;Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Live; public fun equals (Ljava/lang/Object;)Z public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; @@ -4727,28 +4742,82 @@ public final class dev/inmo/tgbotapi/requests/send/SendLocation : dev/inmo/tgbot public fun toString ()Ljava/lang/String; } -public final class dev/inmo/tgbotapi/requests/send/SendLocation$$serializer : kotlinx/serialization/internal/GeneratedSerializer { - public static final field INSTANCE Ldev/inmo/tgbotapi/requests/send/SendLocation$$serializer; +public final class dev/inmo/tgbotapi/requests/send/SendLocation$Live$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/send/SendLocation$Live$$serializer; public fun childSerializers ()[Lkotlinx/serialization/KSerializer; - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/send/SendLocation; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Live; 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/requests/send/SendLocation;)V + public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/requests/send/SendLocation$Live;)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/requests/send/SendLocation$Companion { +public final class dev/inmo/tgbotapi/requests/send/SendLocation$Live$Companion { + public final fun serializer ()Lkotlinx/serialization/KSerializer; +} + +public final class dev/inmo/tgbotapi/requests/send/SendLocation$Static : dev/inmo/tgbotapi/requests/send/SendLocation { + public static final field Companion Ldev/inmo/tgbotapi/requests/send/SendLocation$Static$Companion; + public synthetic fun (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public final fun component1 ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public final fun component10 ()Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup; + public final fun component2 ()D + public final fun component3 ()D + public final fun component4-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; + public final fun component5-nXr5wdE ()Ljava/lang/String; + public final fun component6 ()Z + public final fun component7 ()Z + public final fun component8-Ts0V7ak ()Ljava/lang/String; + public final fun component9 ()Ldev/inmo/tgbotapi/types/ReplyParameters; + public final fun copy-H0gMNAo (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; + public static synthetic fun copy-H0gMNAo$default (Ldev/inmo/tgbotapi/requests/send/SendLocation$Static;Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; + public fun equals (Ljava/lang/Object;)Z + public fun getAllowSendingWithoutReply ()Ljava/lang/Boolean; + public fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; + public fun getChatId ()Ldev/inmo/tgbotapi/types/ChatIdentifier; + public fun getDisableNotification ()Z + public fun getEffectId-Ts0V7ak ()Ljava/lang/String; + public fun getHeading ()Ljava/lang/Integer; + public fun getHorizontalAccuracy ()Ljava/lang/Float; + public fun getLatitude ()D + public fun getLivePeriod ()Ljava/lang/Integer; + public fun getLongitude ()D + public fun getProtectContent ()Z + public fun getProximityAlertRadius ()Ljava/lang/Float; + public fun getReplyMarkup ()Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup; + public fun getReplyParameters ()Ldev/inmo/tgbotapi/types/ReplyParameters; + public fun getReplyToMessageId-CigXjpw ()Ldev/inmo/tgbotapi/types/MessageId; + public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; + public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; + public fun getThreadId-S3HF-10 ()Ldev/inmo/tgbotapi/types/MessageThreadId; + public fun hashCode ()I + public fun method ()Ljava/lang/String; + public fun toString ()Ljava/lang/String; +} + +public final class dev/inmo/tgbotapi/requests/send/SendLocation$Static$$serializer : kotlinx/serialization/internal/GeneratedSerializer { + public static final field INSTANCE Ldev/inmo/tgbotapi/requests/send/SendLocation$Static$$serializer; + public fun childSerializers ()[Lkotlinx/serialization/KSerializer; + public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; + 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/requests/send/SendLocation$Static;)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/requests/send/SendLocation$Static$Companion { public final fun serializer ()Lkotlinx/serialization/KSerializer; } public final class dev/inmo/tgbotapi/requests/send/SendLocationKt { - public static final fun SendLiveLocation-3sgDXH4 (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation; - public static synthetic fun SendLiveLocation-3sgDXH4$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation; - public static final fun SendLocation-H0gMNAo (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation; - public static synthetic fun SendLocation-H0gMNAo$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation; - public static final fun SendStaticLocation-H0gMNAo (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation; - public static synthetic fun SendStaticLocation-H0gMNAo$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation; + public static final fun SendLiveLocation-3sgDXH4 (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Live; + public static synthetic fun SendLiveLocation-3sgDXH4$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDILjava/lang/Float;Ljava/lang/Integer;Ljava/lang/Float;Ldev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Live; + public static final fun SendLocation-H0gMNAo (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; + public static synthetic fun SendLocation-H0gMNAo$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; + public static final fun SendStaticLocation-H0gMNAo (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; + public static synthetic fun SendStaticLocation-H0gMNAo$default (Ldev/inmo/tgbotapi/types/ChatIdentifier;DDLdev/inmo/tgbotapi/types/MessageThreadId;Ljava/lang/String;ZZLjava/lang/String;Ldev/inmo/tgbotapi/types/ReplyParameters;Ldev/inmo/tgbotapi/types/buttons/KeyboardMarkup;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/send/SendLocation$Static; } public final class dev/inmo/tgbotapi/requests/send/SendMessageKt { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt index 39c8c465eb..1eaac34b53 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/EditChatMessageLiveLocation.kt @@ -7,11 +7,12 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass +import dev.inmo.tgbotapi.types.message.content.LiveLocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.utils.throwRangeError import kotlinx.serialization.* -private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass>() +private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass>() const val editMessageLiveLocationMethod = "editMessageLiveLocation" @Serializable @@ -36,9 +37,9 @@ data class EditChatMessageLiveLocation( override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null -) : EditChatMessage, EditReplyMessage, EditLocationMessage { +) : EditChatMessage, EditReplyMessage, EditLocationMessage { override fun method(): String = editMessageLiveLocationMethod - override val resultDeserializer: DeserializationStrategy> + override val resultDeserializer: DeserializationStrategy> get() = commonResultDeserializer override val requestSerializer: SerializationStrategy<*> get() = serializer() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/StopChatMessageLiveLocation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/StopChatMessageLiveLocation.kt index c7f6c59dbb..2c945cdf5e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/StopChatMessageLiveLocation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/location/live/StopChatMessageLiveLocation.kt @@ -8,9 +8,10 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.content.LocationContent +import dev.inmo.tgbotapi.types.message.content.StaticLocationContent import kotlinx.serialization.* -private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass>() +private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass>() const val stopMessageLiveLocationMethod = "stopMessageLiveLocation" @Serializable @@ -23,9 +24,9 @@ data class StopChatMessageLiveLocation( override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, @SerialName(replyMarkupField) override val replyMarkup: InlineKeyboardMarkup? = null -) : EditChatMessage, EditReplyMessage { +) : EditChatMessage, EditReplyMessage { override fun method(): String = stopMessageLiveLocationMethod - override val resultDeserializer: DeserializationStrategy> + override val resultDeserializer: DeserializationStrategy> get() = commonResultDeserializer override val requestSerializer: SerializationStrategy<*> get() = serializer() diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt index 5c80328af1..d89374fdf2 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/send/SendLocation.kt @@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.* import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup +import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.content.* @@ -15,6 +16,12 @@ import kotlinx.serialization.* private val commonResultDeserializer: DeserializationStrategy> = TelegramBotAPIMessageDeserializationStrategyClass() +private val liveResultDeserializer: DeserializationStrategy> + = TelegramBotAPIMessageDeserializationStrategyClass() + +private val staticResultDeserializer: DeserializationStrategy> + = TelegramBotAPIMessageDeserializationStrategyClass() + fun SendLocation( chatId: ChatIdentifier, latitude: Double, @@ -26,14 +33,10 @@ fun SendLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -) = SendLocation( +) = SendLocation.Static( chatId, latitude, longitude, - null, - null, - null, - null, threadId, businessConnectionId, disableNotification, @@ -54,7 +57,7 @@ fun SendStaticLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -) = SendLocation( +) = SendLocation.Static( chatId = chatId, latitude = latitude, longitude = longitude, @@ -82,7 +85,7 @@ fun SendLiveLocation( effectId: EffectId? = null, replyParameters: ReplyParameters? = null, replyMarkup: KeyboardMarkup? = null -) = SendLocation( +) = SendLocation.Live( chatId = chatId, latitude = latitude, longitude = longitude, @@ -100,55 +103,95 @@ fun SendLiveLocation( ) @Serializable -data class SendLocation internal constructor( - @SerialName(chatIdField) - override val chatId: ChatIdentifier, - @SerialName(latitudeField) - override val latitude: Double, - @SerialName(longitudeField) - override val longitude: Double, - @SerialName(livePeriodField) - override val livePeriod: Seconds? = null, - @SerialName(horizontalAccuracyField) - override val horizontalAccuracy: Meters? = null, - @SerialName(headingField) - override val heading: Degrees? = null, - @SerialName(proximityAlertRadiusField) - override val proximityAlertRadius: Meters? = null, - @SerialName(messageThreadIdField) - override val threadId: MessageThreadId? = chatId.threadId, - @SerialName(businessConnectionIdField) - override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, - @SerialName(disableNotificationField) - override val disableNotification: Boolean = false, - @SerialName(protectContentField) - override val protectContent: Boolean = false, - @SerialName(messageEffectIdField) - override val effectId: EffectId? = null, - @SerialName(replyParametersField) - override val replyParameters: ReplyParameters? = null, - @SerialName(replyMarkupField) - override val replyMarkup: KeyboardMarkup? = null -) : SendContentMessageRequest>, - ReplyingMarkupSendMessageRequest>, - PositionedSendMessageRequest>, +sealed interface SendLocation : SendContentMessageRequest>, + ReplyingMarkupSendMessageRequest>, + PositionedSendMessageRequest>, HorizontallyAccured, Livable, ProximityAlertable, - Headed -{ + Headed { override fun method(): String = "sendLocation" - override val resultDeserializer: DeserializationStrategy> - get() = commonResultDeserializer - override val requestSerializer: SerializationStrategy<*> - get() = serializer() - init { - if (livePeriod != null && livePeriod !in livePeriodLimit) { - error("Live period for sending location must be in $livePeriodLimit, but was $livePeriod") - } - if (horizontalAccuracy != null && horizontalAccuracy !in horizontalAccuracyLimit) { - throwRangeError("horizontalAccuracy", horizontalAccuracyLimit, horizontalAccuracy) + @Serializable + data class Live internal constructor( + @SerialName(chatIdField) + override val chatId: ChatIdentifier, + @SerialName(latitudeField) + override val latitude: Double, + @SerialName(longitudeField) + override val longitude: Double, + @SerialName(livePeriodField) + override val livePeriod: Seconds = LiveLocation.INDEFINITE_LIVE_PERIOD, + @SerialName(horizontalAccuracyField) + override val horizontalAccuracy: Meters? = null, + @SerialName(headingField) + override val heading: Degrees? = null, + @SerialName(proximityAlertRadiusField) + override val proximityAlertRadius: Meters? = null, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, + @SerialName(disableNotificationField) + override val disableNotification: Boolean = false, + @SerialName(protectContentField) + override val protectContent: Boolean = false, + @SerialName(messageEffectIdField) + override val effectId: EffectId? = null, + @SerialName(replyParametersField) + override val replyParameters: ReplyParameters? = null, + @SerialName(replyMarkupField) + override val replyMarkup: KeyboardMarkup? = null + ) : SendLocation { + override val resultDeserializer: DeserializationStrategy> + get() = liveResultDeserializer + override val requestSerializer: SerializationStrategy<*> + get() = Live.serializer() + + init { + if (livePeriod !in livePeriodLimit) { + error("Live period for sending location must be in $livePeriodLimit, but was $livePeriod") + } + if (horizontalAccuracy != null && horizontalAccuracy !in horizontalAccuracyLimit) { + throwRangeError("horizontalAccuracy", horizontalAccuracyLimit, horizontalAccuracy) + } } } + + @Serializable + data class Static internal constructor( + @SerialName(chatIdField) + override val chatId: ChatIdentifier, + @SerialName(latitudeField) + override val latitude: Double, + @SerialName(longitudeField) + override val longitude: Double, + @SerialName(messageThreadIdField) + override val threadId: MessageThreadId? = chatId.threadId, + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, + @SerialName(disableNotificationField) + override val disableNotification: Boolean = false, + @SerialName(protectContentField) + override val protectContent: Boolean = false, + @SerialName(messageEffectIdField) + override val effectId: EffectId? = null, + @SerialName(replyParametersField) + override val replyParameters: ReplyParameters? = null, + @SerialName(replyMarkupField) + override val replyMarkup: KeyboardMarkup? = null + ) : SendLocation { + override val livePeriod: Seconds? + get() = null + override val horizontalAccuracy: Meters? + get() = null + override val heading: Degrees? + get() = null + override val proximityAlertRadius: Meters? + get() = null + override val resultDeserializer: DeserializationStrategy> + get() = staticResultDeserializer + override val requestSerializer: SerializationStrategy<*> + get() = serializer() + } }