1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-21 06:45:46 +00:00

Compare commits

...

5 Commits

8 changed files with 29 additions and 11 deletions

View File

@@ -1,5 +1,7 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 12.1.0
## 12.0.1 ## 12.0.1
* `Version`: * `Version`:

View File

@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
library_group=dev.inmo library_group=dev.inmo
library_version=12.0.1 library_version=12.1.0

View File

@@ -55,6 +55,7 @@ suspend fun TelegramBot.edit(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
@@ -70,6 +71,7 @@ suspend fun TelegramBot.edit(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
@@ -84,11 +86,12 @@ suspend fun TelegramBot.edit(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(message, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]

View File

@@ -18,13 +18,14 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageLiveLocation( EditChatMessageLiveLocation(
chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup chatId, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
) )
) )
@@ -37,11 +38,12 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(chat.id, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -51,11 +53,12 @@ suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(message.chat, message.messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -68,7 +71,7 @@ suspend fun TelegramBot.editLiveLocation(
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageLiveLocation( EditChatMessageLiveLocation(
chatId, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup chatId, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup
) )
) )
@@ -81,7 +84,7 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageId, messageId: MessageId,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) ) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -91,4 +94,4 @@ suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) ) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.edit.location.live
import dev.inmo.tgbotapi.requests.edit.abstracts.* import dev.inmo.tgbotapi.requests.edit.abstracts.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup 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.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent
@@ -22,6 +23,8 @@ data class EditChatMessageLiveLocation(
override val latitude: Double, override val latitude: Double,
@SerialName(longitudeField) @SerialName(longitudeField)
override val longitude: Double, override val longitude: Double,
@SerialName(livePeriodField)
val livePeriod: Seconds? = null,
@SerialName(horizontalAccuracyField) @SerialName(horizontalAccuracyField)
override val horizontalAccuracy: Meters? = null, override val horizontalAccuracy: Meters? = null,
@SerialName(headingField) @SerialName(headingField)

View File

@@ -234,6 +234,7 @@ const val isAnimatedField = "is_animated"
const val isVideoField = "is_video" const val isVideoField = "is_video"
const val inviteLinkField = "invite_link" const val inviteLinkField = "invite_link"
const val viaChatFolderInviteLinkField = "via_chat_folder_invite_link" const val viaChatFolderInviteLinkField = "via_chat_folder_invite_link"
const val viaJoinRequestField = "via_join_request"
const val pinnedMessageField = "pinned_message" const val pinnedMessageField = "pinned_message"
const val activeUsernamesField = "active_usernames" const val activeUsernamesField = "active_usernames"
const val customTitleField = "custom_title" const val customTitleField = "custom_title"

View File

@@ -24,5 +24,7 @@ data class ChatMemberUpdated(
@SerialName(inviteLinkField) @SerialName(inviteLinkField)
val inviteLink: ChatInviteLink? = null, val inviteLink: ChatInviteLink? = null,
@SerialName(viaChatFolderInviteLinkField) @SerialName(viaChatFolderInviteLinkField)
val viaChatFolderInviteLink: Boolean? = false val viaChatFolderInviteLink: Boolean? = false,
@SerialName(viaJoinRequestField)
val viaJoinRequest: Boolean? = false
) : WithPreviewChat, WithUser ) : WithPreviewChat, WithUser

View File

@@ -41,12 +41,16 @@ data class LiveLocation(
@SerialName(horizontalAccuracyField) @SerialName(horizontalAccuracyField)
override val horizontalAccuracy: Meters? = null, override val horizontalAccuracy: Meters? = null,
@SerialName(livePeriodField) @SerialName(livePeriodField)
override val livePeriod: Seconds, override val livePeriod: Seconds = INDEFINITE_LIVE_PERIOD,
@SerialName(headingField) @SerialName(headingField)
override val heading: Degrees? = null, override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField) @SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null override val proximityAlertRadius: Meters? = null
) : Location, Livable, ProximityAlertable, Headed ) : Location, Livable, ProximityAlertable, Headed {
companion object {
const val INDEFINITE_LIVE_PERIOD: Seconds = 0x7FFFFFFF
}
}
object LocationSerializer : KSerializer<Location> { object LocationSerializer : KSerializer<Location> {
private val internalSerializer = JsonObject.serializer() private val internalSerializer = JsonObject.serializer()