tgbotapi/tgbotapi.extensions.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendVenue.kt

242 lines
7.6 KiB
Kotlin

package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendVenue
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.FoursquareId
import dev.inmo.tgbotapi.types.FoursquareType
import dev.inmo.tgbotapi.types.GooglePlaceId
import dev.inmo.tgbotapi.types.GooglePlaceType
import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.venue.Venue
suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVenue(
chatId = chatId,
latitude = latitude,
longitude = longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
)
suspend fun TelegramBot.sendVenue(
chat: Chat,
latitude: Double,
longitude: Double,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chat.id,
latitude = latitude,
longitude = longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier,
location: StaticLocation,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
suspend fun TelegramBot.sendVenue(
chat: Chat,
location: StaticLocation,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier,
venue: Venue,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVenue(
chatId = chatId,
venue = venue,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
)
suspend fun TelegramBot.sendVenue(
chat: Chat,
venue: Venue,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chatId = chat.id,
venue = venue,
disableNotification = disableNotification,
replyToMessageId = replyToMessageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
suspend inline fun TelegramBot.reply(
to: Message,
latitude: Double,
longitude: Double,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chat = to.chat,
latitude = latitude,
longitude = longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
disableNotification = disableNotification,
replyToMessageId = to.messageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
suspend inline fun TelegramBot.reply(
to: Message,
location: StaticLocation,
title: String,
address: String,
foursquareId: FoursquareId? = null,
foursquareType: FoursquareType? = null,
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chat = to.chat,
latitude = location.latitude,
longitude = location.longitude,
title = title,
address = address,
foursquareId = foursquareId,
foursquareType = foursquareType,
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
disableNotification = disableNotification,
replyToMessageId = to.messageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)
suspend inline fun TelegramBot.reply(
to: Message,
venue: Venue,
disableNotification: Boolean = false,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chat = to.chat,
venue = venue,
disableNotification = disableNotification,
replyToMessageId = to.messageId,
allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup
)