mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-30 14:08:44 +00:00
Merge branch '0.35.3' into klassindex
This commit is contained in:
commit
25cf660791
70
CHANGELOG.md
70
CHANGELOG.md
@ -1,5 +1,75 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 0.35.3
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `Klock`: `2.2.0` -> `2.3.1`
|
||||
* `Ktor`: `1.6.1` -> `1.6.2`
|
||||
* `MicroUtils`: `0.5.16` -> `0.5.18`
|
||||
* `Core`:
|
||||
* Support of strongly-typed ietf language codes has been added
|
||||
* `API`:
|
||||
* New extension `TelegramBot#downloadFile` for any `MediaContent`
|
||||
* `Behaviour Builder`:
|
||||
* New provider `defaultCoroutineScopeProvider`
|
||||
* Now it is not necessary to provide `CoroutineScope` to `TelegramBot#buildBehaviour`
|
||||
extension
|
||||
* New `TelegramBot#buildBehaviour` extension with `FlowUpdatesFilter` and `CoroutineScope` with
|
||||
default `CoroutineScope`
|
||||
* New typealias `SimpleFilter` for unifying triggers filter signatures
|
||||
|
||||
## 0.35.2
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `Kotlin`: `1.5.20` -> `1.5.21`
|
||||
* `Coroutines`: `1.5.0` -> `1.5.1`
|
||||
* `Serialization`: `1.2.1` -> `1.2.2`
|
||||
* `Klock`: `2.1.2` -> `2.2.0`
|
||||
* `Ktor`: `1.6.0` -> `1.6.1`
|
||||
* `MicroUtils`: `0.5.15` -> `0.5.16`
|
||||
|
||||
## 0.35.1
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `Kotlin`: `1.5.10` -> `1.5.20`
|
||||
* `MicroUtils`: `0.5.6` -> `0.5.15`
|
||||
* `Core`:
|
||||
* New interface `MyCommandsRequest` (also see `Bot API 5.3` below)
|
||||
* New extensions `TextSourcesList#make*String` for all parse modes
|
||||
* All `MessageContent` subclasses now serializable
|
||||
* `ChosenInlineResult` was replaced and modified to be sealed
|
||||
* `ChosenInlineResult` now extends `FromUser`
|
||||
* Added `Update#sourceUser` method
|
||||
* More types assumed as sent by user types now implements `FromUser` interface
|
||||
* Added `Any#whenFromUser`, `Any#asFromUser` and`Any#requireFromUser` extensions
|
||||
* `MedaGroupUpdate` and its direct extenders `SentMediaGroupUpdate` and `EditMediaGroupUpdate` became
|
||||
`sealed interface`s
|
||||
* New built-in `RequestException` implementator `GetUpdatesConflict` has been added
|
||||
* `Behaviour Builder`:
|
||||
* ❗️ All triggers (`on*` extensions) have been modified to work in parallel by some marker by default (new parameter
|
||||
`markerFactory`, in most cases will work async for different chats)
|
||||
* New extensions `telegramBotWithBehaviour`
|
||||
* All behaviour builder extensions got new parameter `defaultExceptionsHandler`
|
||||
* Class `BehaviourContext` was rewritten as an interface with default realization `DefaultBehaviourContext` and
|
||||
factory `BehaviourContext(TelegramBot, CoroutineScope, FlowsUpdatesFilter)`
|
||||
* Extension `buildBehaviour` (and all related extensions/functions) for opportunity to pass
|
||||
`defaultExceptionsHandler`
|
||||
* Trigger `onContentMessage` and waiter `waitContentMessage` now may include media groups
|
||||
* `API`:
|
||||
* All `reply` and subsequent extensions have been replaced in send package
|
||||
* `Utils`:
|
||||
* With class casts like `as*` and `require*` now you may use `when*` with parameter callback
|
||||
* Methods of `EntitiesBuilder` now will return builder itself, so you may create sequences like
|
||||
`buildEntities { bold("Hello,") + italic(" world") }` directly in `buildEntities` body
|
||||
* New extension `TelegramBot#longPollingFlow` has been added with returning value `Flow` with updates
|
||||
* `Bot API 5.3`:
|
||||
* Add type `BotCommandScope`, its serializer `BotCommandScopeSerializer` and all its children
|
||||
* New request `DeleteMyCommands` and updates in `GetMyCommands` and `SetMyCommands`
|
||||
* Renames according to `And more` of [June 25, 2021](https://core.telegram.org/bots/api-changelog#june-25-2021) update
|
||||
|
||||
## 0.35.0
|
||||
|
||||
**ALL PREVIOUS DEPRECATIONS HAVE BEEN REMOVED**
|
||||
|
@ -5,18 +5,18 @@ kotlin.js.generate.externals=true
|
||||
kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
kotlin_version=1.5.10
|
||||
kotlin_coroutines_version=1.5.0
|
||||
kotlin_serialisation_runtime_version=1.2.1
|
||||
klock_version=2.1.2
|
||||
kotlin_version=1.5.21
|
||||
kotlin_coroutines_version=1.5.1
|
||||
kotlin_serialisation_runtime_version=1.2.2
|
||||
klock_version=2.3.1
|
||||
uuid_version=0.3.0
|
||||
ktor_version=1.6.0
|
||||
ktor_version=1.6.2
|
||||
|
||||
micro_utils_version=0.5.6
|
||||
micro_utils_version=0.5.18
|
||||
|
||||
javax_activation_version=1.1.1
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=0.35.0
|
||||
library_version=0.35.3
|
||||
|
||||
github_release_plugin_version=2.2.12
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
|
@ -9,7 +9,7 @@ moments are describing by official [Telegram Bot API](https://core.telegram.org/
|
||||
|
||||
## Compatibility
|
||||
|
||||
This version compatible with [26th of April 2021 update of TelegramBotAPI (version 5.2)](https://core.telegram.org/bots/api-changelog#april-26-2021).
|
||||
This version compatible with [25th of June 2021 update of TelegramBotAPI (version 5.3)](https://core.telegram.org/bots/api-changelog#june-25-2021).
|
||||
|
||||
## How to implement library?
|
||||
|
||||
|
@ -53,6 +53,7 @@ kotlin {
|
||||
api "dev.inmo:micro_utils.serialization.base64:$micro_utils_version"
|
||||
api "dev.inmo:micro_utils.serialization.encapsulator:$micro_utils_version"
|
||||
api "dev.inmo:micro_utils.serialization.typed_serializer:$micro_utils_version"
|
||||
api "dev.inmo:micro_utils.language_codes:$micro_utils_version"
|
||||
|
||||
api "io.ktor:ktor-client-core:$ktor_version"
|
||||
api "com.github.matfax.klassindex:library:4.+"
|
||||
|
@ -4,12 +4,12 @@ import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.MultilevelTextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForCaption
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForMessage
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.separateForText
|
||||
import dev.inmo.tgbotapi.types.captionLength
|
||||
import dev.inmo.tgbotapi.types.textLength
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
|
||||
const val DirectInvocationOfTextSourceConstructor =
|
||||
"It is strongly not recommended to use constructors directly instead of factory methods"
|
||||
@ -48,7 +48,7 @@ inline operator fun List<TextSource>.plus(text: String) = this + regular(text)
|
||||
)
|
||||
typealias MultilevelTextSource = MultilevelTextSource
|
||||
|
||||
@Deprecated("Replaced", ReplaceWith("makeString()", "dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString"))
|
||||
@Deprecated("Replaced", ReplaceWith("makeString()", "dev.inmo.tgbotapi.utils.extensions.makeString"))
|
||||
fun List<TextSource>.makeString() = makeString()
|
||||
|
||||
@Deprecated(
|
||||
|
@ -0,0 +1,17 @@
|
||||
package dev.inmo.tgbotapi.CommonAbstracts
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
|
||||
interface WithOptionalLanguageCode {
|
||||
val ietfLanguageCode: IetfLanguageCode?
|
||||
|
||||
val languageCode: String?
|
||||
get() = ietfLanguageCode ?.code
|
||||
}
|
||||
|
||||
interface WithLanguageCode : WithOptionalLanguageCode {
|
||||
override val ietfLanguageCode: IetfLanguageCode
|
||||
|
||||
override val languageCode: String
|
||||
get() = ietfLanguageCode.code
|
||||
}
|
@ -25,6 +25,12 @@ fun newRequestException(
|
||||
message,
|
||||
cause
|
||||
)
|
||||
description.contains("Conflict: terminated by other getUpdates request") -> GetUpdatesConflict(
|
||||
response,
|
||||
plainAnswer,
|
||||
message,
|
||||
cause
|
||||
)
|
||||
else -> null
|
||||
}
|
||||
} ?: CommonRequestException(response, plainAnswer, message, cause)
|
||||
@ -61,3 +67,6 @@ class WrongFileIdentifierException(response: Response, plainAnswer: String, mess
|
||||
|
||||
class TooMuchRequestsException(val retryAfter: RetryAfterError, response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
RequestException(response, plainAnswer, message, cause)
|
||||
|
||||
class GetUpdatesConflict(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
RequestException(response, plainAnswer, message, cause)
|
||||
|
@ -2,7 +2,8 @@ package dev.inmo.tgbotapi.requests.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.StorageFile
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -0,0 +1,9 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
|
||||
sealed interface MyCommandsRequest<T : Any> : SimpleRequest<T>, WithOptionalLanguageCode {
|
||||
val scope: BotCommandScope
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class DeleteMyCommands(
|
||||
@SerialName(scopeField)
|
||||
@Serializable(BotCommandScopeSerializer::class)
|
||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : MyCommandsRequest<Boolean> {
|
||||
override fun method(): String = "deleteMyCommands"
|
||||
override val requestSerializer: SerializationStrategy<DeleteMyCommands> = serializer()
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean> = Boolean.serializer()
|
||||
|
||||
constructor(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String?
|
||||
) : this(
|
||||
scope,
|
||||
languageCode ?.let(::IetfLanguageCode)
|
||||
)
|
||||
|
||||
companion object : MyCommandsRequest<Boolean> by DeleteMyCommands()
|
||||
}
|
@ -1,17 +1,36 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.tgbotapi.types.BotCommand
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
|
||||
private val getMyCommandsSerializer = ListSerializer(BotCommand.serializer())
|
||||
|
||||
@Serializable
|
||||
object GetMyCommands : SimpleRequest<List<BotCommand>> {
|
||||
data class GetMyCommands(
|
||||
@SerialName(scopeField)
|
||||
@Serializable(BotCommandScopeSerializer::class)
|
||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : MyCommandsRequest<List<BotCommand>> {
|
||||
override fun method(): String = "getMyCommands"
|
||||
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
|
||||
get() = getMyCommandsSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
constructor(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String?
|
||||
) : this(
|
||||
scope,
|
||||
languageCode ?.let(::IetfLanguageCode)
|
||||
)
|
||||
|
||||
companion object : MyCommandsRequest<List<BotCommand>> by GetMyCommands()
|
||||
}
|
||||
|
@ -1,21 +1,39 @@
|
||||
package dev.inmo.tgbotapi.requests.bot
|
||||
|
||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.commands.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
class SetMyCommands(
|
||||
@SerialName(botCommandsField)
|
||||
val commands: List<BotCommand>
|
||||
) : SimpleRequest<Boolean> {
|
||||
val commands: List<BotCommand>,
|
||||
@SerialName(scopeField)
|
||||
@Serializable(BotCommandScopeSerializer::class)
|
||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||
@SerialName(languageCodeField)
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : MyCommandsRequest<Boolean> {
|
||||
override fun method(): String = "setMyCommands"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
|
||||
constructor(
|
||||
commands: List<BotCommand>,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String?
|
||||
) : this(
|
||||
commands,
|
||||
scope,
|
||||
languageCode ?.let(::IetfLanguageCode)
|
||||
)
|
||||
|
||||
init {
|
||||
if (commands.size !in botCommandsLimit) {
|
||||
error("Bot commands list size able to be in range $botCommandsLimit, but incoming size is ${commands.size}")
|
||||
|
@ -8,13 +8,16 @@ import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class GetChatMembersCount(
|
||||
data class GetChatMemberCount(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<Int> {
|
||||
override fun method(): String = "getChatMembersCount"
|
||||
override fun method(): String = "getChatMemberCount"
|
||||
override val resultDeserializer: DeserializationStrategy<Int>
|
||||
get() = Int.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("GetChatMemberCount", "dev.inmo.tgbotapi.requests.chat.get.GetChatMemberCount"))
|
||||
typealias GetChatMembersCount = GetChatMemberCount
|
@ -7,7 +7,7 @@ import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
|
||||
@Serializable
|
||||
data class KickChatMember(
|
||||
data class BanChatMember(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
@ -17,9 +17,12 @@ data class KickChatMember(
|
||||
@SerialName(revokeMessagesField)
|
||||
val revokeMessages: Boolean? = null
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "kickChatMember"
|
||||
override fun method(): String = "banChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = Boolean.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("BanChatMember", "dev.inmo.tgbotapi.requests.chat.members.BanChatMember"))
|
||||
typealias KickChatMember = BanChatMember
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.edit.media.MediaContentMessageResultDeserializ
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.send.TextContentMessageResultDeserializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.requests.edit.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageReques
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.requests.send.media.base.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
|
@ -1,11 +1,11 @@
|
||||
package dev.inmo.tgbotapi.types.CallbackQuery
|
||||
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.User
|
||||
|
||||
sealed interface CallbackQuery {
|
||||
sealed interface CallbackQuery : FromUser {
|
||||
val id: CallbackQueryIdentifier
|
||||
val user: User
|
||||
val chatInstance: String
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,8 @@ package dev.inmo.tgbotapi.types
|
||||
|
||||
import dev.inmo.micro_utils.common.Warning
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.ChatMember.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -5,7 +5,8 @@ import dev.inmo.tgbotapi.types.User
|
||||
import dev.inmo.tgbotapi.types.statusField
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -82,6 +82,8 @@ val membersLimit = 1 .. 99999
|
||||
|
||||
val suggestedTipAmountsLimit = 1 .. 4
|
||||
|
||||
val inputFieldPlaceholderLimit = 1 .. 64
|
||||
|
||||
const val botActionActualityTime: Seconds = 5
|
||||
|
||||
// Made as lazy for correct work in K/JS
|
||||
@ -234,6 +236,7 @@ const val hideUrlField = "hide_url"
|
||||
|
||||
const val botCommandField = "command"
|
||||
const val botCommandsField = "commands"
|
||||
const val scopeField = "scope"
|
||||
|
||||
const val isMemberField = "is_member"
|
||||
const val canSendMessagesField = "can_send_messages"
|
||||
@ -365,6 +368,8 @@ const val requireShippingAddressField = "need_shipping_address"
|
||||
const val shouldSendPhoneNumberToProviderField = "send_phone_number_to_provider"
|
||||
const val shouldSendEmailToProviderField = "send_email_to_provider"
|
||||
|
||||
const val inputFieldPlaceholderField = "input_field_placeholder"
|
||||
|
||||
const val priceDependOnShipAddressField = "is_flexible"
|
||||
|
||||
const val documentField = "document"
|
||||
|
@ -1,10 +1,13 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class BaseChosenInlineResult(
|
||||
override val resultId: InlineQueryIdentifier,
|
||||
@SerialName(fromField)
|
||||
override val user: User,
|
||||
override val inlineMessageId: InlineMessageIdentifier?,
|
||||
override val query: String
|
||||
|
@ -0,0 +1,10 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.FromUser
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
|
||||
sealed interface ChosenInlineResult : FromUser {
|
||||
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
||||
val inlineMessageId: InlineMessageIdentifier?
|
||||
val query: String
|
||||
}
|
@ -1,11 +1,14 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class LocationChosenInlineResult(
|
||||
override val resultId: InlineQueryIdentifier,
|
||||
@SerialName(fromField)
|
||||
override val user: User,
|
||||
val location: StaticLocation,
|
||||
override val inlineMessageId: InlineMessageIdentifier?,
|
||||
|
@ -1,7 +1,6 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.abstracts.ChosenInlineResult
|
||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,8 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.inlineQueryResultDocumentType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -6,7 +6,8 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -5,7 +5,8 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.inlineQueryResultVoiceType
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.InputMessageContent
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
|
@ -3,7 +3,8 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.serializers
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.InternalSerializationApi
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.CommonAbstracts.types.DisableWebPagePreview
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import kotlinx.serialization.SerialName
|
||||
|
@ -2,7 +2,8 @@ package dev.inmo.tgbotapi.types.InlineQueries
|
||||
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.*
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.InternalSerializationApi
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -1,10 +1,6 @@
|
||||
package dev.inmo.tgbotapi.types.InlineQueries.abstracts
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
|
||||
|
||||
interface ChosenInlineResult {
|
||||
val resultId: InlineQueryIdentifier //chosen temporary, can be changed
|
||||
val user: User
|
||||
val inlineMessageId: InlineMessageIdentifier?
|
||||
val query: String
|
||||
}
|
||||
@Deprecated("Replaced", ReplaceWith("ChosenInlineResult", "dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult"))
|
||||
typealias ChosenInlineResult = ChosenInlineResult
|
||||
|
@ -5,7 +5,8 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import kotlinx.serialization.SerialName
|
||||
|
@ -1,12 +1,12 @@
|
||||
package dev.inmo.tgbotapi.types.InputMedia
|
||||
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.*
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.Performerable
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.makeString
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||
|
@ -3,7 +3,8 @@ package dev.inmo.tgbotapi.types.InputMedia
|
||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
|
@ -4,7 +4,8 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import dev.inmo.tgbotapi.types.files.PhotoSize
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.InputMedia
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.InternalSerializationApi
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -4,7 +4,8 @@ import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import dev.inmo.tgbotapi.requests.abstracts.fileIdToSend
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.*
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
||||
import dev.inmo.tgbotapi.types.ParseMode.parseModeField
|
||||
import kotlinx.serialization.*
|
||||
|
@ -3,7 +3,8 @@ package dev.inmo.tgbotapi.types.InputMedia
|
||||
import dev.inmo.tgbotapi.types.typeField
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.InternalSerializationApi
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -2,6 +2,7 @@ package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.types.captionLength
|
||||
import dev.inmo.tgbotapi.types.textLength
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
const val DirectInvocationOfTextSourceConstructor = "It is strongly not recommended to use constructors directly instead of factory methods"
|
||||
@ -42,7 +43,8 @@ sealed interface MultilevelTextSource : TextSource {
|
||||
}
|
||||
}
|
||||
|
||||
fun List<TextSource>.makeString() = joinToString("") { it.source }
|
||||
@Deprecated("Replaced", ReplaceWith("makeString()", "dev.inmo.tgbotapi.utils.extensions.makeString"))
|
||||
fun TextSourcesList.makeString() = makeString(null)
|
||||
fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List<List<TextSource>> {
|
||||
if (isEmpty()) {
|
||||
return emptyList()
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.MessageEntity.textsources
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||
import dev.inmo.tgbotapi.utils.internal.*
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
@ -7,7 +7,6 @@ import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
import kotlinx.serialization.json.JsonPrimitive
|
||||
|
||||
@Serializable(TelegramDateSerializer::class)
|
||||
data class TelegramDate(
|
||||
|
@ -1,9 +1,11 @@
|
||||
package dev.inmo.tgbotapi.types
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.CommonAbstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.types.chat.abstracts.PrivateChat
|
||||
import dev.inmo.tgbotapi.types.chat.extended.ExtendedPrivateChatImpl
|
||||
import dev.inmo.tgbotapi.utils.*
|
||||
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
@ -23,8 +25,17 @@ data class CommonUser(
|
||||
@SerialName(usernameField)
|
||||
override val username: Username? = null,
|
||||
@SerialName(languageCodeField)
|
||||
val languageCode: String? = null
|
||||
) : User()
|
||||
@Serializable(IetfLanguageCodeSerializer::class)
|
||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
||||
) : User(), WithOptionalLanguageCode {
|
||||
constructor(
|
||||
id: UserId,
|
||||
firstName: String,
|
||||
lastName: String = "",
|
||||
username: Username? = null,
|
||||
languageCode: String
|
||||
) : this(id, firstName, lastName, username, IetfLanguageCode(languageCode))
|
||||
}
|
||||
|
||||
@PreviewFeature
|
||||
typealias ExtendedUser = ExtendedPrivateChatImpl
|
||||
|
@ -1,6 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.actions
|
||||
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
|
@ -2,7 +2,8 @@ package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -1,7 +1,8 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.InternalSerializationApi
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -1,10 +1,14 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderField
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderLimit
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class ReplyForce(
|
||||
val selective: Boolean? = null
|
||||
val selective: Boolean? = null,
|
||||
@SerialName(inputFieldPlaceholderField)
|
||||
val inputFieldPlaceholder: String? = null
|
||||
) : KeyboardMarkup {
|
||||
@SerialName("force_reply")
|
||||
@Required
|
||||
@ -15,6 +19,12 @@ data class ReplyForce(
|
||||
val ReplyForceNonSelective = ReplyForce(false)
|
||||
val ReplyForceDefault = ReplyForce()
|
||||
}
|
||||
|
||||
init {
|
||||
if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) {
|
||||
error("Field $inputFieldPlaceholderField length must be in $inputFieldPlaceholderLimit, but was ${inputFieldPlaceholder.length}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce", "dev.inmo.tgbotapi.types.buttons.ReplyForce"))
|
||||
|
@ -1,5 +1,7 @@
|
||||
package dev.inmo.tgbotapi.types.buttons
|
||||
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderField
|
||||
import dev.inmo.tgbotapi.types.inputFieldPlaceholderLimit
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@ -10,5 +12,13 @@ data class ReplyKeyboardMarkup(
|
||||
val resizeKeyboard: Boolean? = null,
|
||||
@SerialName("one_time_keyboard")
|
||||
val oneTimeKeyboard: Boolean? = null,
|
||||
@SerialName(inputFieldPlaceholderField)
|
||||
val inputFieldPlaceholder: String? = null,
|
||||
val selective: Boolean? = null
|
||||
) : KeyboardMarkup
|
||||
) : KeyboardMarkup {
|
||||
init {
|
||||
if (inputFieldPlaceholder != null && inputFieldPlaceholder.length !in inputFieldPlaceholderLimit) {
|
||||
error("Field $inputFieldPlaceholderField length must be in $inputFieldPlaceholderLimit, but was ${inputFieldPlaceholder.length}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,124 @@
|
||||
package dev.inmo.tgbotapi.types.commands
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
@Serializable
|
||||
private class SurrogateBotCommandScope(
|
||||
@SerialName(typeField)
|
||||
@Required
|
||||
val type: String,
|
||||
@SerialName(chatIdField)
|
||||
val chatId: ChatIdentifier? = null,
|
||||
@SerialName(userIdField)
|
||||
val userId: UserId? = null
|
||||
) {
|
||||
fun asBotCommandScope() = when (type) {
|
||||
BotCommandScopeDefault.type -> BotCommandScopeDefault
|
||||
BotCommandScopeAllPrivateChats.type -> BotCommandScopeAllPrivateChats
|
||||
BotCommandScopeAllGroupChats.type -> BotCommandScopeAllGroupChats
|
||||
BotCommandScopeAllChatAdministrators.type -> BotCommandScopeAllChatAdministrators
|
||||
BotCommandScopeChatAdministrators.type -> BotCommandScopeChatAdministrators(
|
||||
chatId ?: error("chat_administrators type must have $chatIdField field, but have no")
|
||||
)
|
||||
BotCommandScopeChatMember.type -> BotCommandScopeChatMember(
|
||||
chatId ?: error("chat_administrators type must have $chatIdField field, but have no"),
|
||||
userId ?: error("chat_administrators type must have $userIdField field, but have no")
|
||||
)
|
||||
else -> UnknownBotCommandScope(type)
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun from(scope: BotCommandScope) = when (scope) {
|
||||
is UnknownBotCommandScope,
|
||||
BotCommandScopeDefault,
|
||||
BotCommandScopeAllPrivateChats,
|
||||
BotCommandScopeAllGroupChats,
|
||||
BotCommandScopeAllChatAdministrators -> SurrogateBotCommandScope(scope.type)
|
||||
is BotCommandScopeChatAdministrators -> SurrogateBotCommandScope(scope.type, scope.chatId)
|
||||
is BotCommandScopeChatMember -> SurrogateBotCommandScope(scope.type, scope.chatId, scope.userId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable(BotCommandScopeSerializer::class)
|
||||
sealed interface BotCommandScope {
|
||||
val type: String
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class UnknownBotCommandScope internal constructor(
|
||||
override val type: String
|
||||
) : BotCommandScope
|
||||
|
||||
@Serializable
|
||||
object BotCommandScopeDefault : BotCommandScope {
|
||||
@Required
|
||||
override val type: String = "default"
|
||||
}
|
||||
|
||||
@Serializable
|
||||
object BotCommandScopeAllPrivateChats : BotCommandScope {
|
||||
@Required
|
||||
override val type: String = "all_private_chats"
|
||||
}
|
||||
|
||||
@Serializable
|
||||
object BotCommandScopeAllGroupChats : BotCommandScope {
|
||||
@Required
|
||||
override val type: String = "all_group_chats"
|
||||
}
|
||||
|
||||
@Serializable
|
||||
object BotCommandScopeAllChatAdministrators : BotCommandScope {
|
||||
@Required
|
||||
override val type: String = "all_chat_administrators"
|
||||
}
|
||||
|
||||
|
||||
sealed interface ChatBotCommandScope : BotCommandScope {
|
||||
val chatId: ChatIdentifier
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class BotCommandScopeChatAdministrators(
|
||||
override val chatId: ChatIdentifier
|
||||
) : ChatBotCommandScope {
|
||||
@Required
|
||||
override val type: String = BotCommandScopeChatAdministrators.type
|
||||
companion object {
|
||||
const val type = "chat_administrators"
|
||||
}
|
||||
}
|
||||
|
||||
@Serializable
|
||||
data class BotCommandScopeChatMember(
|
||||
override val chatId: ChatIdentifier,
|
||||
val userId: UserId
|
||||
) : ChatBotCommandScope {
|
||||
@Required
|
||||
override val type: String = BotCommandScopeChatMember.type
|
||||
companion object {
|
||||
const val type = "chat_member"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object BotCommandScopeSerializer : KSerializer<BotCommandScope> {
|
||||
|
||||
override val descriptor: SerialDescriptor = SurrogateBotCommandScope.serializer().descriptor
|
||||
|
||||
override fun deserialize(
|
||||
decoder: Decoder
|
||||
): BotCommandScope = SurrogateBotCommandScope.serializer().deserialize(decoder).asBotCommandScope()
|
||||
|
||||
override fun serialize(encoder: Encoder, value: BotCommandScope) {
|
||||
SurrogateBotCommandScope.serializer().serialize(
|
||||
encoder, SurrogateBotCommandScope.from(value)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
@ -2,7 +2,8 @@ package dev.inmo.tgbotapi.types.dice
|
||||
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
@ -5,7 +5,9 @@ import dev.inmo.tgbotapi.CommonAbstracts.Titled
|
||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
||||
import dev.inmo.tgbotapi.types.files.AnimationFile
|
||||
import dev.inmo.tgbotapi.types.files.Photo
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class Game(
|
||||
override val title: String,
|
||||
val description: String,
|
||||
|
@ -5,4 +5,4 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
|
||||
|
||||
data class LeftChatMember(
|
||||
val user: User
|
||||
): CommonEvent
|
||||
) : CommonEvent
|
||||
|
@ -6,7 +6,9 @@ import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class ContactContent(
|
||||
val contact: Contact
|
||||
) : MessageContent {
|
||||
@ -19,4 +21,4 @@ data class ContactContent(
|
||||
): Request<ContentMessage<ContactContent>> = SendContact(
|
||||
chatId, contact, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.dice.Dice
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class DiceContent(
|
||||
val dice: Dice
|
||||
) : MessageContent {
|
||||
|
@ -8,7 +8,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.games.Game
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class GameContent(
|
||||
val game: Game
|
||||
) : MessageContent {
|
||||
@ -26,4 +28,4 @@ data class GameContent(
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.polls.Poll
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class PollContent(
|
||||
val poll: Poll
|
||||
) : MessageContent {
|
||||
|
@ -9,7 +9,9 @@ import dev.inmo.tgbotapi.types.MessageIdentifier
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class TextContent(
|
||||
override val text: String,
|
||||
override val textSources: TextSourcesList = emptyList(),
|
||||
|
@ -8,7 +8,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.venue.Venue
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class VenueContent(
|
||||
val venue: Venue
|
||||
) : MessageContent {
|
||||
@ -21,4 +23,4 @@ data class VenueContent(
|
||||
): Request<ContentMessage<VenueContent>> = SendVenue(
|
||||
chatId, venue, disableNotification, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,9 @@ import dev.inmo.tgbotapi.types.files.AnimationFile
|
||||
import dev.inmo.tgbotapi.types.files.DocumentFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class AnimationContent(
|
||||
override val media: AnimationFile,
|
||||
val includedDocument: DocumentFile?,
|
||||
|
@ -11,7 +11,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.AudioFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.AudioMediaGroupContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class AudioContent(
|
||||
override val media: AudioFile,
|
||||
override val text: String? = null,
|
||||
|
@ -14,7 +14,9 @@ import dev.inmo.tgbotapi.types.files.asDocumentFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.DocumentMediaGroupContent
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class DocumentContent(
|
||||
override val media: DocumentFile,
|
||||
override val text: String? = null,
|
||||
|
@ -12,7 +12,9 @@ import dev.inmo.tgbotapi.types.files.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaCollectionContent
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class PhotoContent(
|
||||
override val mediaCollection: Photo,
|
||||
override val text: String? = null,
|
||||
|
@ -9,7 +9,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.Sticker
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class StickerContent(
|
||||
override val media: Sticker
|
||||
) : MediaContent {
|
||||
|
@ -11,7 +11,9 @@ import dev.inmo.tgbotapi.types.files.VideoFile
|
||||
import dev.inmo.tgbotapi.types.files.toInputMediaVideo
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.VisualMediaGroupContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class VideoContent(
|
||||
override val media: VideoFile,
|
||||
override val text: String? = null,
|
||||
|
@ -9,7 +9,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.VideoNoteFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class VideoNoteContent(
|
||||
override val media: VideoNoteFile
|
||||
) : MediaContent {
|
||||
|
@ -11,7 +11,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.files.VoiceFile
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class VoiceContent(
|
||||
override val media: VoiceFile,
|
||||
override val text: String? = null,
|
||||
|
@ -7,7 +7,9 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
||||
import dev.inmo.tgbotapi.types.payments.Invoice
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class InvoiceContent(
|
||||
val invoice: Invoice
|
||||
) : MessageContent {
|
||||
|
@ -9,7 +9,6 @@ import dev.inmo.tgbotapi.types.typeField
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializer
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user