1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-03 00:15:27 +00:00
tgbotapi/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/LocationContent.kt

45 lines
1.4 KiB
Kotlin
Raw Normal View History

2020-10-04 11:06:30 +00:00
package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.requests.abstracts.Request
2020-11-04 19:12:14 +00:00
import dev.inmo.tgbotapi.requests.send.*
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
2020-11-04 19:12:14 +00:00
import dev.inmo.tgbotapi.types.location.*
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
2020-11-05 17:48:23 +00:00
import kotlinx.serialization.Serializable
2020-10-04 11:06:30 +00:00
2020-11-05 17:48:23 +00:00
@Serializable
2020-10-04 11:06:30 +00:00
data class LocationContent(
val location: Location
) : MessageContent {
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
replyToMessageId: MessageIdentifier?,
replyMarkup: KeyboardMarkup?
2020-11-04 19:12:14 +00:00
): Request<ContentMessage<LocationContent>> = when (location) {
is StaticLocation -> SendStaticLocation(
chatId,
location.latitude,
location.longitude,
disableNotification,
replyToMessageId,
2020-11-05 17:48:23 +00:00
allowSendingWithoutReply,
2020-11-04 19:12:14 +00:00
replyMarkup
)
is LiveLocation -> SendLiveLocation(
chatId,
location.latitude,
location.longitude,
location.livePeriod,
location.horizontalAccuracy,
location.heading,
location.proximityAlertRadius,
disableNotification,
replyToMessageId,
2020-11-05 17:48:23 +00:00
allowSendingWithoutReply,
2020-11-04 19:12:14 +00:00
replyMarkup
)
}
2020-10-04 11:06:30 +00:00
}