mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-12-27 08:29:19 +00:00
Compare commits
38 Commits
d70c7fdbdf
...
10.1.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 63633e8891 | |||
| 61cdfa264e | |||
| 6262b0581a | |||
| 8694b31066 | |||
| 5a541271b8 | |||
|
|
9b14e9079b | ||
| fd26d14380 | |||
| 3ebaef0789 | |||
| 51bb0a021f | |||
| b7c1692efa | |||
| bce5fb658c | |||
| b9bc40187f | |||
| 3da4ee4808 | |||
| 6571e8f592 | |||
| 5c13047a0b | |||
| 4908bb2cfe | |||
| a01ca43837 | |||
| a9a01e3154 | |||
| 468c54a30f | |||
| 9177e01910 | |||
| 417f72af4a | |||
| df6d70b20d | |||
| 0b12df14db | |||
| 1590e1eef2 | |||
| 6896bc0772 | |||
| ce1abb0ae2 | |||
| ac63d52b14 | |||
| e902f85b36 | |||
| 225fedde3a | |||
| 66e31e5d0c | |||
| 852065ad38 | |||
| d88fc2c9c0 | |||
| 4d92588390 | |||
| 89524290c5 | |||
| 86c86dfb8a | |||
| bdae774c62 | |||
| 76a2cfd1a0 | |||
|
|
edca5494d4 |
2
.github/workflows/packages_publishing.yml
vendored
2
.github/workflows/packages_publishing.yml
vendored
@@ -20,6 +20,8 @@ jobs:
|
|||||||
run: ./gradlew ksp
|
run: ./gradlew ksp
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
- name: API compatibility check
|
||||||
|
run: ./gradlew apiCheck
|
||||||
- name: Publish to Gitea
|
- name: Publish to Gitea
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
||||||
|
|||||||
45
CHANGELOG.md
45
CHANGELOG.md
@@ -1,11 +1,56 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 10.1.2
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `1.9.22` -> `1.9.23`
|
||||||
|
* `Korlibs`: `5.3.2` -> `5.4.0`
|
||||||
|
* `Ktor`: `2.3.8` -> `2.3.9`
|
||||||
|
* `MicroUtils`: `0.20.37` -> `0.20.39`
|
||||||
|
* `KSLog`: `1.3.2` -> `1.3.3`
|
||||||
|
|
||||||
|
## 10.1.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Serialization`: `1.6.2` -> `1.6.3`
|
||||||
|
* `MicroUtils`: `0.20.34` -> `0.20.37`
|
||||||
|
* `Korlibs`: `5.3.1` -> `5.3.2`
|
||||||
|
|
||||||
|
## 10.1.0
|
||||||
|
|
||||||
|
**Add support of [Telegram Bots API 7.1](https://core.telegram.org/bots/api-changelog#february-16-2024)**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Coroutines`: `1.7.3` -> `1.8.0`
|
||||||
|
* `MicroUtils`: `0.20.32` -> `0.20.34`
|
||||||
|
|
||||||
|
## 10.0.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Ktor`: `2.3.7` -> `2.3.8`
|
||||||
|
* `MicroUtils`: `0.20.26` -> `0.20.32`
|
||||||
|
* `Korlibs`: `5.3.0` -> `5.3.1`
|
||||||
|
* `KSLog`: `1.3.1` -> `1.3.2`
|
||||||
|
|
||||||
## 10.0.0
|
## 10.0.0
|
||||||
|
|
||||||
|
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**
|
||||||
|
|
||||||
**IN THIS UPDATE KLOCK DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-time` UP TO 5.3.0 VERSION**
|
**IN THIS UPDATE KLOCK DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-time` UP TO 5.3.0 VERSION**
|
||||||
|
|
||||||
**IN THIS UPDATE KRYPTO DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-crypto` UP TO 5.3.0 VERSION**
|
**IN THIS UPDATE KRYPTO DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-crypto` UP TO 5.3.0 VERSION**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.20.23` -> `0.20.26`
|
||||||
|
* `Korlibs`: `4.0.10` -> `5.3.0`
|
||||||
|
* `Core`:
|
||||||
|
* `Message` now inherited by two variants: `AccessibleMessage` and `InaccessibleMessage`
|
||||||
|
* `Common`:
|
||||||
|
* In most places `disableWebPagePreview` has been replaced by new `LinkPreviewOptions`
|
||||||
|
* In most places arguments `replyToMessageId` and `allowSendingWithoutReply` has been replaced with
|
||||||
|
`ReplyParameters`
|
||||||
|
* In `reply` extension two parameters have been added: `replyInChatId` and `replyInThreadId`
|
||||||
|
|
||||||
## 9.4.3
|
## 9.4.3
|
||||||
|
|
||||||
**IetfLanguageCode has been renamed to IetfLang in MicroUtils**
|
**IetfLanguageCode has been renamed to IetfLang in MicroUtils**
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#september-22-2023)
|
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#february-16-2024)
|
||||||
|
|
||||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||||
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||||
@@ -118,5 +118,5 @@ suspend fun main() {
|
|||||||
### More examples
|
### More examples
|
||||||
|
|
||||||
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
||||||
always welcome in our [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and
|
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
|
||||||
[chat](https://t.me/InMoTelegramBotAPIChat).
|
[chat](https://t.me/InMoTelegramBotAPIChat).
|
||||||
|
|||||||
13
build.gradle
13
build.gradle
@@ -17,6 +17,7 @@ buildscript {
|
|||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.dokka)
|
alias(libs.plugins.kotlin.dokka)
|
||||||
alias(libs.plugins.versions)
|
alias(libs.plugins.versions)
|
||||||
|
alias(libs.plugins.validator)
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
||||||
@@ -54,13 +55,13 @@ if (new File(projectDir, "secret.gradle").exists()) {
|
|||||||
githubRelease {
|
githubRelease {
|
||||||
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
||||||
|
|
||||||
owner "InsanusMokrassar"
|
owner = "InsanusMokrassar"
|
||||||
repo "TelegramBotAPI"
|
repo = "TelegramBotAPI"
|
||||||
|
|
||||||
tagName "v$library_version"
|
tagName = "v$library_version"
|
||||||
releaseName "$library_version"
|
releaseName = "$library_version"
|
||||||
targetCommitish "$library_version"
|
targetCommitish = "$library_version"
|
||||||
|
|
||||||
body getCurrentVersionChangelog()
|
body = getCurrentVersionChangelog()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=10.0.0
|
library_version=10.1.2
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "1.9.22"
|
kotlin = "1.9.23"
|
||||||
kotlin-serialization = "1.6.2"
|
kotlin-serialization = "1.6.3"
|
||||||
kotlin-coroutines = "1.7.3"
|
kotlin-coroutines = "1.8.0"
|
||||||
|
|
||||||
javax-activation = "1.1.1"
|
javax-activation = "1.1.1"
|
||||||
|
|
||||||
korlibs = "5.3.0"
|
korlibs = "5.4.0"
|
||||||
uuid = "0.8.2"
|
uuid = "0.8.2"
|
||||||
ktor = "2.3.7"
|
ktor = "2.3.9"
|
||||||
|
|
||||||
ksp = "1.9.22-1.0.16"
|
ksp = "1.9.23-1.0.19"
|
||||||
kotlin-poet = "1.15.3"
|
kotlin-poet = "1.16.0"
|
||||||
|
|
||||||
microutils = "0.20.25"
|
microutils = "0.20.39"
|
||||||
kslog = "1.3.1"
|
kslog = "1.3.3"
|
||||||
|
|
||||||
versions = "0.50.0"
|
versions = "0.51.0"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
github-release-plugin = "2.5.2"
|
||||||
dokka = "1.9.10"
|
dokka = "1.9.20"
|
||||||
|
|
||||||
|
validator = "0.14.0"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
@@ -78,3 +80,4 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref
|
|||||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||||
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
||||||
|
validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "validator" }
|
||||||
|
|||||||
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
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
|||||||
2170
tgbotapi.api/api/tgbotapi.api.api
Normal file
2170
tgbotapi.api/api/tgbotapi.api.api
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1379
tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api
Normal file
1379
tgbotapi.behaviour_builder/api/tgbotapi.behaviour_builder.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -214,3 +214,8 @@ suspend fun BehaviourContext.waitChatShared(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEvents<ChatShared>(initRequest, errorFactory)
|
) = waitEvents<ChatShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostAdded(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<ChatBoostAdded>(initRequest, errorFactory)
|
||||||
|
|||||||
@@ -208,3 +208,8 @@ suspend fun BehaviourContext.waitChatSharedEventsMessages(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEventsMessages<ChatShared>(initRequest, errorFactory)
|
) = waitEventsMessages<ChatShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostAddedEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<ChatBoostAdded>(initRequest, errorFactory)
|
||||||
|
|||||||
@@ -823,3 +823,24 @@ suspend fun <BC : BehaviourContext> BC.onChatShared(
|
|||||||
markerFactory: MarkerFactory<in ChatEventMessage<ChatShared>, Any> = ByChatMessageMarkerFactory,
|
markerFactory: MarkerFactory<in ChatEventMessage<ChatShared>, Any> = ByChatMessageMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<ChatShared>>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<ChatShared>>
|
||||||
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param markerFactory Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatBoostAdded(
|
||||||
|
initialFilter: SimpleFilter<ChatEventMessage<ChatBoostAdded>>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ChatBoostAdded>, Update>? = MessageFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in ChatEventMessage<ChatBoostAdded>, Any> = ByChatMessageMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ChatBoostAdded>>
|
||||||
|
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|||||||
23802
tgbotapi.core/api/tgbotapi.core.api
Normal file
23802
tgbotapi.core/api/tgbotapi.core.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
|||||||
import dev.inmo.tgbotapi.requests.GetUpdatesRequest
|
import dev.inmo.tgbotapi.requests.GetUpdatesRequest
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.types.Response
|
import dev.inmo.tgbotapi.types.Response
|
||||||
|
import dev.inmo.tgbotapi.types.message.textsources.pre
|
||||||
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
|
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
@@ -16,6 +17,7 @@ import io.ktor.client.plugins.timeout
|
|||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import io.ktor.client.statement.bodyAsText
|
import io.ktor.client.statement.bodyAsText
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
|
import io.ktor.http.content.*
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
@@ -33,7 +35,14 @@ abstract class AbstractRequestCallFactory(
|
|||||||
jsonFormatter: Json
|
jsonFormatter: Json
|
||||||
): T? {
|
): T? {
|
||||||
val preparedBody = prepareCallBody(client, urlsKeeper, request) ?: return null
|
val preparedBody = prepareCallBody(client, urlsKeeper, request) ?: return null
|
||||||
logger.v { "Prepared body for $request: $preparedBody" }
|
logger.v {
|
||||||
|
val bodyValue = if (preparedBody is TextContent) {
|
||||||
|
preparedBody.text
|
||||||
|
} else {
|
||||||
|
preparedBody.toString()
|
||||||
|
}
|
||||||
|
"Prepared body for $request: $bodyValue"
|
||||||
|
}
|
||||||
|
|
||||||
client.post {
|
client.post {
|
||||||
url(
|
url(
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ value class CustomEmojiId(
|
|||||||
val appLink
|
val appLink
|
||||||
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
|
get() = "${internalTgAppLinksBeginning}emoji?id=$this"
|
||||||
}
|
}
|
||||||
|
@Serializable
|
||||||
|
@JvmInline
|
||||||
|
value class StoryId(
|
||||||
|
val long: Long
|
||||||
|
)
|
||||||
|
|
||||||
typealias Seconds = Int
|
typealias Seconds = Int
|
||||||
typealias MilliSeconds = Long
|
typealias MilliSeconds = Long
|
||||||
@@ -246,6 +251,8 @@ const val profileAccentColorIdField = "profile_accent_color_id"
|
|||||||
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
|
const val backgroundCustomEmojiIdField = "background_custom_emoji_id"
|
||||||
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
|
const val profileBackgroundCustomEmojiIdField = "profile_background_custom_emoji_id"
|
||||||
const val hasVisibleHistoryField = "has_visible_history"
|
const val hasVisibleHistoryField = "has_visible_history"
|
||||||
|
const val unrestrictBoostsCountField = "unrestrict_boost_count"
|
||||||
|
const val customEmojiStickerSetNameField = "custom_emoji_sticker_set_name"
|
||||||
const val iconCustomEmojiIdField = "icon_custom_emoji_id"
|
const val iconCustomEmojiIdField = "icon_custom_emoji_id"
|
||||||
const val canJoinGroupsField = "can_join_groups"
|
const val canJoinGroupsField = "can_join_groups"
|
||||||
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
const val canReadAllGroupMessagesField = "can_read_all_group_messages"
|
||||||
@@ -656,6 +663,7 @@ const val menuButtonField = "menu_button"
|
|||||||
|
|
||||||
const val boostIdField = "boost_id"
|
const val boostIdField = "boost_id"
|
||||||
const val boostField = "boost"
|
const val boostField = "boost"
|
||||||
|
const val boostCountField = "boost_count"
|
||||||
const val addDateField = "add_date"
|
const val addDateField = "add_date"
|
||||||
const val expirationDateField = "expiration_date"
|
const val expirationDateField = "expiration_date"
|
||||||
const val removeDateField = "remove_date"
|
const val removeDateField = "remove_date"
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.types
|
package dev.inmo.tgbotapi.types
|
||||||
|
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.Required
|
|
||||||
import kotlinx.serialization.SerialName
|
|
||||||
import kotlinx.serialization.Serializable
|
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.encoding.Encoder
|
import kotlinx.serialization.encoding.Encoder
|
||||||
@@ -16,9 +13,10 @@ sealed interface LinkPreviewOptions {
|
|||||||
val preferLargeMedia: Boolean
|
val preferLargeMedia: Boolean
|
||||||
val showAboveText: Boolean
|
val showAboveText: Boolean
|
||||||
|
|
||||||
@Serializable
|
@Serializable(LinkPreviewOptions.Companion::class)
|
||||||
data object Disabled : LinkPreviewOptions {
|
data object Disabled : LinkPreviewOptions {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(isDisabledField)
|
@SerialName(isDisabledField)
|
||||||
override val isDisabled: Boolean = true
|
override val isDisabled: Boolean = true
|
||||||
override val url: String?
|
override val url: String?
|
||||||
@@ -31,7 +29,7 @@ sealed interface LinkPreviewOptions {
|
|||||||
get() = false
|
get() = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable(LinkPreviewOptions.Companion::class)
|
||||||
data class Large(
|
data class Large(
|
||||||
@SerialName(urlField)
|
@SerialName(urlField)
|
||||||
override val url: String?,
|
override val url: String?,
|
||||||
@@ -39,16 +37,18 @@ sealed interface LinkPreviewOptions {
|
|||||||
override val showAboveText: Boolean
|
override val showAboveText: Boolean
|
||||||
) : LinkPreviewOptions {
|
) : LinkPreviewOptions {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(isDisabledField)
|
@SerialName(isDisabledField)
|
||||||
override val isDisabled: Boolean = false
|
override val isDisabled: Boolean = false
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(preferLargeMediaField)
|
@SerialName(preferLargeMediaField)
|
||||||
override val preferLargeMedia: Boolean = true
|
override val preferLargeMedia: Boolean = true
|
||||||
override val preferSmallMedia: Boolean
|
override val preferSmallMedia: Boolean
|
||||||
get() = false
|
get() = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable(LinkPreviewOptions.Companion::class)
|
||||||
data class Small(
|
data class Small(
|
||||||
@SerialName(urlField)
|
@SerialName(urlField)
|
||||||
override val url: String?,
|
override val url: String?,
|
||||||
@@ -56,16 +56,18 @@ sealed interface LinkPreviewOptions {
|
|||||||
override val showAboveText: Boolean
|
override val showAboveText: Boolean
|
||||||
) : LinkPreviewOptions {
|
) : LinkPreviewOptions {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(isDisabledField)
|
@SerialName(isDisabledField)
|
||||||
override val isDisabled: Boolean = false
|
override val isDisabled: Boolean = false
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(preferSmallMediaField)
|
@SerialName(preferSmallMediaField)
|
||||||
override val preferSmallMedia: Boolean = true
|
override val preferSmallMedia: Boolean = true
|
||||||
override val preferLargeMedia: Boolean
|
override val preferLargeMedia: Boolean
|
||||||
get() = false
|
get() = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializable
|
@Serializable(LinkPreviewOptions.Companion::class)
|
||||||
data class Default(
|
data class Default(
|
||||||
@SerialName(urlField)
|
@SerialName(urlField)
|
||||||
override val url: String?,
|
override val url: String?,
|
||||||
@@ -73,6 +75,7 @@ sealed interface LinkPreviewOptions {
|
|||||||
override val showAboveText: Boolean
|
override val showAboveText: Boolean
|
||||||
) : LinkPreviewOptions {
|
) : LinkPreviewOptions {
|
||||||
@Required
|
@Required
|
||||||
|
@EncodeDefault
|
||||||
@SerialName(isDisabledField)
|
@SerialName(isDisabledField)
|
||||||
override val isDisabled: Boolean = false
|
override val isDisabled: Boolean = false
|
||||||
override val preferSmallMedia: Boolean
|
override val preferSmallMedia: Boolean
|
||||||
@@ -93,9 +96,7 @@ sealed interface LinkPreviewOptions {
|
|||||||
val preferLargeMedia: Boolean = false,
|
val preferLargeMedia: Boolean = false,
|
||||||
@SerialName(showAboveTextField)
|
@SerialName(showAboveTextField)
|
||||||
val showAboveText: Boolean = false,
|
val showAboveText: Boolean = false,
|
||||||
) {
|
)
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object : KSerializer<LinkPreviewOptions> {
|
companion object : KSerializer<LinkPreviewOptions> {
|
||||||
override val descriptor: SerialDescriptor
|
override val descriptor: SerialDescriptor
|
||||||
@@ -113,13 +114,16 @@ sealed interface LinkPreviewOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun serialize(encoder: Encoder, value: LinkPreviewOptions) {
|
override fun serialize(encoder: Encoder, value: LinkPreviewOptions) {
|
||||||
when (value) {
|
Surrogate.serializer().serialize(
|
||||||
is Disabled -> Disabled.serializer().serialize(encoder, value)
|
encoder,
|
||||||
is Large -> Large.serializer().serialize(encoder, value)
|
Surrogate(
|
||||||
is Default -> Default.serializer().serialize(encoder, value)
|
isDisabled = value.isDisabled,
|
||||||
is Small -> Small.serializer().serialize(encoder, value)
|
url = value.url,
|
||||||
}
|
preferSmallMedia = value.preferSmallMedia,
|
||||||
|
preferLargeMedia = value.preferLargeMedia,
|
||||||
|
showAboveText = value.showAboveText
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,6 @@ import dev.inmo.tgbotapi.types.giveaway.GiveawayPublicResults
|
|||||||
import dev.inmo.tgbotapi.types.giveaway.Giveaway
|
import dev.inmo.tgbotapi.types.giveaway.Giveaway
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
import dev.inmo.tgbotapi.types.message.MessageOrigin
|
import dev.inmo.tgbotapi.types.message.MessageOrigin
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.payments.Invoice
|
import dev.inmo.tgbotapi.types.payments.Invoice
|
||||||
import dev.inmo.tgbotapi.types.polls.Poll
|
import dev.inmo.tgbotapi.types.polls.Poll
|
||||||
@@ -28,12 +27,20 @@ sealed interface ReplyInfo {
|
|||||||
val messageMeta: Message.MetaInfo?
|
val messageMeta: Message.MetaInfo?
|
||||||
|
|
||||||
data class Internal(
|
data class Internal(
|
||||||
val message: AccessibleMessage
|
val message: Message
|
||||||
): ReplyInfo {
|
): ReplyInfo {
|
||||||
override val messageMeta: Message.MetaInfo
|
override val messageMeta: Message.MetaInfo
|
||||||
get() = message.metaInfo
|
get() = message.metaInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ToStory(
|
||||||
|
val story: Story
|
||||||
|
): ReplyInfo {
|
||||||
|
override val messageMeta: Message.MetaInfo?
|
||||||
|
get() = null
|
||||||
|
}
|
||||||
|
|
||||||
@Serializable(External.Companion::class)
|
@Serializable(External.Companion::class)
|
||||||
sealed interface External : ReplyInfo {
|
sealed interface External : ReplyInfo {
|
||||||
val origin: MessageOrigin
|
val origin: MessageOrigin
|
||||||
|
|||||||
@@ -17,12 +17,15 @@ import kotlinx.serialization.encoding.Encoder
|
|||||||
sealed interface KeyboardButtonRequestUsers {
|
sealed interface KeyboardButtonRequestUsers {
|
||||||
val requestId: RequestId
|
val requestId: RequestId
|
||||||
val isBot: Boolean?
|
val isBot: Boolean?
|
||||||
|
val isPremium: Boolean?
|
||||||
val maxCount: Int
|
val maxCount: Int
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Any(
|
data class Any(
|
||||||
@SerialName(requestIdField)
|
@SerialName(requestIdField)
|
||||||
override val requestId: RequestId,
|
override val requestId: RequestId,
|
||||||
|
@SerialName(userIsPremiumField)
|
||||||
|
override val isPremium: Boolean? = null,
|
||||||
@SerialName(maxQuantityField)
|
@SerialName(maxQuantityField)
|
||||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
) : KeyboardButtonRequestUsers {
|
) : KeyboardButtonRequestUsers {
|
||||||
@@ -36,7 +39,7 @@ sealed interface KeyboardButtonRequestUsers {
|
|||||||
@SerialName(requestIdField)
|
@SerialName(requestIdField)
|
||||||
override val requestId: RequestId,
|
override val requestId: RequestId,
|
||||||
@SerialName(userIsPremiumField)
|
@SerialName(userIsPremiumField)
|
||||||
val isPremium: Boolean? = null,
|
override val isPremium: Boolean? = null,
|
||||||
@SerialName(maxQuantityField)
|
@SerialName(maxQuantityField)
|
||||||
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
override val maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
) : KeyboardButtonRequestUsers {
|
) : KeyboardButtonRequestUsers {
|
||||||
@@ -55,6 +58,8 @@ sealed interface KeyboardButtonRequestUsers {
|
|||||||
@SerialName(userIsBotField)
|
@SerialName(userIsBotField)
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
override val isBot: Boolean = true
|
override val isBot: Boolean = true
|
||||||
|
override val isPremium: Boolean?
|
||||||
|
get() = null
|
||||||
}
|
}
|
||||||
|
|
||||||
@Serializer(KeyboardButtonRequestUsers::class)
|
@Serializer(KeyboardButtonRequestUsers::class)
|
||||||
@@ -80,7 +85,7 @@ sealed interface KeyboardButtonRequestUsers {
|
|||||||
return when (surrogate.userIsBot) {
|
return when (surrogate.userIsBot) {
|
||||||
true -> Bot(surrogate.requestId, surrogate.maxCount)
|
true -> Bot(surrogate.requestId, surrogate.maxCount)
|
||||||
false -> Common(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
|
false -> Common(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
|
||||||
null -> Any(surrogate.requestId, surrogate.maxCount)
|
null -> Any(surrogate.requestId, surrogate.userIsPremium, surrogate.maxCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,10 @@ package dev.inmo.tgbotapi.types.buttons.reply
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.buttons.*
|
import dev.inmo.tgbotapi.types.buttons.*
|
||||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||||
|
import dev.inmo.tgbotapi.types.keyboardButtonRequestUserLimit
|
||||||
import dev.inmo.tgbotapi.types.request.RequestId
|
import dev.inmo.tgbotapi.types.request.RequestId
|
||||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||||
|
import kotlin.math.max
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -55,7 +57,7 @@ inline fun webAppReplyButton(
|
|||||||
/**
|
/**
|
||||||
* Creates [RequestUserKeyboardButton]
|
* Creates [RequestUserKeyboardButton]
|
||||||
*/
|
*/
|
||||||
inline fun requestUserReplyButton(
|
inline fun requestUsersReplyButton(
|
||||||
text: String,
|
text: String,
|
||||||
requestUser: KeyboardButtonRequestUsers
|
requestUser: KeyboardButtonRequestUsers
|
||||||
) = RequestUserKeyboardButton(
|
) = RequestUserKeyboardButton(
|
||||||
@@ -63,15 +65,51 @@ inline fun requestUserReplyButton(
|
|||||||
requestUser
|
requestUser
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [RequestUserKeyboardButton]
|
||||||
|
*/
|
||||||
|
@Deprecated("Renamed", ReplaceWith("requestUsersReplyButton(text, requestUser)", "dev.inmo.tgbotapi.types.buttons.reply.requestUsersReplyButton"))
|
||||||
|
inline fun requestUserReplyButton(
|
||||||
|
text: String,
|
||||||
|
requestUser: KeyboardButtonRequestUsers
|
||||||
|
) = requestUsersReplyButton(text, requestUser)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot]
|
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot]
|
||||||
*/
|
*/
|
||||||
|
inline fun requestBotsReplyButton(
|
||||||
|
text: String,
|
||||||
|
requestId: RequestId,
|
||||||
|
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
|
) = requestUsersReplyButton(
|
||||||
|
text,
|
||||||
|
KeyboardButtonRequestUsers.Bot(requestId, maxCount)
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot]
|
||||||
|
*/
|
||||||
|
@Deprecated("Renamed", ReplaceWith("requestBotsReplyButton(text, requestId)", "dev.inmo.tgbotapi.types.buttons.reply.requestBotsReplyButton"))
|
||||||
inline fun requestBotReplyButton(
|
inline fun requestBotReplyButton(
|
||||||
text: String,
|
text: String,
|
||||||
requestId: RequestId
|
requestId: RequestId,
|
||||||
) = requestUserReplyButton(
|
) = requestBotsReplyButton(
|
||||||
text,
|
text,
|
||||||
KeyboardButtonRequestUsers.Bot(requestId)
|
requestId,
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Common]
|
||||||
|
*/
|
||||||
|
inline fun requestUsersReplyButton(
|
||||||
|
text: String,
|
||||||
|
requestId: RequestId,
|
||||||
|
premiumUser: Boolean? = null,
|
||||||
|
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
|
) = requestUsersReplyButton(
|
||||||
|
text,
|
||||||
|
KeyboardButtonRequestUsers.Common(requestId, premiumUser, maxCount)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,10 +118,26 @@ inline fun requestBotReplyButton(
|
|||||||
inline fun requestUserReplyButton(
|
inline fun requestUserReplyButton(
|
||||||
text: String,
|
text: String,
|
||||||
requestId: RequestId,
|
requestId: RequestId,
|
||||||
premiumUser: Boolean? = null
|
premiumUser: Boolean? = null,
|
||||||
) = requestUserReplyButton(
|
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
|
) = requestUsersReplyButton(
|
||||||
text,
|
text,
|
||||||
KeyboardButtonRequestUsers.Common(requestId, premiumUser)
|
requestId,
|
||||||
|
premiumUser,
|
||||||
|
maxCount
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Any]
|
||||||
|
*/
|
||||||
|
inline fun requestUsersOrBotsReplyButton(
|
||||||
|
text: String,
|
||||||
|
requestId: RequestId,
|
||||||
|
premiumUser: Boolean? = null,
|
||||||
|
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
|
) = requestUsersReplyButton(
|
||||||
|
text,
|
||||||
|
KeyboardButtonRequestUsers.Any(requestId, premiumUser, maxCount)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,23 +17,41 @@ private val formatter
|
|||||||
sealed class ChatType {
|
sealed class ChatType {
|
||||||
abstract val stringified: String
|
abstract val stringified: String
|
||||||
@Serializable(ChatTypeSerializer::class)
|
@Serializable(ChatTypeSerializer::class)
|
||||||
object PrivateChatType : ChatType() { override val stringified = "private" }
|
object Sender : ChatType() { override val stringified = "sender" }
|
||||||
@Serializable(ChatTypeSerializer::class)
|
@Serializable(ChatTypeSerializer::class)
|
||||||
object GroupChatType : ChatType() { override val stringified = "group" }
|
object Private : ChatType() { override val stringified = "private" }
|
||||||
@Serializable(ChatTypeSerializer::class)
|
@Serializable(ChatTypeSerializer::class)
|
||||||
object SupergroupChatType : ChatType() { override val stringified = "supergroup" }
|
object Group : ChatType() { override val stringified = "group" }
|
||||||
@Serializable(ChatTypeSerializer::class)
|
@Serializable(ChatTypeSerializer::class)
|
||||||
object ChannelChatType : ChatType() { override val stringified = "channel" }
|
object Supergroup : ChatType() { override val stringified = "supergroup" }
|
||||||
@Serializable(ChatTypeSerializer::class)
|
@Serializable(ChatTypeSerializer::class)
|
||||||
class UnknownChatType(override val stringified: String) : ChatType()
|
object Channel : ChatType() { override val stringified = "channel" }
|
||||||
|
@Serializable(ChatTypeSerializer::class)
|
||||||
|
class Unknown(override val stringified: String) : ChatType()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
@Deprecated("Renamed", ReplaceWith("Private", "dev.inmo.tgbotapi.types.chat.ChatType.Private"))
|
||||||
|
val PrivateChatType = Private
|
||||||
|
@Deprecated("Renamed", ReplaceWith("Group", "dev.inmo.tgbotapi.types.chat.ChatType.Group"))
|
||||||
|
val GroupChatType = Group
|
||||||
|
@Deprecated("Renamed", ReplaceWith("Supergroup", "dev.inmo.tgbotapi.types.chat.ChatType.Supergroup"))
|
||||||
|
val SupergroupChatType = Supergroup
|
||||||
|
@Deprecated("Renamed", ReplaceWith("Channel", "dev.inmo.tgbotapi.types.chat.ChatType.Channel"))
|
||||||
|
val ChannelChatType = Channel
|
||||||
|
@Deprecated("Renamed", ReplaceWith("Unknown", "dev.inmo.tgbotapi.types.chat.ChatType.Unknown"))
|
||||||
|
val UnknownChatType = Unknown
|
||||||
|
@Deprecated("Renamed", ReplaceWith("Unknown(stringified)", "dev.inmo.tgbotapi.types.chat.ChatType.Unknown"))
|
||||||
|
fun UnknownChatType(stringified: String) = Unknown(stringified)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
val String.asChatType
|
val String.asChatType
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
ChatType.PrivateChatType.stringified -> ChatType.PrivateChatType
|
ChatType.Sender.stringified -> ChatType.Sender
|
||||||
ChatType.GroupChatType.stringified -> ChatType.GroupChatType
|
ChatType.Private.stringified -> ChatType.Private
|
||||||
ChatType.SupergroupChatType.stringified -> ChatType.SupergroupChatType
|
ChatType.Group.stringified -> ChatType.Group
|
||||||
ChatType.ChannelChatType.stringified -> ChatType.ChannelChatType
|
ChatType.Supergroup.stringified -> ChatType.Supergroup
|
||||||
else -> ChatType.UnknownChatType(this)
|
ChatType.Channel.stringified -> ChatType.Channel
|
||||||
|
else -> ChatType.Unknown(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
@RiskFeature
|
@RiskFeature
|
||||||
@@ -63,15 +81,16 @@ object ChatSerializer : KSerializer<Chat> {
|
|||||||
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
||||||
|
|
||||||
when (type) {
|
when (type) {
|
||||||
ChatType.PrivateChatType -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
ChatType.Sender -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||||
ChatType.GroupChatType -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
ChatType.Private -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||||
ChatType.SupergroupChatType -> if (isForum) {
|
ChatType.Group -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
||||||
|
ChatType.Supergroup -> if (isForum) {
|
||||||
formatter.decodeFromJsonElement(ForumChatImpl.serializer(), decodedJson)
|
formatter.decodeFromJsonElement(ForumChatImpl.serializer(), decodedJson)
|
||||||
} else {
|
} else {
|
||||||
formatter.decodeFromJsonElement(SupergroupChatImpl.serializer(), decodedJson)
|
formatter.decodeFromJsonElement(SupergroupChatImpl.serializer(), decodedJson)
|
||||||
}
|
}
|
||||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
ChatType.Channel -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
||||||
is ChatType.UnknownChatType -> UnknownChatType(
|
is ChatType.Unknown -> UnknownChatType(
|
||||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||||
decodedJson.toString(),
|
decodedJson.toString(),
|
||||||
decodedJson
|
decodedJson
|
||||||
@@ -101,15 +120,16 @@ object PreviewChatSerializer : KSerializer<PreviewChat> {
|
|||||||
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
||||||
|
|
||||||
return when (type) {
|
return when (type) {
|
||||||
ChatType.PrivateChatType -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
ChatType.Sender -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||||
ChatType.GroupChatType -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
ChatType.Private -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||||
ChatType.SupergroupChatType -> if (isForum) {
|
ChatType.Group -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
||||||
|
ChatType.Supergroup -> if (isForum) {
|
||||||
formatter.decodeFromJsonElement(ForumChatImpl.serializer(), decodedJson)
|
formatter.decodeFromJsonElement(ForumChatImpl.serializer(), decodedJson)
|
||||||
} else {
|
} else {
|
||||||
formatter.decodeFromJsonElement(SupergroupChatImpl.serializer(), decodedJson)
|
formatter.decodeFromJsonElement(SupergroupChatImpl.serializer(), decodedJson)
|
||||||
}
|
}
|
||||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
ChatType.Channel -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
||||||
is ChatType.UnknownChatType -> UnknownChatType(
|
is ChatType.Unknown -> UnknownChatType(
|
||||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||||
decodedJson.toString(),
|
decodedJson.toString(),
|
||||||
decodedJson
|
decodedJson
|
||||||
@@ -143,16 +163,16 @@ sealed class ExtendedChatSerializer : KSerializer<ExtendedChat> {
|
|||||||
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
||||||
|
|
||||||
return when (type) {
|
return when (type) {
|
||||||
// else -> throw IllegalArgumentException("Unknown type of chat")
|
ChatType.Sender -> formatter.decodeFromJsonElement(ExtendedPrivateChatImpl.serializer(), decodedJson)
|
||||||
ChatType.PrivateChatType -> formatter.decodeFromJsonElement(ExtendedPrivateChatImpl.serializer(), decodedJson)
|
ChatType.Private -> formatter.decodeFromJsonElement(ExtendedPrivateChatImpl.serializer(), decodedJson)
|
||||||
ChatType.GroupChatType -> formatter.decodeFromJsonElement(ExtendedGroupChatImpl.serializer(), decodedJson)
|
ChatType.Group -> formatter.decodeFromJsonElement(ExtendedGroupChatImpl.serializer(), decodedJson)
|
||||||
ChatType.SupergroupChatType -> if (isForum) {
|
ChatType.Supergroup -> if (isForum) {
|
||||||
formatter.decodeFromJsonElement(ExtendedForumChatImpl.serializer(), decodedJson)
|
formatter.decodeFromJsonElement(ExtendedForumChatImpl.serializer(), decodedJson)
|
||||||
} else {
|
} else {
|
||||||
formatter.decodeFromJsonElement(ExtendedSupergroupChatImpl.serializer(), decodedJson)
|
formatter.decodeFromJsonElement(ExtendedSupergroupChatImpl.serializer(), decodedJson)
|
||||||
}
|
}
|
||||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ExtendedChannelChatImpl.serializer(), decodedJson)
|
ChatType.Channel -> formatter.decodeFromJsonElement(ExtendedChannelChatImpl.serializer(), decodedJson)
|
||||||
is ChatType.UnknownChatType -> UnknownExtendedChat(
|
is ChatType.Unknown -> UnknownExtendedChat(
|
||||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||||
decodedJson.toString(),
|
decodedJson.toString(),
|
||||||
decodedJson
|
decodedJson
|
||||||
|
|||||||
@@ -184,6 +184,10 @@ data class ExtendedSupergroupChatImpl(
|
|||||||
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
||||||
@SerialName(hasVisibleHistoryField)
|
@SerialName(hasVisibleHistoryField)
|
||||||
override val newMembersSeeHistory: Boolean = false,
|
override val newMembersSeeHistory: Boolean = false,
|
||||||
|
@SerialName(unrestrictBoostsCountField)
|
||||||
|
override val unrestrictBoostsCount: Int? = null,
|
||||||
|
@SerialName(customEmojiStickerSetNameField)
|
||||||
|
override val customEmojiStickerSetName: StickerSetName? = null,
|
||||||
) : ExtendedSupergroupChat
|
) : ExtendedSupergroupChat
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@@ -242,6 +246,10 @@ data class ExtendedForumChatImpl(
|
|||||||
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
override val profileBackgroundCustomEmojiId: CustomEmojiId? = null,
|
||||||
@SerialName(hasVisibleHistoryField)
|
@SerialName(hasVisibleHistoryField)
|
||||||
override val newMembersSeeHistory: Boolean = false,
|
override val newMembersSeeHistory: Boolean = false,
|
||||||
|
@SerialName(unrestrictBoostsCountField)
|
||||||
|
override val unrestrictBoostsCount: Int? = null,
|
||||||
|
@SerialName(customEmojiStickerSetNameField)
|
||||||
|
override val customEmojiStickerSetName: StickerSetName? = null,
|
||||||
) : ExtendedForumChat
|
) : ExtendedForumChat
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
|
|||||||
@@ -59,7 +59,9 @@ sealed interface ExtendedSupergroupChat : SupergroupChat, ExtendedGroupChat, Ext
|
|||||||
val stickerSetName: StickerSetName?
|
val stickerSetName: StickerSetName?
|
||||||
val canSetStickerSet: Boolean
|
val canSetStickerSet: Boolean
|
||||||
val linkedChannelChatId: IdChatIdentifier?
|
val linkedChannelChatId: IdChatIdentifier?
|
||||||
|
val unrestrictBoostsCount: Int?
|
||||||
val location: ChatLocation?
|
val location: ChatLocation?
|
||||||
|
val customEmojiStickerSetName: StickerSetName?
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This field represents field "join_to_send_messages" from API
|
* This field represents field "join_to_send_messages" from API
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.inmo.tgbotapi.types.message.ChatEvents
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.boostCountField
|
||||||
|
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PublicChatEvent
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ChatBoostAdded(
|
||||||
|
@SerialName(boostCountField)
|
||||||
|
val count: Int
|
||||||
|
) : PublicChatEvent
|
||||||
@@ -123,6 +123,7 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
|
|||||||
override val content: T,
|
override val content: T,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
override val mediaGroupId: MediaGroupIdentifier?,
|
override val mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
override val senderBoostsCount: Int?
|
||||||
) : CommonGroupContentMessage<T> {
|
) : CommonGroupContentMessage<T> {
|
||||||
constructor(
|
constructor(
|
||||||
chat: PreviewGroupChat,
|
chat: PreviewGroupChat,
|
||||||
@@ -137,8 +138,9 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
|
|||||||
content: T,
|
content: T,
|
||||||
senderBot: CommonBot?,
|
senderBot: CommonBot?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
senderBoostsCount: Int?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId
|
chat, messageId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,6 +228,7 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
|
|||||||
override val content: T,
|
override val content: T,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
override val mediaGroupId: MediaGroupIdentifier?,
|
override val mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
override val senderBoostsCount: Int?,
|
||||||
) : CommonForumContentMessage<T> {
|
) : CommonForumContentMessage<T> {
|
||||||
constructor(
|
constructor(
|
||||||
chat: PreviewForumChat,
|
chat: PreviewForumChat,
|
||||||
@@ -241,7 +244,8 @@ data class CommonForumContentMessageImpl<T : MessageContent>(
|
|||||||
content: T,
|
content: T,
|
||||||
senderBot: CommonBot?,
|
senderBot: CommonBot?,
|
||||||
mediaGroupId: MediaGroupIdentifier?,
|
mediaGroupId: MediaGroupIdentifier?,
|
||||||
|
senderBoostsCount: Int?,
|
||||||
) : this(
|
) : this(
|
||||||
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId
|
chat, messageId, threadId, from, date, forwardInfo.messageOrigin(), editDate, hasProtectedContent, replyTo ?.let { ReplyInfo.Internal(it) }, replyMarkup, content, senderBot, mediaGroupId, senderBoostsCount
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ internal data class RawMessage(
|
|||||||
private val is_topic_message: Boolean? = null,
|
private val is_topic_message: Boolean? = null,
|
||||||
private val is_automatic_forward: Boolean? = null,
|
private val is_automatic_forward: Boolean? = null,
|
||||||
private val reply_to_message: RawMessage? = null,
|
private val reply_to_message: RawMessage? = null,
|
||||||
|
private val reply_to_story: Story? = null,
|
||||||
private val external_reply: ReplyInfo.External? = null,
|
private val external_reply: ReplyInfo.External? = null,
|
||||||
private val quote: TextQuote? = null,
|
private val quote: TextQuote? = null,
|
||||||
private val via_bot: CommonBot? = null,
|
private val via_bot: CommonBot? = null,
|
||||||
@@ -98,6 +99,7 @@ internal data class RawMessage(
|
|||||||
private val successful_payment: SuccessfulPayment? = null,
|
private val successful_payment: SuccessfulPayment? = null,
|
||||||
private val giveaway: Giveaway? = null,
|
private val giveaway: Giveaway? = null,
|
||||||
private val giveaway_winners: GiveawayResults? = null,
|
private val giveaway_winners: GiveawayResults? = null,
|
||||||
|
private val sender_boost_count: Int? = null,
|
||||||
|
|
||||||
private val users_shared: UsersShared? = null,
|
private val users_shared: UsersShared? = null,
|
||||||
private val chat_shared: ChatShared? = null,
|
private val chat_shared: ChatShared? = null,
|
||||||
@@ -117,6 +119,9 @@ internal data class RawMessage(
|
|||||||
private val general_forum_topic_unhidden: GeneralForumTopicUnhidden? = null,
|
private val general_forum_topic_unhidden: GeneralForumTopicUnhidden? = null,
|
||||||
private val write_access_allowed: WriteAccessAllowed? = null,
|
private val write_access_allowed: WriteAccessAllowed? = null,
|
||||||
|
|
||||||
|
// Boost added to groups
|
||||||
|
private val boost_added: ChatBoostAdded? = null,
|
||||||
|
|
||||||
// AutoDelete Message time changed
|
// AutoDelete Message time changed
|
||||||
private val message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged? = null,
|
private val message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged? = null,
|
||||||
|
|
||||||
@@ -247,11 +252,12 @@ internal data class RawMessage(
|
|||||||
giveaway_created != null -> giveaway_created
|
giveaway_created != null -> giveaway_created
|
||||||
giveaway_winners is GiveawayPrivateResults -> giveaway_winners
|
giveaway_winners is GiveawayPrivateResults -> giveaway_winners
|
||||||
giveaway_completed != null -> giveaway_completed
|
giveaway_completed != null -> giveaway_completed
|
||||||
|
boost_added != null -> boost_added
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val asMessage: AccessibleMessage by lazy {
|
val asMessage: Message by lazy {
|
||||||
if (date.date == 0L) {
|
if (date.date == 0L) {
|
||||||
return@lazy InaccessibleMessage(
|
return@lazy InaccessibleMessage(
|
||||||
chat,
|
chat,
|
||||||
@@ -295,6 +301,7 @@ internal data class RawMessage(
|
|||||||
reply_to_message != null -> ReplyInfo.Internal(
|
reply_to_message != null -> ReplyInfo.Internal(
|
||||||
reply_to_message.asMessage
|
reply_to_message.asMessage
|
||||||
)
|
)
|
||||||
|
reply_to_story != null -> ReplyInfo.ToStory(reply_to_story)
|
||||||
external_reply != null -> external_reply
|
external_reply != null -> external_reply
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
@@ -367,7 +374,8 @@ internal data class RawMessage(
|
|||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
via_bot,
|
via_bot,
|
||||||
media_group_id
|
media_group_id,
|
||||||
|
sender_boost_count
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -431,7 +439,8 @@ internal data class RawMessage(
|
|||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
via_bot,
|
via_bot,
|
||||||
media_group_id
|
media_group_id,
|
||||||
|
sender_boost_count
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -495,7 +504,8 @@ internal data class RawMessage(
|
|||||||
reply_markup,
|
reply_markup,
|
||||||
content,
|
content,
|
||||||
via_bot,
|
via_bot,
|
||||||
media_group_id
|
media_group_id,
|
||||||
|
sender_boost_count
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ sealed interface GroupContentMessage<T : MessageContent> : PublicContentMessage<
|
|||||||
override val chat: PreviewGroupChat
|
override val chat: PreviewGroupChat
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sealed interface PotentiallyFromUserGroupContentMessage<T : MessageContent> : GroupContentMessage<T> {
|
||||||
|
val senderBoostsCount: Int?
|
||||||
|
}
|
||||||
|
|
||||||
sealed interface ForumContentMessage<T : MessageContent> : GroupContentMessage<T>, PossiblyTopicMessage {
|
sealed interface ForumContentMessage<T : MessageContent> : GroupContentMessage<T>, PossiblyTopicMessage {
|
||||||
override val chat: PreviewForumChat
|
override val chat: PreviewForumChat
|
||||||
override val threadId: MessageThreadId
|
override val threadId: MessageThreadId
|
||||||
@@ -28,7 +32,7 @@ interface AnonymousGroupContentMessage<T : MessageContent> : GroupContentMessage
|
|||||||
get() = chat
|
get() = chat
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CommonGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, FromUserMessage
|
interface CommonGroupContentMessage<T : MessageContent> : GroupContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
|
||||||
|
|
||||||
interface FromChannelForumContentMessage<T: MessageContent> : FromChannelGroupContentMessage<T>, ForumContentMessage<T>
|
interface FromChannelForumContentMessage<T: MessageContent> : FromChannelGroupContentMessage<T>, ForumContentMessage<T>
|
||||||
|
|
||||||
@@ -37,4 +41,4 @@ interface AnonymousForumContentMessage<T : MessageContent> : ForumContentMessage
|
|||||||
get() = chat
|
get() = chat
|
||||||
}
|
}
|
||||||
|
|
||||||
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, FromUserMessage
|
interface CommonForumContentMessage<T : MessageContent> : ForumContentMessage<T>, PotentiallyFromUserGroupContentMessage<T>, FromUserMessage
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ interface AccessibleMessage : Message
|
|||||||
data class InaccessibleMessage(
|
data class InaccessibleMessage(
|
||||||
override val chat: PreviewChat,
|
override val chat: PreviewChat,
|
||||||
override val messageId: MessageId,
|
override val messageId: MessageId,
|
||||||
) : AccessibleMessage {
|
) : Message {
|
||||||
override val date: DateTime
|
override val date: DateTime
|
||||||
get() = DateTime.invoke(0L)
|
get() = DateTime.invoke(0L)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ import dev.inmo.tgbotapi.types.ReplyInfo
|
|||||||
|
|
||||||
interface PossiblyReplyMessage {
|
interface PossiblyReplyMessage {
|
||||||
val replyInfo: ReplyInfo?
|
val replyInfo: ReplyInfo?
|
||||||
val replyTo: AccessibleMessage?
|
val replyTo: Message?
|
||||||
get() = (replyInfo as? ReplyInfo.Internal) ?.message
|
get() = (replyInfo as? ReplyInfo.Internal) ?.message
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,17 @@
|
|||||||
package dev.inmo.tgbotapi.types.stories
|
package dev.inmo.tgbotapi.types.stories
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.ReplyInfo
|
import dev.inmo.tgbotapi.types.ReplyInfo
|
||||||
|
import dev.inmo.tgbotapi.types.StoryId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PreviewChat
|
||||||
|
import dev.inmo.tgbotapi.types.chatField
|
||||||
|
import dev.inmo.tgbotapi.types.idField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
class Story : ReplyInfo.External.ContentVariant
|
data class Story(
|
||||||
|
@SerialName(idField)
|
||||||
|
val id: StoryId,
|
||||||
|
@SerialName(chatField)
|
||||||
|
val chat: PreviewChat
|
||||||
|
) : ReplyInfo.External.ContentVariant
|
||||||
|
|||||||
@@ -86,7 +86,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
|
|||||||
sourceMessage.replyMarkup,
|
sourceMessage.replyMarkup,
|
||||||
content,
|
content,
|
||||||
sourceMessage.senderBot,
|
sourceMessage.senderBot,
|
||||||
sourceMessage.mediaGroupId
|
sourceMessage.mediaGroupId,
|
||||||
|
sourceMessage.senderBoostsCount
|
||||||
)
|
)
|
||||||
is ConnectedFromChannelGroupContentMessage -> ConnectedFromChannelGroupContentMessageImpl(
|
is ConnectedFromChannelGroupContentMessage -> ConnectedFromChannelGroupContentMessageImpl(
|
||||||
sourceMessage.chat,
|
sourceMessage.chat,
|
||||||
@@ -146,7 +147,8 @@ fun <T : MediaGroupPartContent> List<PossiblySentViaBotCommonMessage<T>>.asMedia
|
|||||||
sourceMessage.replyMarkup,
|
sourceMessage.replyMarkup,
|
||||||
content,
|
content,
|
||||||
sourceMessage.senderBot,
|
sourceMessage.senderBot,
|
||||||
sourceMessage.mediaGroupId
|
sourceMessage.mediaGroupId,
|
||||||
|
sourceMessage.senderBoostsCount
|
||||||
)
|
)
|
||||||
is FromChannelForumContentMessage -> FromChannelForumContentMessageImpl(
|
is FromChannelForumContentMessage -> FromChannelForumContentMessageImpl(
|
||||||
sourceMessage.chat,
|
sourceMessage.chat,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.utils.extensions
|
package dev.inmo.tgbotapi.utils.extensions
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
||||||
|
|
||||||
val AccessibleMessage.threadIdOrNull
|
val Message.threadIdOrNull
|
||||||
get() = (this as? PossiblyTopicMessage) ?.threadId
|
get() = (this as? PossiblyTopicMessage) ?.threadId
|
||||||
|
|||||||
16
tgbotapi.ksp/api/tgbotapi.ksp.api
Normal file
16
tgbotapi.ksp/api/tgbotapi.ksp.api
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
public final class dev/inmo/tgbotapi/ksp/processor/ClassCastsFillerKt {
|
||||||
|
public static final fun fill (Lcom/squareup/kotlinpoet/FileSpec$Builder;Lcom/google/devtools/ksp/symbol/KSClassDeclaration;Ljava/util/Map;Lcom/google/devtools/ksp/symbol/KSClassDeclaration;)V
|
||||||
|
public static synthetic fun fill$default (Lcom/squareup/kotlinpoet/FileSpec$Builder;Lcom/google/devtools/ksp/symbol/KSClassDeclaration;Ljava/util/Map;Lcom/google/devtools/ksp/symbol/KSClassDeclaration;ILjava/lang/Object;)V
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class dev/inmo/tgbotapi/ksp/processor/TelegramBotAPISymbolProcessor : com/google/devtools/ksp/processing/SymbolProcessor {
|
||||||
|
public fun <init> (Lcom/google/devtools/ksp/processing/CodeGenerator;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
|
||||||
|
public synthetic fun <init> (Lcom/google/devtools/ksp/processing/CodeGenerator;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public fun process (Lcom/google/devtools/ksp/processing/Resolver;)Ljava/util/List;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class dev/inmo/tgbotapi/ksp/processor/TelegramBotAPISymbolProcessorProvider : com/google/devtools/ksp/processing/SymbolProcessorProvider {
|
||||||
|
public fun <init> ()V
|
||||||
|
public fun create (Lcom/google/devtools/ksp/processing/SymbolProcessorEnvironment;)Lcom/google/devtools/ksp/processing/SymbolProcessor;
|
||||||
|
}
|
||||||
|
|
||||||
3310
tgbotapi.utils/api/tgbotapi.utils.api
Normal file
3310
tgbotapi.utils/api/tgbotapi.utils.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -978,346 +978,346 @@ inline fun SecureValue.requireSecureValueWithTranslations(): SecureValueWithTran
|
|||||||
this as SecureValueWithTranslations
|
this as SecureValueWithTranslations
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T) =
|
inline fun <T> Message.whenAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T) =
|
||||||
asAnonymousGroupContentMessageImpl()?.let(block)
|
asAnonymousGroupContentMessageImpl()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? =
|
inline fun Message.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? =
|
||||||
this as? AnonymousGroupContentMessageImpl<MessageContent>
|
this as? AnonymousGroupContentMessageImpl<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> =
|
inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> =
|
||||||
this as AnonymousGroupContentMessageImpl<MessageContent>
|
this as AnonymousGroupContentMessageImpl<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) =
|
inline fun <T> Message.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) =
|
||||||
asChannelContentMessageImpl()?.let(block)
|
asChannelContentMessageImpl()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
|
inline fun Message.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
|
||||||
this as? UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
this as? UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
|
inline fun Message.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
|
||||||
this as UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
this as UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPassportMessage(block: (PassportMessage) -> T) = asPassportMessage()?.let(block)
|
inline fun <T> Message.whenPassportMessage(block: (PassportMessage) -> T) = asPassportMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPassportMessage(): PassportMessage? = this as? PassportMessage
|
inline fun Message.asPassportMessage(): PassportMessage? = this as? PassportMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePassportMessage(): PassportMessage = this as PassportMessage
|
inline fun Message.requirePassportMessage(): PassportMessage = this as PassportMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T) =
|
inline fun <T> Message.whenPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T) =
|
||||||
asPrivateContentMessageImpl()?.let(block)
|
asPrivateContentMessageImpl()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? =
|
inline fun Message.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? =
|
||||||
this as? PrivateContentMessageImpl<MessageContent>
|
this as? PrivateContentMessageImpl<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> =
|
inline fun Message.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> =
|
||||||
this as PrivateContentMessageImpl<MessageContent>
|
this as PrivateContentMessageImpl<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenChannelEventMessage(block: (ChannelEventMessage<ChannelEvent>) -> T) =
|
inline fun <T> Message.whenChannelEventMessage(block: (ChannelEventMessage<ChannelEvent>) -> T) =
|
||||||
asChannelEventMessage()?.let(block)
|
asChannelEventMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? =
|
inline fun Message.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? =
|
||||||
this as? ChannelEventMessage<ChannelEvent>
|
this as? ChannelEventMessage<ChannelEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireChannelEventMessage(): ChannelEventMessage<ChannelEvent> =
|
inline fun Message.requireChannelEventMessage(): ChannelEventMessage<ChannelEvent> =
|
||||||
this as ChannelEventMessage<ChannelEvent>
|
this as ChannelEventMessage<ChannelEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T) =
|
inline fun <T> Message.whenCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T) =
|
||||||
asCommonGroupEventMessage()?.let(block)
|
asCommonGroupEventMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent>? =
|
inline fun Message.asCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent>? =
|
||||||
this as? CommonGroupEventMessage<GroupEvent>
|
this as? CommonGroupEventMessage<GroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent> =
|
inline fun Message.requireCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent> =
|
||||||
this as CommonGroupEventMessage<GroupEvent>
|
this as CommonGroupEventMessage<GroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T) =
|
inline fun <T> Message.whenCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T) =
|
||||||
asCommonSupergroupEventMessage()?.let(block)
|
asCommonSupergroupEventMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent>? =
|
inline fun Message.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent>? =
|
||||||
this as? CommonSupergroupEventMessage<SupergroupEvent>
|
this as? CommonSupergroupEventMessage<SupergroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> =
|
inline fun Message.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> =
|
||||||
this as CommonSupergroupEventMessage<SupergroupEvent>
|
this as CommonSupergroupEventMessage<SupergroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage<MessageContent>) -> T) =
|
||||||
asAnonymousGroupContentMessage()?.let(block)
|
asAnonymousGroupContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? =
|
inline fun Message.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? =
|
||||||
this as? AnonymousGroupContentMessage<MessageContent>
|
this as? AnonymousGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> =
|
inline fun Message.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> =
|
||||||
this as AnonymousGroupContentMessage<MessageContent>
|
this as AnonymousGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T) =
|
||||||
asChannelContentMessage()?.let(block)
|
asChannelContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
|
inline fun Message.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
|
||||||
this as? ChannelContentMessage<MessageContent>
|
this as? ChannelContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
|
inline fun Message.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
|
||||||
this as ChannelContentMessage<MessageContent>
|
this as ChannelContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||||
asConnectedFromChannelGroupContentMessage()?.let(block)
|
asConnectedFromChannelGroupContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
|
inline fun Message.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||||
this as? ConnectedFromChannelGroupContentMessage<MessageContent>
|
this as? ConnectedFromChannelGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
|
inline fun Message.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
|
||||||
this as ConnectedFromChannelGroupContentMessage<MessageContent>
|
this as ConnectedFromChannelGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||||
asUnconnectedFromChannelGroupContentMessage()?.let(block)
|
asUnconnectedFromChannelGroupContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
|
inline fun Message.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
|
||||||
this as? UnconnectedFromChannelGroupContentMessage<MessageContent>
|
this as? UnconnectedFromChannelGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
|
inline fun Message.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
|
||||||
this as UnconnectedFromChannelGroupContentMessage<MessageContent>
|
this as UnconnectedFromChannelGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) =
|
inline fun <T> Message.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) =
|
||||||
asChatEventMessage()?.let(block)
|
asChatEventMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
|
inline fun Message.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
|
inline fun Message.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T) =
|
||||||
asCommonGroupContentMessage()?.let(block)
|
asCommonGroupContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? =
|
inline fun Message.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? =
|
||||||
this as? CommonGroupContentMessage<MessageContent>
|
this as? CommonGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> =
|
inline fun Message.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> =
|
||||||
this as CommonGroupContentMessage<MessageContent>
|
this as CommonGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenCommonMessage(block: (CommonMessage<MessageContent>) -> T) = asCommonMessage()?.let(block)
|
inline fun <T> Message.whenCommonMessage(block: (CommonMessage<MessageContent>) -> T) = asCommonMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
|
inline fun Message.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireCommonMessage(): CommonMessage<MessageContent> = this as CommonMessage<MessageContent>
|
inline fun Message.requireCommonMessage(): CommonMessage<MessageContent> = this as CommonMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenContentMessage(block: (ContentMessage<MessageContent>) -> T) = asContentMessage()?.let(block)
|
inline fun <T> Message.whenContentMessage(block: (ContentMessage<MessageContent>) -> T) = asContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asContentMessage(): ContentMessage<MessageContent>? = this as? ContentMessage<MessageContent>
|
inline fun Message.asContentMessage(): ContentMessage<MessageContent>? = this as? ContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
|
inline fun Message.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage<MessageContent>) -> T) =
|
||||||
asFromChannelGroupContentMessage()?.let(block)
|
asFromChannelGroupContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? =
|
inline fun Message.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? =
|
||||||
this as? FromChannelGroupContentMessage<MessageContent>
|
this as? FromChannelGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> =
|
inline fun Message.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> =
|
||||||
this as FromChannelGroupContentMessage<MessageContent>
|
this as FromChannelGroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T) =
|
inline fun <T> Message.whenGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T) =
|
||||||
asGroupEventMessage()?.let(block)
|
asGroupEventMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
|
inline fun Message.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
|
inline fun Message.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T) =
|
inline fun <T> Message.whenPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T) =
|
||||||
asPrivateEventMessage()?.let(block)
|
asPrivateEventMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPrivateEventMessage(): PrivateEventMessage<PrivateEvent>? =
|
inline fun Message.asPrivateEventMessage(): PrivateEventMessage<PrivateEvent>? =
|
||||||
this as? PrivateEventMessage<PrivateEvent>
|
this as? PrivateEventMessage<PrivateEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePrivateEventMessage(): PrivateEventMessage<PrivateEvent> =
|
inline fun Message.requirePrivateEventMessage(): PrivateEventMessage<PrivateEvent> =
|
||||||
this as PrivateEventMessage<PrivateEvent>
|
this as PrivateEventMessage<PrivateEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T) =
|
||||||
asGroupContentMessage()?.let(block)
|
asGroupContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asGroupContentMessage(): GroupContentMessage<MessageContent>? =
|
inline fun Message.asGroupContentMessage(): GroupContentMessage<MessageContent>? =
|
||||||
this as? GroupContentMessage<MessageContent>
|
this as? GroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireGroupContentMessage(): GroupContentMessage<MessageContent> =
|
inline fun Message.requireGroupContentMessage(): GroupContentMessage<MessageContent> =
|
||||||
this as GroupContentMessage<MessageContent>
|
this as GroupContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenMediaGroupMessage(block: (MediaGroupMessage<MediaGroupPartContent>) -> T) =
|
inline fun <T> Message.whenMediaGroupMessage(block: (MediaGroupMessage<MediaGroupPartContent>) -> T) =
|
||||||
asMediaGroupMessage()?.let(block)
|
asMediaGroupMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent>? =
|
inline fun Message.asMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent>? =
|
||||||
this as? MediaGroupMessage<MediaGroupPartContent>
|
this as? MediaGroupMessage<MediaGroupPartContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent> =
|
inline fun Message.requireMediaGroupMessage(): MediaGroupMessage<MediaGroupPartContent> =
|
||||||
this as MediaGroupMessage<MediaGroupPartContent>
|
this as MediaGroupMessage<MediaGroupPartContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T) =
|
inline fun <T> Message.whenPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T) =
|
||||||
asPossiblyEditedMessage()?.let(block)
|
asPossiblyEditedMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage
|
inline fun Message.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
|
inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) =
|
inline fun <T> Message.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) =
|
||||||
asPossiblyReplyMessage()?.let(block)
|
asPossiblyReplyMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
|
inline fun Message.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
|
inline fun Message.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) =
|
inline fun <T> Message.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) =
|
||||||
asPossiblyForwardedMessage()?.let(block)
|
asPossiblyForwardedMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage
|
inline fun Message.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage
|
inline fun Message.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T) =
|
inline fun <T> Message.whenPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T) =
|
||||||
asPossiblyPaymentMessage()?.let(block)
|
asPossiblyPaymentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage
|
inline fun Message.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
|
inline fun Message.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T) =
|
||||||
asPrivateContentMessage()?.let(block)
|
asPrivateContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? =
|
inline fun Message.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? =
|
||||||
this as? PrivateContentMessage<MessageContent>
|
this as? PrivateContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> =
|
inline fun Message.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> =
|
||||||
this as PrivateContentMessage<MessageContent>
|
this as PrivateContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPublicContentMessage(block: (PublicContentMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenPublicContentMessage(block: (PublicContentMessage<MessageContent>) -> T) =
|
||||||
asPublicContentMessage()?.let(block)
|
asPublicContentMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPublicContentMessage(): PublicContentMessage<MessageContent>? =
|
inline fun Message.asPublicContentMessage(): PublicContentMessage<MessageContent>? =
|
||||||
this as? PublicContentMessage<MessageContent>
|
this as? PublicContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePublicContentMessage(): PublicContentMessage<MessageContent> =
|
inline fun Message.requirePublicContentMessage(): PublicContentMessage<MessageContent> =
|
||||||
this as PublicContentMessage<MessageContent>
|
this as PublicContentMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenSignedMessage(block: (SignedMessage) -> T) = asSignedMessage()?.let(block)
|
inline fun <T> Message.whenSignedMessage(block: (SignedMessage) -> T) = asSignedMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asSignedMessage(): SignedMessage? = this as? SignedMessage
|
inline fun Message.asSignedMessage(): SignedMessage? = this as? SignedMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireSignedMessage(): SignedMessage = this as SignedMessage
|
inline fun Message.requireSignedMessage(): SignedMessage = this as SignedMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T) =
|
inline fun <T> Message.whenSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T) =
|
||||||
asSupergroupEventMessage()?.let(block)
|
asSupergroupEventMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent>? =
|
inline fun Message.asSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent>? =
|
||||||
this as? SupergroupEventMessage<SupergroupEvent>
|
this as? SupergroupEventMessage<SupergroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent> =
|
inline fun Message.requireSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent> =
|
||||||
this as SupergroupEventMessage<SupergroupEvent>
|
this as SupergroupEventMessage<SupergroupEvent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenUnknownMessageType(block: (UnknownMessageType) -> T) = asUnknownMessageType()?.let(block)
|
inline fun <T> Message.whenUnknownMessageType(block: (UnknownMessageType) -> T) = asUnknownMessageType()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType
|
inline fun Message.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType
|
inline fun Message.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage<MessageContent>) -> T) =
|
inline fun <T> Message.whenPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage<MessageContent>) -> T) =
|
||||||
asPossiblySentViaBotCommonMessage()?.let(block)
|
asPossiblySentViaBotCommonMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent>? =
|
inline fun Message.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent>? =
|
||||||
this as? PossiblySentViaBotCommonMessage<MessageContent>
|
this as? PossiblySentViaBotCommonMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent> =
|
inline fun Message.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent> =
|
||||||
this as PossiblySentViaBotCommonMessage<MessageContent>
|
this as PossiblySentViaBotCommonMessage<MessageContent>
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> AccessibleMessage.whenFromUserMessage(block: (FromUserMessage) -> T) = asFromUserMessage()?.let(block)
|
inline fun <T> Message.whenFromUserMessage(block: (FromUserMessage) -> T) = asFromUserMessage()?.let(block)
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage
|
inline fun Message.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun AccessibleMessage.requireFromUserMessage(): FromUserMessage = this as FromUserMessage
|
inline fun Message.requireFromUserMessage(): FromUserMessage = this as FromUserMessage
|
||||||
|
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
inline fun <T> BotAction.whenFindLocationAction(block: (FindLocationAction) -> T) = asFindLocationAction()?.let(block)
|
inline fun <T> BotAction.whenFindLocationAction(block: (FindLocationAction) -> T) = asFindLocationAction()?.let(block)
|
||||||
|
|||||||
@@ -222,6 +222,7 @@ import dev.inmo.tgbotapi.types.media.TitledTelegramMedia
|
|||||||
import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia
|
import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
|
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated
|
import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated
|
||||||
|
import dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated
|
import dev.inmo.tgbotapi.types.message.ChatEvents.GroupChatCreated
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent
|
import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMemberEvent
|
||||||
@@ -284,6 +285,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyPaymentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyPaymentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.PotentiallyFromUserGroupContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PublicContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.SignedMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.SignedMessage
|
||||||
@@ -1629,6 +1631,15 @@ public inline fun ReplyInfo.internalOrThrow(): ReplyInfo.Internal = this as
|
|||||||
public inline fun <T> ReplyInfo.ifInternal(block: (ReplyInfo.Internal) -> T): T? = internalOrNull()
|
public inline fun <T> ReplyInfo.ifInternal(block: (ReplyInfo.Internal) -> T): T? = internalOrNull()
|
||||||
?.let(block)
|
?.let(block)
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.toStoryOrNull(): ReplyInfo.ToStory? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.ToStory
|
||||||
|
|
||||||
|
public inline fun ReplyInfo.toStoryOrThrow(): ReplyInfo.ToStory = this as
|
||||||
|
dev.inmo.tgbotapi.types.ReplyInfo.ToStory
|
||||||
|
|
||||||
|
public inline fun <T> ReplyInfo.ifToStory(block: (ReplyInfo.ToStory) -> T): T? = toStoryOrNull()
|
||||||
|
?.let(block)
|
||||||
|
|
||||||
public inline fun BotAction.typingActionOrNull(): TypingAction? = this as?
|
public inline fun BotAction.typingActionOrNull(): TypingAction? = this as?
|
||||||
dev.inmo.tgbotapi.types.actions.TypingAction
|
dev.inmo.tgbotapi.types.actions.TypingAction
|
||||||
|
|
||||||
@@ -2882,6 +2893,15 @@ public inline fun ChatEvent.channelChatCreatedOrThrow(): ChannelChatCreated = th
|
|||||||
public inline fun <T> ChatEvent.ifChannelChatCreated(block: (ChannelChatCreated) -> T): T? =
|
public inline fun <T> ChatEvent.ifChannelChatCreated(block: (ChannelChatCreated) -> T): T? =
|
||||||
channelChatCreatedOrNull() ?.let(block)
|
channelChatCreatedOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun ChatEvent.chatBoostAddedOrNull(): ChatBoostAdded? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded
|
||||||
|
|
||||||
|
public inline fun ChatEvent.chatBoostAddedOrThrow(): ChatBoostAdded = this as
|
||||||
|
dev.inmo.tgbotapi.types.message.ChatEvents.ChatBoostAdded
|
||||||
|
|
||||||
|
public inline fun <T> ChatEvent.ifChatBoostAdded(block: (ChatBoostAdded) -> T): T? =
|
||||||
|
chatBoostAddedOrNull() ?.let(block)
|
||||||
|
|
||||||
public inline fun ChatEvent.deleteChatPhotoOrNull(): DeleteChatPhoto? = this as?
|
public inline fun ChatEvent.deleteChatPhotoOrNull(): DeleteChatPhoto? = this as?
|
||||||
dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
||||||
|
|
||||||
@@ -3387,6 +3407,18 @@ public inline fun <T>
|
|||||||
Message.ifGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T): T? =
|
Message.ifGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T): T? =
|
||||||
groupContentMessageOrNull() ?.let(block)
|
groupContentMessageOrNull() ?.let(block)
|
||||||
|
|
||||||
|
public inline fun Message.potentiallyFromUserGroupContentMessageOrNull():
|
||||||
|
PotentiallyFromUserGroupContentMessage<MessageContent>? = this as?
|
||||||
|
dev.inmo.tgbotapi.types.message.abstracts.PotentiallyFromUserGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||||
|
|
||||||
|
public inline fun Message.potentiallyFromUserGroupContentMessageOrThrow():
|
||||||
|
PotentiallyFromUserGroupContentMessage<MessageContent> = this as
|
||||||
|
dev.inmo.tgbotapi.types.message.abstracts.PotentiallyFromUserGroupContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||||
|
|
||||||
|
public inline fun <T>
|
||||||
|
Message.ifPotentiallyFromUserGroupContentMessage(block: (PotentiallyFromUserGroupContentMessage<MessageContent>) -> T):
|
||||||
|
T? = potentiallyFromUserGroupContentMessageOrNull() ?.let(block)
|
||||||
|
|
||||||
public inline fun Message.forumContentMessageOrNull(): ForumContentMessage<MessageContent>? = this
|
public inline fun Message.forumContentMessageOrNull(): ForumContentMessage<MessageContent>? = this
|
||||||
as?
|
as?
|
||||||
dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
dev.inmo.tgbotapi.types.message.abstracts.ForumContentMessage<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.MessageId
|
|||||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
import dev.inmo.tgbotapi.types.Username
|
import dev.inmo.tgbotapi.types.Username
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.threadId
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
|
|
||||||
@@ -32,43 +32,43 @@ inline fun WithPreviewChat.sameChat(chat: Chat) =
|
|||||||
* @return true in case if [this] message is placed in the same chat that [other]
|
* @return true in case if [this] message is placed in the same chat that [other]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun WithPreviewChat.sameChat(other: AccessibleMessage) = sameChat(other.chat)
|
inline fun WithPreviewChat.sameChat(other: Message) = sameChat(other.chat)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true in case if [this] message is from the same chat (with id == [chatId]) and [this] [AccessibleMessage.messageId]
|
* @return true in case if [this] message is from the same chat (with id == [chatId]) and [this] [Message.messageId]
|
||||||
* equal [messageId] identifier
|
* equal [messageId] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameMessage(
|
inline fun Message.sameMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
) = sameChat(chatId) && this.messageId == messageId
|
) = sameChat(chatId) && this.messageId == messageId
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true in case if [this] message is from the same [chat] and [this] [AccessibleMessage.messageId] equal [messageId]
|
* @return true in case if [this] message is from the same [chat] and [this] [Message.messageId] equal [messageId]
|
||||||
* identifier
|
* identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameMessage(
|
inline fun Message.sameMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
) = sameChat(chat) && this.messageId == messageId
|
) = sameChat(chat) && this.messageId == messageId
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true in case if [this] message is the same as [other]. The same here means that these messages from one chat
|
* @return true in case if [this] message is the same as [other]. The same here means that these messages from one chat
|
||||||
* and have equal [AccessibleMessage.messageId] identifier
|
* and have equal [Message.messageId] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameMessage(other: AccessibleMessage) = sameMessage(other.chat, other.messageId)
|
inline fun Message.sameMessage(other: Message) = sameMessage(other.chat, other.messageId)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread is the same thing that topic
|
* Thread is the same thing that topic
|
||||||
*
|
*
|
||||||
* @return true in case if [this] message is in the chat [chatId] and topic [threadId]. The same here means that these
|
* @return true in case if [this] message is in the chat [chatId] and topic [threadId]. The same here means that these
|
||||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameTopic(
|
inline fun Message.sameTopic(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
threadId: MessageThreadId? = chatId.threadId
|
threadId: MessageThreadId? = chatId.threadId
|
||||||
) = sameChat(chatId) && threadIdOrNull == threadId
|
) = sameChat(chatId) && threadIdOrNull == threadId
|
||||||
@@ -77,10 +77,10 @@ inline fun AccessibleMessage.sameTopic(
|
|||||||
* Thread is the same thing that topic
|
* Thread is the same thing that topic
|
||||||
*
|
*
|
||||||
* @return true in case if [this] message is in the chat [chatId] and topic [threadId]. The same here means that these
|
* @return true in case if [this] message is in the chat [chatId] and topic [threadId]. The same here means that these
|
||||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameThread(
|
inline fun Message.sameThread(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
threadId: MessageThreadId? = chatId.threadId
|
threadId: MessageThreadId? = chatId.threadId
|
||||||
) = sameTopic(chatId, threadId)
|
) = sameTopic(chatId, threadId)
|
||||||
@@ -89,10 +89,10 @@ inline fun AccessibleMessage.sameThread(
|
|||||||
* Thread is the same thing that topic
|
* Thread is the same thing that topic
|
||||||
*
|
*
|
||||||
* @return true in case if [this] message is from the [chat] and topic [threadId]. The same here means that these
|
* @return true in case if [this] message is from the [chat] and topic [threadId]. The same here means that these
|
||||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameTopic(
|
inline fun Message.sameTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
threadId: MessageThreadId? = chat.id.threadId
|
threadId: MessageThreadId? = chat.id.threadId
|
||||||
) = sameTopic(chat.id, threadId)
|
) = sameTopic(chat.id, threadId)
|
||||||
@@ -101,10 +101,10 @@ inline fun AccessibleMessage.sameTopic(
|
|||||||
* Thread is the same thing that topic
|
* Thread is the same thing that topic
|
||||||
*
|
*
|
||||||
* @return true in case if [this] message is from the [chat] and topic [threadId]. The same here means that these
|
* @return true in case if [this] message is from the [chat] and topic [threadId]. The same here means that these
|
||||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameThread(
|
inline fun Message.sameThread(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
threadId: MessageThreadId? = chat.id.threadId
|
threadId: MessageThreadId? = chat.id.threadId
|
||||||
) = sameThread(chat.id, threadId)
|
) = sameThread(chat.id, threadId)
|
||||||
@@ -113,16 +113,16 @@ inline fun AccessibleMessage.sameThread(
|
|||||||
* Thread is the same thing that topic
|
* Thread is the same thing that topic
|
||||||
*
|
*
|
||||||
* @return true in case if [this] message is from the same chat and topic as [other]. The same here means that these
|
* @return true in case if [this] message is from the same chat and topic as [other]. The same here means that these
|
||||||
* messages from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
* messages from one chat and have equal [Message.threadIdOrNull] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameTopic(other: AccessibleMessage) = sameTopic(other.chat, other.threadIdOrNull)
|
inline fun Message.sameTopic(other: Message) = sameTopic(other.chat, other.threadIdOrNull)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thread is the same thing that topic
|
* Thread is the same thing that topic
|
||||||
*
|
*
|
||||||
* @return true in case if [this] message is in the same topic as the [other]. The same here means that these messages
|
* @return true in case if [this] message is in the same topic as the [other]. The same here means that these messages
|
||||||
* from one chat and have equal [AccessibleMessage.threadIdOrNull] identifier
|
* from one chat and have equal [Message.threadIdOrNull] identifier
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
inline fun AccessibleMessage.sameThread(other: AccessibleMessage) = sameTopic(other)
|
inline fun Message.sameThread(other: Message) = sameTopic(other)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import dev.inmo.tgbotapi.types.location.Location
|
|||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
|
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ConnectedFromChannelGroupContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ConnectedFromChannelGroupContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
@@ -23,58 +22,58 @@ import dev.inmo.tgbotapi.types.venue.Venue
|
|||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.from: User?
|
inline val Message.from: User?
|
||||||
get() = asFromUser() ?.from
|
get() = asFromUser() ?.from
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.sender_chat: PublicChat?
|
inline val Message.sender_chat: PublicChat?
|
||||||
get() = asFromChannelGroupContentMessage() ?.senderChat
|
get() = asFromChannelGroupContentMessage() ?.senderChat
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.forward_from: User?
|
inline val Message.forward_from: User?
|
||||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asUserForwardInfo() ?.from
|
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asUserForwardInfo() ?.from
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.forward_from_chat: Chat?
|
inline val Message.forward_from_chat: Chat?
|
||||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asForwardFromPublicChatInfo() ?.chat
|
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asForwardFromPublicChatInfo() ?.chat
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.forward_from_message_id: MessageId?
|
inline val Message.forward_from_message_id: MessageId?
|
||||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.messageId
|
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.messageId
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.forward_signature: ForwardSignature?
|
inline val Message.forward_signature: ForwardSignature?
|
||||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.signature
|
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.fromChannelOrNull() ?.signature
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.forward_sender_name: ForwardSenderName?
|
inline val Message.forward_sender_name: ForwardSenderName?
|
||||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asAnonymousForwardInfo() ?.senderName
|
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.asAnonymousForwardInfo() ?.senderName
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.forward_date: TelegramDate?
|
inline val Message.forward_date: TelegramDate?
|
||||||
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.dateOfOriginal
|
get() = asPossiblyForwardedMessage() ?.forwardInfo ?.dateOfOriginal
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.is_automatic_forward: Boolean?
|
inline val Message.is_automatic_forward: Boolean?
|
||||||
get() = this is ConnectedFromChannelGroupContentMessage<*>
|
get() = this is ConnectedFromChannelGroupContentMessage<*>
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.reply_to_message: AccessibleMessage?
|
inline val Message.reply_to_message: Message?
|
||||||
get() = asPossiblyReplyMessage() ?.replyTo
|
get() = asPossiblyReplyMessage() ?.replyTo
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.via_bot: CommonBot?
|
inline val Message.via_bot: CommonBot?
|
||||||
get() = asPossiblySentViaBotCommonMessage() ?.senderBot
|
get() = asPossiblySentViaBotCommonMessage() ?.senderBot
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.edit_date: TelegramDate?
|
inline val Message.edit_date: TelegramDate?
|
||||||
get() = asPossiblyEditedMessage() ?.editDate ?.toTelegramDate()
|
get() = asPossiblyEditedMessage() ?.editDate ?.toTelegramDate()
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.has_protected_content: Boolean?
|
inline val Message.has_protected_content: Boolean?
|
||||||
get() = asContentMessage() ?.hasProtectedContent
|
get() = asContentMessage() ?.hasProtectedContent
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.media_group_id: MediaGroupIdentifier?
|
inline val Message.media_group_id: MediaGroupIdentifier?
|
||||||
get() = asMediaGroupMessage() ?.mediaGroupId
|
get() = asMediaGroupMessage() ?.mediaGroupId
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.author_signature: AuthorSignature?
|
inline val Message.author_signature: AuthorSignature?
|
||||||
get() = asSignedMessage() ?.authorSignature
|
get() = asSignedMessage() ?.authorSignature
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.text: String?
|
inline val Message.text: String?
|
||||||
get() = asContentMessage() ?.content ?.asTextContent() ?.text
|
get() = asContentMessage() ?.content ?.asTextContent() ?.text
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.entities: TextSourcesList?
|
inline val Message.entities: TextSourcesList?
|
||||||
get() = asContentMessage() ?.content ?.asTextContent() ?.textSources
|
get() = asContentMessage() ?.content ?.asTextContent() ?.textSources
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.caption: String?
|
inline val Message.caption: String?
|
||||||
get() = whenContentMessage {
|
get() = whenContentMessage {
|
||||||
if (it.content !is TextContent) {
|
if (it.content !is TextContent) {
|
||||||
it.content.asTextedInput() ?.text
|
it.content.asTextedInput() ?.text
|
||||||
@@ -83,7 +82,7 @@ inline val AccessibleMessage.caption: String?
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.caption_entities: TextSourcesList?
|
inline val Message.caption_entities: TextSourcesList?
|
||||||
get() = whenContentMessage {
|
get() = whenContentMessage {
|
||||||
if (it.content !is TextContent) {
|
if (it.content !is TextContent) {
|
||||||
it.content.asTextedInput() ?.textSources
|
it.content.asTextedInput() ?.textSources
|
||||||
@@ -92,117 +91,117 @@ inline val AccessibleMessage.caption_entities: TextSourcesList?
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.audio: AudioFile?
|
inline val Message.audio: AudioFile?
|
||||||
get() = asContentMessage() ?.content ?.asAudioContent() ?.media
|
get() = asContentMessage() ?.content ?.asAudioContent() ?.media
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.document: DocumentFile?
|
inline val Message.document: DocumentFile?
|
||||||
get() = asContentMessage() ?.content ?.asDocumentContent() ?.media
|
get() = asContentMessage() ?.content ?.asDocumentContent() ?.media
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.animation: AnimationFile?
|
inline val Message.animation: AnimationFile?
|
||||||
get() = asContentMessage() ?.content ?.asAnimationContent() ?.media
|
get() = asContentMessage() ?.content ?.asAnimationContent() ?.media
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.game: Game?
|
inline val Message.game: Game?
|
||||||
get() = asContentMessage() ?.content ?.asGameContent() ?.game
|
get() = asContentMessage() ?.content ?.asGameContent() ?.game
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.photo: Photo?
|
inline val Message.photo: Photo?
|
||||||
get() = asContentMessage() ?.content ?.asPhotoContent() ?.mediaCollection
|
get() = asContentMessage() ?.content ?.asPhotoContent() ?.mediaCollection
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.sticker: Sticker?
|
inline val Message.sticker: Sticker?
|
||||||
get() = asContentMessage() ?.content ?.asStickerContent() ?.media
|
get() = asContentMessage() ?.content ?.asStickerContent() ?.media
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.video: VideoFile?
|
inline val Message.video: VideoFile?
|
||||||
get() = asContentMessage() ?.content ?.asVideoContent() ?.media
|
get() = asContentMessage() ?.content ?.asVideoContent() ?.media
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.voice: VoiceFile?
|
inline val Message.voice: VoiceFile?
|
||||||
get() = asContentMessage() ?.content ?.asVoiceContent() ?.media
|
get() = asContentMessage() ?.content ?.asVoiceContent() ?.media
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.video_note: VideoNoteFile?
|
inline val Message.video_note: VideoNoteFile?
|
||||||
get() = asContentMessage() ?.content ?.asVideoNoteContent() ?.media
|
get() = asContentMessage() ?.content ?.asVideoNoteContent() ?.media
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.contact: Contact?
|
inline val Message.contact: Contact?
|
||||||
get() = asContentMessage() ?.content ?.asContactContent() ?.contact
|
get() = asContentMessage() ?.content ?.asContactContent() ?.contact
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.location: Location?
|
inline val Message.location: Location?
|
||||||
get() = asContentMessage() ?.content ?.asLocationContent() ?.location
|
get() = asContentMessage() ?.content ?.asLocationContent() ?.location
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.venue: Venue?
|
inline val Message.venue: Venue?
|
||||||
get() = asContentMessage() ?.content ?.asVenueContent() ?.venue
|
get() = asContentMessage() ?.content ?.asVenueContent() ?.venue
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.poll: Poll?
|
inline val Message.poll: Poll?
|
||||||
get() = asContentMessage() ?.content ?.asPollContent() ?.poll
|
get() = asContentMessage() ?.content ?.asPollContent() ?.poll
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.invoice: Invoice?
|
inline val Message.invoice: Invoice?
|
||||||
get() = asContentMessage() ?.content ?.asInvoiceContent() ?.invoice
|
get() = asContentMessage() ?.content ?.asInvoiceContent() ?.invoice
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.dice: Dice?
|
inline val Message.dice: Dice?
|
||||||
get() = asContentMessage() ?.content ?.asDiceContent() ?.dice
|
get() = asContentMessage() ?.content ?.asDiceContent() ?.dice
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.new_chat_members: List<User>?
|
inline val Message.new_chat_members: List<User>?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asNewChatMembers() ?.members
|
get() = asChatEventMessage() ?.chatEvent ?.asNewChatMembers() ?.members
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.left_chat_member: User?
|
inline val Message.left_chat_member: User?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asLeftChatMember() ?.user
|
get() = asChatEventMessage() ?.chatEvent ?.asLeftChatMember() ?.user
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.new_chat_title: String?
|
inline val Message.new_chat_title: String?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asNewChatTitle() ?.title
|
get() = asChatEventMessage() ?.chatEvent ?.asNewChatTitle() ?.title
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.new_chat_photo: Photo?
|
inline val Message.new_chat_photo: Photo?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asNewChatPhoto() ?.photo
|
get() = asChatEventMessage() ?.chatEvent ?.asNewChatPhoto() ?.photo
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.delete_chat_photo: Boolean
|
inline val Message.delete_chat_photo: Boolean
|
||||||
get() = asChatEventMessage() ?.chatEvent is DeleteChatPhoto
|
get() = asChatEventMessage() ?.chatEvent is DeleteChatPhoto
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.group_chat_created: Boolean
|
inline val Message.group_chat_created: Boolean
|
||||||
get() = asChatEventMessage() ?.chatEvent is GroupChatCreated
|
get() = asChatEventMessage() ?.chatEvent is GroupChatCreated
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.supergroup_chat_created: Boolean
|
inline val Message.supergroup_chat_created: Boolean
|
||||||
get() = asChatEventMessage() ?.chatEvent is SupergroupChatCreated
|
get() = asChatEventMessage() ?.chatEvent is SupergroupChatCreated
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.channel_chat_created: Boolean
|
inline val Message.channel_chat_created: Boolean
|
||||||
get() = asChatEventMessage() ?.chatEvent is ChannelChatCreated
|
get() = asChatEventMessage() ?.chatEvent is ChannelChatCreated
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.migrate_to_chat_id: IdChatIdentifier?
|
inline val Message.migrate_to_chat_id: IdChatIdentifier?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asGroupChatCreated() ?.migratedTo
|
get() = asChatEventMessage() ?.chatEvent ?.asGroupChatCreated() ?.migratedTo
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.migrate_from_chat_id: IdChatIdentifier?
|
inline val Message.migrate_from_chat_id: IdChatIdentifier?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.let {
|
get() = asChatEventMessage() ?.chatEvent ?.let {
|
||||||
it ?.asSupergroupChatCreated() ?.migratedFrom ?: it ?.asMigratedToSupergroup() ?.migratedFrom
|
it ?.asSupergroupChatCreated() ?.migratedFrom ?: it ?.asMigratedToSupergroup() ?.migratedFrom
|
||||||
}
|
}
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.pinned_message: Message?
|
inline val Message.pinned_message: Message?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asPinnedMessage() ?.message
|
get() = asChatEventMessage() ?.chatEvent ?.asPinnedMessage() ?.message
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.successful_payment: SuccessfulPayment?
|
inline val Message.successful_payment: SuccessfulPayment?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asSuccessfulPaymentEvent() ?.payment
|
get() = asChatEventMessage() ?.chatEvent ?.asSuccessfulPaymentEvent() ?.payment
|
||||||
|
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.video_chat_scheduled: VideoChatScheduled?
|
inline val Message.video_chat_scheduled: VideoChatScheduled?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatScheduled()
|
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatScheduled()
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.video_chat_started: VideoChatStarted?
|
inline val Message.video_chat_started: VideoChatStarted?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatStarted()
|
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatStarted()
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.video_chat_ended: VideoChatEnded?
|
inline val Message.video_chat_ended: VideoChatEnded?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatEnded()
|
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatEnded()
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.video_chat_participants_invited: VideoChatParticipantsInvited?
|
inline val Message.video_chat_participants_invited: VideoChatParticipantsInvited?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatParticipantsInvited()
|
get() = asChatEventMessage() ?.chatEvent ?.asVideoChatParticipantsInvited()
|
||||||
|
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged?
|
inline val Message.message_auto_delete_timer_changed: MessageAutoDeleteTimerChanged?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asMessageAutoDeleteTimerChanged()
|
get() = asChatEventMessage() ?.chatEvent ?.asMessageAutoDeleteTimerChanged()
|
||||||
|
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.connected_website: String?
|
inline val Message.connected_website: String?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asUserLoggedIn() ?.domain
|
get() = asChatEventMessage() ?.chatEvent ?.asUserLoggedIn() ?.domain
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.proximity_alert_triggered: ProximityAlertTriggered?
|
inline val Message.proximity_alert_triggered: ProximityAlertTriggered?
|
||||||
get() = asChatEventMessage() ?.chatEvent ?.asProximityAlertTriggered()
|
get() = asChatEventMessage() ?.chatEvent ?.asProximityAlertTriggered()
|
||||||
|
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.passport_data: PassportData?
|
inline val Message.passport_data: PassportData?
|
||||||
get() = asPassportMessage() ?.passportData
|
get() = asPassportMessage() ?.passportData
|
||||||
|
|
||||||
@RiskFeature(RawFieldsUsageWarning)
|
@RiskFeature(RawFieldsUsageWarning)
|
||||||
inline val AccessibleMessage.reply_markup: InlineKeyboardMarkup?
|
inline val Message.reply_markup: InlineKeyboardMarkup?
|
||||||
get() = asCommonMessage() ?.replyMarkup
|
get() = asCommonMessage() ?.replyMarkup
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.formatting
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.*
|
import dev.inmo.tgbotapi.types.chat.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.link
|
import dev.inmo.tgbotapi.types.message.textsources.link
|
||||||
import io.ktor.http.encodeURLQueryComponent
|
import io.ktor.http.encodeURLQueryComponent
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ fun makeLinkToMessage(
|
|||||||
): String = makeLinkToMessage(chatId.chatId, messageId, chatId.threadId)
|
): String = makeLinkToMessage(chatId.chatId, messageId, chatId.threadId)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Link which can be used as by any user to get access to [AccessibleMessage]. Returns null in case when there are no
|
* Link which can be used as by any user to get access to [Message]. Returns null in case when there are no
|
||||||
* known way to build link (for [PrivateChat]s, for example)
|
* known way to build link (for [PrivateChat]s, for example)
|
||||||
*/
|
*/
|
||||||
fun makeLinkToMessage(
|
fun makeLinkToMessage(
|
||||||
@@ -88,7 +88,7 @@ fun makeLinkToMessage(
|
|||||||
/**
|
/**
|
||||||
* @see makeLinkToMessage
|
* @see makeLinkToMessage
|
||||||
*/
|
*/
|
||||||
val AccessibleMessage.messageLink: String?
|
val Message.messageLink: String?
|
||||||
get() = makeLinkToMessage(
|
get() = makeLinkToMessage(
|
||||||
chat,
|
chat,
|
||||||
messageId
|
messageId
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.utils.types.buttons
|
|||||||
import dev.inmo.tgbotapi.types.buttons.*
|
import dev.inmo.tgbotapi.types.buttons.*
|
||||||
import dev.inmo.tgbotapi.types.buttons.reply.requestChatReplyButton
|
import dev.inmo.tgbotapi.types.buttons.reply.requestChatReplyButton
|
||||||
import dev.inmo.tgbotapi.types.buttons.reply.requestUserReplyButton
|
import dev.inmo.tgbotapi.types.buttons.reply.requestUserReplyButton
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.reply.requestUsersReplyButton
|
||||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||||
import dev.inmo.tgbotapi.types.keyboardButtonRequestUserLimit
|
import dev.inmo.tgbotapi.types.keyboardButtonRequestUserLimit
|
||||||
import dev.inmo.tgbotapi.types.request.RequestId
|
import dev.inmo.tgbotapi.types.request.RequestId
|
||||||
@@ -142,7 +143,7 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton(
|
|||||||
text: String,
|
text: String,
|
||||||
requestUser: KeyboardButtonRequestUsers
|
requestUser: KeyboardButtonRequestUsers
|
||||||
) = add(
|
) = add(
|
||||||
requestUserReplyButton(
|
requestUsersReplyButton(
|
||||||
text,
|
text,
|
||||||
requestUser
|
requestUser
|
||||||
)
|
)
|
||||||
@@ -169,7 +170,7 @@ inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
|||||||
inline fun ReplyKeyboardRowBuilder.requestBotsButton(
|
inline fun ReplyKeyboardRowBuilder.requestBotsButton(
|
||||||
text: String,
|
text: String,
|
||||||
requestId: RequestId,
|
requestId: RequestId,
|
||||||
maxCount: Int
|
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
) = requestUsersButton(
|
) = requestUsersButton(
|
||||||
text,
|
text,
|
||||||
KeyboardButtonRequestUsers.Bot(requestId, maxCount)
|
KeyboardButtonRequestUsers.Bot(requestId, maxCount)
|
||||||
@@ -200,7 +201,7 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton(
|
|||||||
text: String,
|
text: String,
|
||||||
requestId: RequestId,
|
requestId: RequestId,
|
||||||
premiumUser: Boolean? = null,
|
premiumUser: Boolean? = null,
|
||||||
maxCount: Int
|
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
) = requestUsersButton(
|
) = requestUsersButton(
|
||||||
text,
|
text,
|
||||||
KeyboardButtonRequestUsers.Common(requestId, premiumUser, maxCount)
|
KeyboardButtonRequestUsers.Common(requestId, premiumUser, maxCount)
|
||||||
@@ -227,10 +228,11 @@ inline fun ReplyKeyboardRowBuilder.requestUserButton(
|
|||||||
inline fun ReplyKeyboardRowBuilder.requestUsersOrBotsButton(
|
inline fun ReplyKeyboardRowBuilder.requestUsersOrBotsButton(
|
||||||
text: String,
|
text: String,
|
||||||
requestId: RequestId,
|
requestId: RequestId,
|
||||||
maxCount: Int
|
premiumUser: Boolean? = null,
|
||||||
|
maxCount: Int = keyboardButtonRequestUserLimit.first
|
||||||
) = requestUsersButton(
|
) = requestUsersButton(
|
||||||
text,
|
text,
|
||||||
KeyboardButtonRequestUsers.Any(requestId, maxCount)
|
KeyboardButtonRequestUsers.Any(requestId, premiumUser, maxCount)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.utils.updates
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.*
|
import dev.inmo.tgbotapi.extensions.utils.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
|
import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
|
||||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
@@ -58,10 +58,10 @@ fun CommonMessage<*>.hasNoCommands(): Boolean = !this.hasCommands()
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @return true if this [AccessibleMessage] is from forum ([threadIdOrNull] is not null). False otherwise.
|
* @return true if this [Message] is from forum ([threadIdOrNull] is not null). False otherwise.
|
||||||
* @see notForumMessage
|
* @see notForumMessage
|
||||||
*/
|
*/
|
||||||
fun AccessibleMessage.forumMessage(): Boolean = threadIdOrNull != null
|
fun Message.forumMessage(): Boolean = threadIdOrNull != null
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A predicate to test that message has not been sent in the forum.
|
* A predicate to test that message has not been sent in the forum.
|
||||||
@@ -76,7 +76,7 @@ fun AccessibleMessage.forumMessage(): Boolean = threadIdOrNull != null
|
|||||||
* }
|
* }
|
||||||
* ```
|
* ```
|
||||||
*
|
*
|
||||||
* @return true if this [AccessibleMessage] is not from forum ([threadIdOrNull] is not null). False otherwise.
|
* @return true if this [Message] is not from forum ([threadIdOrNull] is not null). False otherwise.
|
||||||
* @see forumMessage
|
* @see forumMessage
|
||||||
*/
|
*/
|
||||||
fun AccessibleMessage.notForumMessage(): Boolean = !forumMessage()
|
fun Message.notForumMessage(): Boolean = !forumMessage()
|
||||||
|
|||||||
Reference in New Issue
Block a user