1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-06-01 23:45:25 +00:00
tgbotapi/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendLocation.kt

137 lines
3.9 KiB
Kotlin
Raw Normal View History

package dev.inmo.tgbotapi.extensions.api.send
2020-02-15 09:33:04 +00:00
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendLocation
2020-11-05 17:48:23 +00:00
import dev.inmo.tgbotapi.requests.send.SendStaticLocation
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
2020-11-04 19:12:14 +00:00
import dev.inmo.tgbotapi.types.location.StaticLocation
2020-10-04 11:06:30 +00:00
import dev.inmo.tgbotapi.types.message.abstracts.Message
2020-02-15 09:33:04 +00:00
suspend fun TelegramBot.sendLocation(
2020-02-15 09:33:04 +00:00
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
2020-11-05 17:48:23 +00:00
SendStaticLocation(
2020-02-15 09:33:04 +00:00
chatId,
latitude,
longitude,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
replyMarkup = replyMarkup
)
)
suspend fun TelegramBot.sendLocation(
2020-02-15 09:33:04 +00:00
chatId: ChatIdentifier,
2020-11-04 19:12:14 +00:00
location: StaticLocation,
2020-02-15 09:33:04 +00:00
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chatId,
location.latitude,
location.longitude,
disableNotification,
replyToMessageId,
replyMarkup
)
suspend fun TelegramBot.sendLocation(
2020-02-15 09:33:04 +00:00
chat: Chat,
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chat.id,
latitude,
longitude,
disableNotification,
replyToMessageId,
replyMarkup
)
suspend fun TelegramBot.sendLocation(
2020-02-15 09:33:04 +00:00
chat: Chat,
2020-11-04 19:12:14 +00:00
location: StaticLocation,
2020-02-15 09:33:04 +00:00
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
chat.id,
location.latitude,
location.longitude,
disableNotification,
replyToMessageId,
replyMarkup
)
2020-10-04 10:47:30 +00:00
2020-11-05 17:48:23 +00:00
suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, disableNotification, replyToMessageId, replyMarkup)
suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
location: StaticLocation,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, disableNotification, replyToMessageId, replyMarkup)
suspend fun TelegramBot.sendStaticLocation(
chat: Chat,
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, disableNotification, replyToMessageId, replyMarkup)
suspend fun TelegramBot.sendStaticLocation(
chat: Chat,
location: StaticLocation,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, disableNotification, replyToMessageId, replyMarkup)
2020-10-04 10:47:30 +00:00
suspend inline fun TelegramBot.reply(
to: Message,
latitude: Double,
longitude: Double,
disableNotification: Boolean = false,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
to.chat,
latitude,
longitude,
disableNotification,
to.messageId,
replyMarkup
)
suspend inline fun TelegramBot.reply(
to: Message,
2020-11-04 19:12:14 +00:00
location: StaticLocation,
2020-10-04 10:47:30 +00:00
disableNotification: Boolean = false,
replyMarkup: KeyboardMarkup? = null
) = sendLocation(
to.chat,
location,
disableNotification,
to.messageId,
replyMarkup
)