45 lines
1.4 KiB
Kotlin
45 lines
1.4 KiB
Kotlin
package dev.inmo.tgbotapi.types.message.content
|
|
|
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
|
import dev.inmo.tgbotapi.requests.send.*
|
|
import dev.inmo.tgbotapi.types.*
|
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
|
import dev.inmo.tgbotapi.types.location.*
|
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
|
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
|
import kotlinx.serialization.Serializable
|
|
|
|
@Serializable
|
|
data class LocationContent(
|
|
val location: Location
|
|
) : MessageContent {
|
|
override fun createResend(
|
|
chatId: ChatIdentifier,
|
|
disableNotification: Boolean,
|
|
replyToMessageId: MessageIdentifier?,
|
|
replyMarkup: KeyboardMarkup?
|
|
): Request<ContentMessage<LocationContent>> = when (location) {
|
|
is StaticLocation -> SendStaticLocation(
|
|
chatId,
|
|
location.latitude,
|
|
location.longitude,
|
|
disableNotification,
|
|
replyToMessageId,
|
|
allowSendingWithoutReply,
|
|
replyMarkup
|
|
)
|
|
is LiveLocation -> SendLiveLocation(
|
|
chatId,
|
|
location.latitude,
|
|
location.longitude,
|
|
location.livePeriod,
|
|
location.horizontalAccuracy,
|
|
location.heading,
|
|
location.proximityAlertRadius,
|
|
disableNotification,
|
|
replyToMessageId,
|
|
allowSendingWithoutReply,
|
|
replyMarkup
|
|
)
|
|
}
|
|
} |