From bc7cfc0d32bfb02f45bffca1f63a483aefea1e37 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Thu, 6 Feb 2020 22:40:19 +0600 Subject: [PATCH] add send venue extensions --- .../TelegramBotAPI/requests/send/SendVenue.kt | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt index 18e3931cfe..d675b6d394 100644 --- a/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt +++ b/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt @@ -1,8 +1,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.send +import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup +import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent @@ -73,3 +75,55 @@ fun Venue.toRequest( replyToMessageId, replyMarkup ) + +suspend fun RequestsExecutor.sendVenue( + chatId: ChatIdentifier, + latitude: Double, + longitude: Double, + title: String, + address: String, + foursquareId: String? = null, + disableNotification: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + replyMarkup: KeyboardMarkup? = null +) = execute( + SendVenue( + chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup + ) +) + +suspend fun RequestsExecutor.sendVenue( + chat: Chat, + latitude: Double, + longitude: Double, + title: String, + address: String, + foursquareId: String? = null, + disableNotification: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + replyMarkup: KeyboardMarkup? = null +) = sendVenue( + chat.id, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup +) + +suspend fun RequestsExecutor.sendVenue( + chatId: ChatIdentifier, + venue: Venue, + disableNotification: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + replyMarkup: KeyboardMarkup? = null +) = execute( + SendVenue( + chatId, venue, disableNotification, replyToMessageId, replyMarkup + ) +) + +suspend fun RequestsExecutor.sendVenue( + chat: Chat, + venue: Venue, + disableNotification: Boolean = false, + replyToMessageId: MessageIdentifier? = null, + replyMarkup: KeyboardMarkup? = null +) = sendVenue( + chat.id, venue, disableNotification, replyToMessageId, replyMarkup +)