1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 03:28:44 +00:00

Foursquare and fixes of deprecations in methods

This commit is contained in:
InsanusMokrassar 2020-07-02 00:52:52 +06:00
parent 975898660c
commit ff0b7faa48
6 changed files with 33 additions and 0 deletions

View File

@ -59,6 +59,9 @@
* `FoursquareId` and `FoursquareType` typealiases were added
* `TelegramBotAPI-extensions-utils`:
* Several new functions `makeLinkToMessage` was added
* `Foursquare` data class was added
* Extension `Venue#foursquare` was added
* Factory function `Venue` with `Foursquare` parameter was added
### 0.27.7

View File

@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendVenue
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.venue.Venue
suspend fun RequestsExecutor.sendVenue(
chatId: ChatIdentifier,

View File

@ -0,0 +1,26 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.extensions.venue
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
val Venue.foursquare: Foursquare?
get() = foursquareId ?.let {
Foursquare(it, foursquareType)
}
fun Venue(
location: Location,
title: String,
address: String,
foursquare: Foursquare
) = Venue(location, title, address, foursquare.id, foursquare.type)
@Serializable
data class Foursquare(
@SerialName(foursquareIdField)
val id: FoursquareId,
@SerialName(foursquareTypeField)
val type: FoursquareType? = null
)

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
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
import com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue
import kotlinx.serialization.*
private val commonResultDeserializer: DeserializationStrategy<ContentMessage<VenueContent>>

View File

@ -20,6 +20,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.Success
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.Invoice
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.SuccessfulPayment
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
import com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlin.reflect.KClass

View File

@ -6,6 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue
data class VenueContent(
val venue: Venue