mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
upfixes
This commit is contained in:
parent
6ba9a31fb9
commit
4f920abb61
@ -11,6 +11,7 @@
|
|||||||
* New extensions `TextSourcesList#make*String` for all parse modes
|
* New extensions `TextSourcesList#make*String` for all parse modes
|
||||||
* All `MessageContent` subclasses now serializable
|
* All `MessageContent` subclasses now serializable
|
||||||
* `ChosenInlineResult` was replaced and modified to be sealed
|
* `ChosenInlineResult` was replaced and modified to be sealed
|
||||||
|
* `ChosenInlineResult` now extends `FromUser`
|
||||||
* Added `Update#sourceUser` method
|
* Added `Update#sourceUser` method
|
||||||
* More types assumed as sent by user types now implements `FromUser` interface
|
* More types assumed as sent by user types now implements `FromUser` interface
|
||||||
* Added `Any#whenFromUser`, `Any#asFromUser` and`Any#requireFromUser` extensions
|
* Added `Any#whenFromUser`, `Any#asFromUser` and`Any#requireFromUser` extensions
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class BaseChosenInlineResult(
|
data class BaseChosenInlineResult(
|
||||||
override val resultId: InlineQueryIdentifier,
|
override val resultId: InlineQueryIdentifier,
|
||||||
|
@SerialName(fromField)
|
||||||
override val user: User,
|
override val user: User,
|
||||||
override val inlineMessageId: InlineMessageIdentifier?,
|
override val inlineMessageId: InlineMessageIdentifier?,
|
||||||
override val query: String
|
override val query: String
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
|
||||||
sealed interface ChosenInlineResult {
|
sealed interface ChosenInlineResult : FromUser {
|
||||||
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
||||||
val user: User
|
|
||||||
val inlineMessageId: InlineMessageIdentifier?
|
val inlineMessageId: InlineMessageIdentifier?
|
||||||
val query: String
|
val query: String
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,13 @@ package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
data class LocationChosenInlineResult(
|
data class LocationChosenInlineResult(
|
||||||
override val resultId: InlineQueryIdentifier,
|
override val resultId: InlineQueryIdentifier,
|
||||||
|
@SerialName(fromField)
|
||||||
override val user: User,
|
override val user: User,
|
||||||
val location: StaticLocation,
|
val location: StaticLocation,
|
||||||
override val inlineMessageId: InlineMessageIdentifier?,
|
override val inlineMessageId: InlineMessageIdentifier?,
|
||||||
|
@ -19,7 +19,7 @@ internal data class RawChosenInlineResult(
|
|||||||
val inlineMessageId: InlineMessageIdentifier? = null
|
val inlineMessageId: InlineMessageIdentifier? = null
|
||||||
) {
|
) {
|
||||||
val asChosenInlineResult: ChosenInlineResult by lazy {
|
val asChosenInlineResult: ChosenInlineResult by lazy {
|
||||||
location?.let {
|
location ?.let {
|
||||||
LocationChosenInlineResult(resultId, user, location, inlineMessageId, query)
|
LocationChosenInlineResult(resultId, user, location, inlineMessageId, query)
|
||||||
} ?: BaseChosenInlineResult(resultId, user, inlineMessageId, query)
|
} ?: BaseChosenInlineResult(resultId, user, inlineMessageId, query)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user