mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 12:00:18 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf46139bef | |||
| 14a583e154 | |||
| 5b6753c484 | |||
| f153b31464 | |||
| 6f60ecbf2e | |||
| 9c57ba4da7 | |||
| d84d982eb4 | |||
|
|
2f6f40362a | ||
| e15b18fbcf | |||
| ad5cc6ade6 | |||
| 6b94215a7c | |||
| 9c98411bcb | |||
| b235ab1c28 | |||
| d4e11494e8 | |||
| e6dbf2bde9 | |||
| 5aa0284f28 | |||
| 8b2a50a21f | |||
| a7839df748 | |||
| 3155969954 | |||
| 067a0bf229 | |||
| 009991fa88 |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,5 +1,22 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 8.1.0
|
||||
|
||||
**PARTIALLY BREAKING CHANGES: Exclude `.*Impl` classcasts from `ClassCastsNew`**
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.19.2` -> `0.19.4`
|
||||
* `Utils`:
|
||||
* Add deep links formatting for internal `tg://` prefix (thanks to [@klimatov](https://github.com/klimatov))
|
||||
* Exclude `.*Impl` classcasts from `ClassCastsNew`
|
||||
|
||||
## 8.0.1
|
||||
|
||||
* `Version`:
|
||||
* `UUID`: `0.7.0` -> `0.7.1`
|
||||
* `Ktor`: `2.3.0` -> `2.3.1`
|
||||
* `MicroUtils`: `0.19.1` -> `0.19.2`
|
||||
|
||||
## 8.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#april-21-2023)
|
||||
|
||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||
| Useful repos | [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) |
|
||||
| Misc | [](https://github.com/KotlinBy/awesome-kotlin) [](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) |
|
||||
|
||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=8.0.0
|
||||
library_version=8.1.0
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
[versions]
|
||||
|
||||
kotlin = "1.8.21"
|
||||
kotlin = "1.8.22"
|
||||
kotlin-serialization = "1.5.1"
|
||||
kotlin-coroutines = "1.6.4"
|
||||
|
||||
javax-activation = "1.1.1"
|
||||
|
||||
korlibs = "4.0.3"
|
||||
uuid = "0.7.0"
|
||||
ktor = "2.3.0"
|
||||
uuid = "0.7.1"
|
||||
ktor = "2.3.1"
|
||||
|
||||
ksp = "1.8.21-1.0.11"
|
||||
ksp = "1.8.22-1.0.11"
|
||||
kotlin-poet = "1.14.2"
|
||||
|
||||
microutils = "0.19.1"
|
||||
microutils = "0.19.4"
|
||||
|
||||
github-release-plugin = "2.4.1"
|
||||
dokka = "1.8.10"
|
||||
dokka = "1.8.20"
|
||||
|
||||
[libraries]
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.User
|
||||
*
|
||||
* @see FromUser
|
||||
*/
|
||||
@ClassCastsIncluded
|
||||
@ClassCastsIncluded(excludeRegex = ".*Impl")
|
||||
interface WithUser {
|
||||
val user: User
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable(InlineQueryResultSerializer::class)
|
||||
@ClassCastsIncluded
|
||||
@ClassCastsIncluded(excludeRegex = ".*Impl")
|
||||
interface InlineQueryResult {
|
||||
val type: String
|
||||
val id: InlineQueryIdentifier
|
||||
|
||||
@@ -5,20 +5,14 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
|
||||
import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
|
||||
/**
|
||||
* Creates and put [PayInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [PayInlineKeyboardButton]
|
||||
*/
|
||||
inline fun payInlineButton(
|
||||
text: String
|
||||
) = PayInlineKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [CallbackDataInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [CallbackDataInlineKeyboardButton]
|
||||
*/
|
||||
inline fun dataInlineButton(
|
||||
text: String,
|
||||
@@ -26,20 +20,14 @@ inline fun dataInlineButton(
|
||||
) = CallbackDataInlineKeyboardButton(text, data)
|
||||
|
||||
/**
|
||||
* Creates and put [CallbackGameInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [CallbackGameInlineKeyboardButton]
|
||||
*/
|
||||
inline fun gameInlineButton(
|
||||
text: String
|
||||
) = CallbackGameInlineKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [LoginURLInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [LoginURLInlineKeyboardButton]
|
||||
*/
|
||||
inline fun loginInlineButton(
|
||||
text: String,
|
||||
@@ -47,10 +35,7 @@ inline fun loginInlineButton(
|
||||
) = LoginURLInlineKeyboardButton(text, loginUrl)
|
||||
|
||||
/**
|
||||
* Creates and put [SwitchInlineQueryCurrentChatInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [SwitchInlineQueryCurrentChatInlineKeyboardButton]
|
||||
*/
|
||||
inline fun inlineQueryInCurrentChatInlineButton(
|
||||
text: String,
|
||||
@@ -58,10 +43,7 @@ inline fun inlineQueryInCurrentChatInlineButton(
|
||||
) = SwitchInlineQueryCurrentChatInlineKeyboardButton(text, data)
|
||||
|
||||
/**
|
||||
* Creates and put [SwitchInlineQueryChosenChatInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [SwitchInlineQueryChosenChatInlineKeyboardButton]
|
||||
*/
|
||||
inline fun inlineQueryInCurrentChatInlineButton(
|
||||
text: String,
|
||||
@@ -69,10 +51,7 @@ inline fun inlineQueryInCurrentChatInlineButton(
|
||||
) = SwitchInlineQueryChosenChatInlineKeyboardButton(text, parameters)
|
||||
|
||||
/**
|
||||
* Creates and put [SwitchInlineQueryChosenChatInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [SwitchInlineQueryChosenChatInlineKeyboardButton]
|
||||
*/
|
||||
inline fun inlineQueryInCurrentChatInlineButton(
|
||||
text: String,
|
||||
@@ -93,10 +72,7 @@ inline fun inlineQueryInCurrentChatInlineButton(
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [SwitchInlineQueryChosenChatInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [SwitchInlineQueryChosenChatInlineKeyboardButton]
|
||||
*/
|
||||
inline fun inlineQueryInAnyCurrentChatInlineButton(
|
||||
text: String,
|
||||
@@ -104,10 +80,7 @@ inline fun inlineQueryInAnyCurrentChatInlineButton(
|
||||
) = inlineQueryInCurrentChatInlineButton(text, query, allowUsers = true, allowBots = true, allowGroups = true, allowChannels = true)
|
||||
|
||||
/**
|
||||
* Creates and put [SwitchInlineQueryInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [SwitchInlineQueryInlineKeyboardButton]
|
||||
*/
|
||||
inline fun inlineQueryInlineButton(
|
||||
text: String,
|
||||
@@ -115,10 +88,7 @@ inline fun inlineQueryInlineButton(
|
||||
) = SwitchInlineQueryInlineKeyboardButton(text, data)
|
||||
|
||||
/**
|
||||
* Creates and put [URLInlineKeyboardButton]
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [URLInlineKeyboardButton]
|
||||
*/
|
||||
inline fun urlInlineButton(
|
||||
text: String,
|
||||
@@ -126,10 +96,7 @@ inline fun urlInlineButton(
|
||||
) = URLInlineKeyboardButton(text, url)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only
|
||||
*/
|
||||
inline fun webAppInlineButton(
|
||||
text: String,
|
||||
@@ -137,10 +104,7 @@ inline fun webAppInlineButton(
|
||||
) = WebAppInlineKeyboardButton(text, webApp)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only
|
||||
*
|
||||
* @see inlineKeyboard
|
||||
* @see InlineKeyboardBuilder.row
|
||||
* Creates [WebAppInlineKeyboardButton]. Please, remember that this button is available in private chats only
|
||||
*/
|
||||
inline fun webAppInlineButton(
|
||||
text: String,
|
||||
|
||||
@@ -8,40 +8,28 @@ import dev.inmo.tgbotapi.types.webapps.WebAppInfo
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [SimpleKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [SimpleKeyboardButton]
|
||||
*/
|
||||
inline fun simpleReplyButton(
|
||||
text: String
|
||||
) = SimpleKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestContactKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestContactKeyboardButton]
|
||||
*/
|
||||
inline fun requestContactReplyButton(
|
||||
text: String
|
||||
) = RequestContactKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestLocationKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestLocationKeyboardButton]
|
||||
*/
|
||||
inline fun requestLocationReplyButton(
|
||||
text: String
|
||||
) = RequestLocationKeyboardButton(text)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestPollKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestPollKeyboardButton]
|
||||
*/
|
||||
inline fun requestPollReplyButton(
|
||||
text: String,
|
||||
@@ -49,10 +37,7 @@ inline fun requestPollReplyButton(
|
||||
) = RequestPollKeyboardButton(text, pollType)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [WebAppKeyboardButton]
|
||||
*/
|
||||
inline fun webAppReplyButton(
|
||||
text: String,
|
||||
@@ -60,10 +45,7 @@ inline fun webAppReplyButton(
|
||||
) = WebAppKeyboardButton(text, webApp)
|
||||
|
||||
/**
|
||||
* Creates and put [WebAppKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [WebAppKeyboardButton]
|
||||
*/
|
||||
inline fun webAppReplyButton(
|
||||
text: String,
|
||||
@@ -72,10 +54,7 @@ inline fun webAppReplyButton(
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestUserKeyboardButton]
|
||||
*/
|
||||
inline fun requestUserReplyButton(
|
||||
text: String,
|
||||
@@ -86,10 +65,7 @@ inline fun requestUserReplyButton(
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Bot]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Bot]
|
||||
*/
|
||||
inline fun requestBotReplyButton(
|
||||
text: String,
|
||||
@@ -100,10 +76,7 @@ inline fun requestBotReplyButton(
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Common]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Common]
|
||||
*/
|
||||
inline fun requestUserReplyButton(
|
||||
text: String,
|
||||
@@ -115,10 +88,7 @@ inline fun requestUserReplyButton(
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Any]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUser.Any]
|
||||
*/
|
||||
inline fun requestUserOrBotReplyButton(
|
||||
text: String,
|
||||
@@ -130,10 +100,7 @@ inline fun requestUserOrBotReplyButton(
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestChatKeyboardButton]
|
||||
*/
|
||||
inline fun requestChatReplyButton(
|
||||
text: String,
|
||||
@@ -144,10 +111,7 @@ inline fun requestChatReplyButton(
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestChatKeyboardButton] with [KeyboardButtonRequestChat]
|
||||
*/
|
||||
inline fun requestChatReplyButton(
|
||||
text: String,
|
||||
@@ -174,10 +138,7 @@ inline fun requestChatReplyButton(
|
||||
)
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Channel]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Channel]
|
||||
*/
|
||||
inline fun requestChannelReplyButton(
|
||||
text: String,
|
||||
@@ -201,10 +162,7 @@ inline fun requestChannelReplyButton(
|
||||
|
||||
|
||||
/**
|
||||
* Creates and put [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Group]
|
||||
*
|
||||
* @see replyKeyboard
|
||||
* @see ReplyKeyboardBuilder.row
|
||||
* Creates [RequestChatKeyboardButton] with [KeyboardButtonRequestChat.Group]
|
||||
*/
|
||||
inline fun requestChannelReplyButton(
|
||||
text: String,
|
||||
|
||||
@@ -49,7 +49,7 @@ sealed interface AbleToAddInAttachmentMenuChat : Chat {
|
||||
}
|
||||
|
||||
@Serializable(PreviewChatSerializer::class)
|
||||
@ClassCastsIncluded
|
||||
@ClassCastsIncluded(excludeRegex = ".*Impl")
|
||||
sealed interface Chat {
|
||||
val id: IdChatIdentifier
|
||||
}
|
||||
|
||||
@@ -3,11 +3,13 @@ package dev.inmo.tgbotapi.types.chat
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializer
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use ExtendedChannelChat due")
|
||||
data class ExtendedChannelChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: ChatId,
|
||||
@@ -33,6 +35,7 @@ data class ExtendedChannelChatImpl(
|
||||
) : ExtendedChannelChat
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use ExtendedGroupChat due")
|
||||
data class ExtendedGroupChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: ChatId,
|
||||
@@ -54,6 +57,7 @@ data class ExtendedGroupChatImpl(
|
||||
) : ExtendedGroupChat
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use ExtendedPrivateChat due")
|
||||
data class ExtendedPrivateChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: UserId,
|
||||
@@ -80,6 +84,7 @@ data class ExtendedPrivateChatImpl(
|
||||
typealias ExtendedUser = ExtendedPrivateChatImpl
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use ExtendedSupergroupChat due")
|
||||
data class ExtendedSupergroupChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: ChatId,
|
||||
@@ -121,6 +126,7 @@ data class ExtendedSupergroupChatImpl(
|
||||
) : ExtendedSupergroupChat
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use ExtendedForumChat due")
|
||||
data class ExtendedForumChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: IdChatIdentifier,
|
||||
|
||||
@@ -4,10 +4,12 @@ import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use GroupChat due")
|
||||
data class GroupChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: ChatId,
|
||||
@@ -16,6 +18,7 @@ data class GroupChatImpl(
|
||||
) : GroupChat
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use PrivateChat due")
|
||||
data class PrivateChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: UserId,
|
||||
@@ -28,6 +31,7 @@ data class PrivateChatImpl(
|
||||
) : PrivateChat
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use SupergroupChat due")
|
||||
data class SupergroupChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: ChatId,
|
||||
@@ -38,6 +42,7 @@ data class SupergroupChatImpl(
|
||||
) : SupergroupChat
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use ForumChat due")
|
||||
data class ForumChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: IdChatIdentifier,
|
||||
@@ -48,6 +53,7 @@ data class ForumChatImpl(
|
||||
) : ForumChat
|
||||
|
||||
@Serializable
|
||||
@RiskFeature("This class is a subject of changes. It is better to use ChannelChat due")
|
||||
data class ChannelChatImpl(
|
||||
@SerialName(idField)
|
||||
override val id: ChatId,
|
||||
|
||||
@@ -11,7 +11,7 @@ import kotlinx.serialization.descriptors.*
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.encoding.Encoder
|
||||
|
||||
@ClassCastsIncluded
|
||||
@ClassCastsIncluded(excludeRegex = ".*Impl")
|
||||
interface Message : WithChat {
|
||||
val messageId: MessageId
|
||||
val date: DateTime
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
package dev.inmo.tgbotapi.utils.internal
|
||||
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
internal annotation class ClassCastsIncluded
|
||||
@RiskFeature("It is internal API in tgbotapi.core and should not be used outside")
|
||||
annotation class ClassCastsIncluded(val typesRegex: String = "", val excludeRegex: String = "")
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
@RiskFeature("It is internal API in tgbotapi.core and should not be used outside")
|
||||
annotation class ClassCastsExcluded
|
||||
|
||||
@@ -9,4 +9,5 @@ repositories {
|
||||
dependencies {
|
||||
implementation libs.kotlin.poet
|
||||
implementation libs.ksp
|
||||
implementation project(":tgbotapi.core")
|
||||
}
|
||||
|
||||
@@ -1,12 +1,21 @@
|
||||
package dev.inmo.tgbotapi.ksp.processor
|
||||
|
||||
import com.google.devtools.ksp.KspExperimental
|
||||
import com.google.devtools.ksp.getAllSuperTypes
|
||||
import com.google.devtools.ksp.getAnnotationsByType
|
||||
import com.google.devtools.ksp.isAnnotationPresent
|
||||
import com.google.devtools.ksp.processing.*
|
||||
import com.google.devtools.ksp.symbol.KSAnnotated
|
||||
import com.google.devtools.ksp.symbol.KSClassDeclaration
|
||||
import com.squareup.kotlinpoet.AnnotationSpec
|
||||
import com.squareup.kotlinpoet.ClassName
|
||||
import com.squareup.kotlinpoet.FileSpec
|
||||
import com.squareup.kotlinpoet.asClassName
|
||||
import com.squareup.kotlinpoet.ksp.toClassName
|
||||
import com.squareup.kotlinpoet.ksp.writeTo
|
||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsExcluded
|
||||
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
|
||||
import java.io.File
|
||||
|
||||
class TelegramBotAPISymbolProcessor(
|
||||
@@ -15,24 +24,51 @@ class TelegramBotAPISymbolProcessor(
|
||||
private val outputFile: String = "Output",
|
||||
private val outputFolder: String? = null
|
||||
) : SymbolProcessor {
|
||||
private val classCastsIncludedClassName = ClassCastsIncluded::class.asClassName()
|
||||
@OptIn(KspExperimental::class, RiskFeature::class)
|
||||
override fun process(resolver: Resolver): List<KSAnnotated> {
|
||||
val classes = resolver.getSymbolsWithAnnotation("dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded").filterIsInstance<KSClassDeclaration>()
|
||||
val classes = resolver.getSymbolsWithAnnotation(classCastsIncludedClassName.canonicalName).filterIsInstance<KSClassDeclaration>()
|
||||
val classesRegexes: Map<KSClassDeclaration, Pair<Regex?, Regex?>> = classes.mapNotNull {
|
||||
it to (it.getAnnotationsByType(ClassCastsIncluded::class).firstNotNullOfOrNull {
|
||||
it.typesRegex.takeIf { it.isNotEmpty() } ?.let(::Regex) to it.excludeRegex.takeIf { it.isNotEmpty() } ?.let(::Regex)
|
||||
} ?: return@mapNotNull null)
|
||||
}.toMap()
|
||||
val classesSubtypes = mutableMapOf<KSClassDeclaration, MutableSet<KSClassDeclaration>>()
|
||||
|
||||
resolver.getAllFiles().forEach {
|
||||
it.declarations.forEach { potentialSubtype ->
|
||||
if (potentialSubtype is KSClassDeclaration) {
|
||||
if (
|
||||
potentialSubtype is KSClassDeclaration
|
||||
&& potentialSubtype.isAnnotationPresent(ClassCastsExcluded::class).not()
|
||||
) {
|
||||
val allSupertypes = potentialSubtype.getAllSuperTypes().map { it.declaration }
|
||||
classes.forEach {
|
||||
if (it in allSupertypes) {
|
||||
classesSubtypes.getOrPut(it) { mutableSetOf() }.add(potentialSubtype)
|
||||
|
||||
for (currentClass in classes) {
|
||||
val regexes = classesRegexes[currentClass]
|
||||
val simpleName = potentialSubtype.simpleName.getShortName()
|
||||
when {
|
||||
currentClass !in allSupertypes
|
||||
|| regexes ?.first ?.matches(simpleName) == false
|
||||
|| regexes ?.second ?.matches(simpleName) == true -> continue
|
||||
else -> {
|
||||
classesSubtypes.getOrPut(currentClass) { mutableSetOf() }.add(potentialSubtype)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fun fillWithSealeds(source: KSClassDeclaration, current: KSClassDeclaration = source) {
|
||||
val regexes = classesRegexes[source]
|
||||
current.getSealedSubclasses().forEach {
|
||||
val simpleName = it.simpleName.getShortName()
|
||||
if (
|
||||
regexes ?.first ?.matches(simpleName) == false
|
||||
|| regexes ?.second ?.matches(simpleName) == true
|
||||
|| it.isAnnotationPresent(ClassCastsExcluded::class)
|
||||
) {
|
||||
return@forEach
|
||||
}
|
||||
classesSubtypes.getOrPut(source) { mutableSetOf() }.add(it)
|
||||
fillWithSealeds(source, it)
|
||||
}
|
||||
|
||||
@@ -28,25 +28,11 @@ import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.BaseChosenInline
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.ChosenInlineResult
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.LocationChosenInlineResult
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultArticle
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioCachedImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentCachedImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifCachedImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifCachedImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoCachedImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVenue
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoCachedImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceCachedImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceImpl
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.FileInlineQueryResult
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
@@ -124,50 +110,37 @@ import dev.inmo.tgbotapi.types.buttons.ReplyKeyboardRemove
|
||||
import dev.inmo.tgbotapi.types.chat.AbleToAddInAttachmentMenuChat
|
||||
import dev.inmo.tgbotapi.types.chat.Bot
|
||||
import dev.inmo.tgbotapi.types.chat.ChannelChat
|
||||
import dev.inmo.tgbotapi.types.chat.ChannelChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
||||
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedBot
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedChat
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedChatWithUsername
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedForumChat
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.ForumChat
|
||||
import dev.inmo.tgbotapi.types.chat.ForumChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.GroupChat
|
||||
import dev.inmo.tgbotapi.types.chat.GroupChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.PossiblyPremiumChat
|
||||
import dev.inmo.tgbotapi.types.chat.PrivateChat
|
||||
import dev.inmo.tgbotapi.types.chat.PrivateChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.SuperPublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.SupergroupChat
|
||||
import dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
|
||||
import dev.inmo.tgbotapi.types.chat.UnknownChatType
|
||||
import dev.inmo.tgbotapi.types.chat.UnknownExtendedChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.chat.UsernameChat
|
||||
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMemberImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.BannedChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
|
||||
import dev.inmo.tgbotapi.types.chat.member.KickedChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.LeftChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.LeftChatMemberImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.MemberChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.MemberChatMemberImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.OwnerChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.RestrictedChatMember
|
||||
import dev.inmo.tgbotapi.types.chat.member.SpecialRightsChatMember
|
||||
@@ -228,9 +201,6 @@ import dev.inmo.tgbotapi.types.media.TelegramMediaVideo
|
||||
import dev.inmo.tgbotapi.types.media.ThumbedTelegramMedia
|
||||
import dev.inmo.tgbotapi.types.media.TitledTelegramMedia
|
||||
import dev.inmo.tgbotapi.types.media.VisualMediaGroupMemberTelegramMedia
|
||||
import dev.inmo.tgbotapi.types.message.AnonymousForumContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.AnonymousGroupContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.ChannelContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.ChannelChatCreated
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.DeleteChatPhoto
|
||||
@@ -266,17 +236,11 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatEnded
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatParticipantsInvited
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatScheduled
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.VideoChatStarted
|
||||
import dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.CommonGroupEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.CommonSupergroupEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.ConnectedFromChannelGroupContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.ForwardInfo
|
||||
import dev.inmo.tgbotapi.types.message.FromChannelForumContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.PassportMessage
|
||||
import dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.PrivateEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.UnconnectedFromChannelGroupContentMessageImpl
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousForumContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AnonymousGroupContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage
|
||||
@@ -635,16 +599,6 @@ public inline fun WithUser.administratorChatMemberOrThrow(): AdministratorChatMe
|
||||
public inline fun <T> WithUser.ifAdministratorChatMember(block: (AdministratorChatMember) -> T): T?
|
||||
= administratorChatMemberOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.administratorChatMemberImplOrNull(): AdministratorChatMemberImpl? = this
|
||||
as? dev.inmo.tgbotapi.types.chat.member.AdministratorChatMemberImpl
|
||||
|
||||
public inline fun WithUser.administratorChatMemberImplOrThrow(): AdministratorChatMemberImpl = this
|
||||
as dev.inmo.tgbotapi.types.chat.member.AdministratorChatMemberImpl
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifAdministratorChatMemberImpl(block: (AdministratorChatMemberImpl) -> T): T? =
|
||||
administratorChatMemberImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.bannedChatMemberOrNull(): BannedChatMember? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.member.BannedChatMember
|
||||
|
||||
@@ -690,15 +644,6 @@ public inline fun WithUser.leftChatMemberOrThrow(): LeftChatMember = this as
|
||||
public inline fun <T> WithUser.ifLeftChatMember(block: (LeftChatMember) -> T): T? =
|
||||
leftChatMemberOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.leftChatMemberImplOrNull(): LeftChatMemberImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.member.LeftChatMemberImpl
|
||||
|
||||
public inline fun WithUser.leftChatMemberImplOrThrow(): LeftChatMemberImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.member.LeftChatMemberImpl
|
||||
|
||||
public inline fun <T> WithUser.ifLeftChatMemberImpl(block: (LeftChatMemberImpl) -> T): T? =
|
||||
leftChatMemberImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.memberChatMemberOrNull(): MemberChatMember? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.member.MemberChatMember
|
||||
|
||||
@@ -708,15 +653,6 @@ public inline fun WithUser.memberChatMemberOrThrow(): MemberChatMember = this as
|
||||
public inline fun <T> WithUser.ifMemberChatMember(block: (MemberChatMember) -> T): T? =
|
||||
memberChatMemberOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.memberChatMemberImplOrNull(): MemberChatMemberImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.member.MemberChatMemberImpl
|
||||
|
||||
public inline fun WithUser.memberChatMemberImplOrThrow(): MemberChatMemberImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.member.MemberChatMemberImpl
|
||||
|
||||
public inline fun <T> WithUser.ifMemberChatMemberImpl(block: (MemberChatMemberImpl) -> T): T? =
|
||||
memberChatMemberImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.ownerChatMemberOrNull(): OwnerChatMember? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.member.OwnerChatMember
|
||||
|
||||
@@ -777,30 +713,6 @@ public inline fun <T>
|
||||
WithUser.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T):
|
||||
T? = commonSupergroupEventMessageOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.commonGroupContentMessageImplOrNull():
|
||||
CommonGroupContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun WithUser.commonGroupContentMessageImplOrThrow():
|
||||
CommonGroupContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifCommonGroupContentMessageImpl(block: (CommonGroupContentMessageImpl<MessageContent>) -> T):
|
||||
T? = commonGroupContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.commonForumContentMessageImplOrNull():
|
||||
CommonForumContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun WithUser.commonForumContentMessageImplOrThrow():
|
||||
CommonForumContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifCommonForumContentMessageImpl(block: (CommonForumContentMessageImpl<MessageContent>) -> T):
|
||||
T? = commonForumContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.passportMessageOrNull(): PassportMessage? = this as?
|
||||
dev.inmo.tgbotapi.types.message.PassportMessage
|
||||
|
||||
@@ -810,18 +722,6 @@ public inline fun WithUser.passportMessageOrThrow(): PassportMessage = this as
|
||||
public inline fun <T> WithUser.ifPassportMessage(block: (PassportMessage) -> T): T? =
|
||||
passportMessageOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.privateContentMessageImplOrNull():
|
||||
PrivateContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun WithUser.privateContentMessageImplOrThrow():
|
||||
PrivateContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
WithUser.ifPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T):
|
||||
T? = privateContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun WithUser.fromUserMessageOrNull(): FromUserMessage? = this as?
|
||||
dev.inmo.tgbotapi.types.message.abstracts.FromUserMessage
|
||||
|
||||
@@ -1127,28 +1027,6 @@ public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultArticle(block: (InlineQueryResultArticle) -> T): T? =
|
||||
inlineQueryResultArticleOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultAudioCachedImplOrNull():
|
||||
InlineQueryResultAudioCachedImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioCachedImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultAudioCachedImplOrThrow():
|
||||
InlineQueryResultAudioCachedImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioCachedImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultAudioCachedImpl(block: (InlineQueryResultAudioCachedImpl) -> T):
|
||||
T? = inlineQueryResultAudioCachedImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultAudioImplOrNull(): InlineQueryResultAudioImpl?
|
||||
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultAudioImplOrThrow(): InlineQueryResultAudioImpl
|
||||
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultAudioImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultAudioImpl(block: (InlineQueryResultAudioImpl) -> T): T? =
|
||||
inlineQueryResultAudioImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultContactOrNull(): InlineQueryResultContact? =
|
||||
this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultContact
|
||||
|
||||
@@ -1159,30 +1037,6 @@ public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultContact(block: (InlineQueryResultContact) -> T): T? =
|
||||
inlineQueryResultContactOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultDocumentCachedImplOrNull():
|
||||
InlineQueryResultDocumentCachedImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentCachedImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultDocumentCachedImplOrThrow():
|
||||
InlineQueryResultDocumentCachedImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentCachedImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultDocumentCachedImpl(block: (InlineQueryResultDocumentCachedImpl) -> T):
|
||||
T? = inlineQueryResultDocumentCachedImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultDocumentImplOrNull():
|
||||
InlineQueryResultDocumentImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultDocumentImplOrThrow():
|
||||
InlineQueryResultDocumentImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultDocumentImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultDocumentImpl(block: (InlineQueryResultDocumentImpl) -> T):
|
||||
T? = inlineQueryResultDocumentImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultGameOrNull(): InlineQueryResultGame? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGame
|
||||
|
||||
@@ -1193,28 +1047,6 @@ public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultGame(block: (InlineQueryResultGame) -> T): T? =
|
||||
inlineQueryResultGameOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultGifCachedImplOrNull():
|
||||
InlineQueryResultGifCachedImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifCachedImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultGifCachedImplOrThrow():
|
||||
InlineQueryResultGifCachedImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifCachedImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultGifCachedImpl(block: (InlineQueryResultGifCachedImpl) -> T):
|
||||
T? = inlineQueryResultGifCachedImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultGifImplOrNull(): InlineQueryResultGifImpl? =
|
||||
this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultGifImplOrThrow(): InlineQueryResultGifImpl =
|
||||
this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultGifImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultGifImpl(block: (InlineQueryResultGifImpl) -> T): T? =
|
||||
inlineQueryResultGifImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultLocationOrNull(): InlineQueryResultLocation? =
|
||||
this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultLocation
|
||||
|
||||
@@ -1225,52 +1057,6 @@ public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultLocation(block: (InlineQueryResultLocation) -> T): T? =
|
||||
inlineQueryResultLocationOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCachedImplOrNull():
|
||||
InlineQueryResultMpeg4GifCachedImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifCachedImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifCachedImplOrThrow():
|
||||
InlineQueryResultMpeg4GifCachedImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifCachedImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultMpeg4GifCachedImpl(block: (InlineQueryResultMpeg4GifCachedImpl) -> T):
|
||||
T? = inlineQueryResultMpeg4GifCachedImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifImplOrNull():
|
||||
InlineQueryResultMpeg4GifImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultMpeg4GifImplOrThrow():
|
||||
InlineQueryResultMpeg4GifImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultMpeg4GifImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultMpeg4GifImpl(block: (InlineQueryResultMpeg4GifImpl) -> T):
|
||||
T? = inlineQueryResultMpeg4GifImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultPhotoCachedImplOrNull():
|
||||
InlineQueryResultPhotoCachedImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoCachedImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultPhotoCachedImplOrThrow():
|
||||
InlineQueryResultPhotoCachedImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoCachedImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultPhotoCachedImpl(block: (InlineQueryResultPhotoCachedImpl) -> T):
|
||||
T? = inlineQueryResultPhotoCachedImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultPhotoImplOrNull(): InlineQueryResultPhotoImpl?
|
||||
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultPhotoImplOrThrow(): InlineQueryResultPhotoImpl
|
||||
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultPhotoImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultPhotoImpl(block: (InlineQueryResultPhotoImpl) -> T): T? =
|
||||
inlineQueryResultPhotoImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultStickerCachedOrNull():
|
||||
InlineQueryResultStickerCached? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultStickerCached
|
||||
@@ -1293,50 +1079,6 @@ public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultVenue(block: (InlineQueryResultVenue) -> T): T? =
|
||||
inlineQueryResultVenueOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVideoCachedImplOrNull():
|
||||
InlineQueryResultVideoCachedImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoCachedImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVideoCachedImplOrThrow():
|
||||
InlineQueryResultVideoCachedImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoCachedImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultVideoCachedImpl(block: (InlineQueryResultVideoCachedImpl) -> T):
|
||||
T? = inlineQueryResultVideoCachedImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVideoImplOrNull(): InlineQueryResultVideoImpl?
|
||||
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVideoImplOrThrow(): InlineQueryResultVideoImpl
|
||||
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVideoImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultVideoImpl(block: (InlineQueryResultVideoImpl) -> T): T? =
|
||||
inlineQueryResultVideoImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVoiceCachedImplOrNull():
|
||||
InlineQueryResultVoiceCachedImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceCachedImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVoiceCachedImplOrThrow():
|
||||
InlineQueryResultVoiceCachedImpl = this as
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceCachedImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultVoiceCachedImpl(block: (InlineQueryResultVoiceCachedImpl) -> T):
|
||||
T? = inlineQueryResultVoiceCachedImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVoiceImplOrNull(): InlineQueryResultVoiceImpl?
|
||||
= this as? dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceImpl
|
||||
|
||||
public inline fun InlineQueryResult.inlineQueryResultVoiceImplOrThrow(): InlineQueryResultVoiceImpl
|
||||
= this as dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.InlineQueryResultVoiceImpl
|
||||
|
||||
public inline fun <T>
|
||||
InlineQueryResult.ifInlineQueryResultVoiceImpl(block: (InlineQueryResultVoiceImpl) -> T): T? =
|
||||
inlineQueryResultVoiceImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun InlineQueryResult.describedInlineQueryResultOrNull(): DescribedInlineQueryResult?
|
||||
= this as?
|
||||
dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.DescribedInlineQueryResult
|
||||
@@ -2130,51 +1872,6 @@ public inline fun <T>
|
||||
Chat.ifAbleToAddInAttachmentMenuChat(block: (AbleToAddInAttachmentMenuChat) -> T): T? =
|
||||
ableToAddInAttachmentMenuChatOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.extendedChannelChatImplOrNull(): ExtendedChannelChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
|
||||
|
||||
public inline fun Chat.extendedChannelChatImplOrThrow(): ExtendedChannelChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifExtendedChannelChatImpl(block: (ExtendedChannelChatImpl) -> T): T? =
|
||||
extendedChannelChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.extendedGroupChatImplOrNull(): ExtendedGroupChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
|
||||
|
||||
public inline fun Chat.extendedGroupChatImplOrThrow(): ExtendedGroupChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifExtendedGroupChatImpl(block: (ExtendedGroupChatImpl) -> T): T? =
|
||||
extendedGroupChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.extendedPrivateChatImplOrNull(): ExtendedPrivateChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
|
||||
|
||||
public inline fun Chat.extendedPrivateChatImplOrThrow(): ExtendedPrivateChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifExtendedPrivateChatImpl(block: (ExtendedPrivateChatImpl) -> T): T? =
|
||||
extendedPrivateChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.extendedSupergroupChatImplOrNull(): ExtendedSupergroupChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
|
||||
|
||||
public inline fun Chat.extendedSupergroupChatImplOrThrow(): ExtendedSupergroupChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifExtendedSupergroupChatImpl(block: (ExtendedSupergroupChatImpl) -> T):
|
||||
T? = extendedSupergroupChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.extendedForumChatImplOrNull(): ExtendedForumChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl
|
||||
|
||||
public inline fun Chat.extendedForumChatImplOrThrow(): ExtendedForumChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedForumChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifExtendedForumChatImpl(block: (ExtendedForumChatImpl) -> T): T? =
|
||||
extendedForumChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.extendedBotOrNull(): ExtendedBot? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ExtendedBot
|
||||
|
||||
@@ -2265,51 +1962,6 @@ public inline fun Chat.extendedChatWithUsernameOrThrow(): ExtendedChatWithUserna
|
||||
public inline fun <T> Chat.ifExtendedChatWithUsername(block: (ExtendedChatWithUsername) -> T): T? =
|
||||
extendedChatWithUsernameOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.groupChatImplOrNull(): GroupChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.GroupChatImpl
|
||||
|
||||
public inline fun Chat.groupChatImplOrThrow(): GroupChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.GroupChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifGroupChatImpl(block: (GroupChatImpl) -> T): T? = groupChatImplOrNull()
|
||||
?.let(block)
|
||||
|
||||
public inline fun Chat.privateChatImplOrNull(): PrivateChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.PrivateChatImpl
|
||||
|
||||
public inline fun Chat.privateChatImplOrThrow(): PrivateChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.PrivateChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifPrivateChatImpl(block: (PrivateChatImpl) -> T): T? =
|
||||
privateChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.supergroupChatImplOrNull(): SupergroupChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
|
||||
|
||||
public inline fun Chat.supergroupChatImplOrThrow(): SupergroupChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifSupergroupChatImpl(block: (SupergroupChatImpl) -> T): T? =
|
||||
supergroupChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.forumChatImplOrNull(): ForumChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ForumChatImpl
|
||||
|
||||
public inline fun Chat.forumChatImplOrThrow(): ForumChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.ForumChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifForumChatImpl(block: (ForumChatImpl) -> T): T? = forumChatImplOrNull()
|
||||
?.let(block)
|
||||
|
||||
public inline fun Chat.channelChatImplOrNull(): ChannelChatImpl? = this as?
|
||||
dev.inmo.tgbotapi.types.chat.ChannelChatImpl
|
||||
|
||||
public inline fun Chat.channelChatImplOrThrow(): ChannelChatImpl = this as
|
||||
dev.inmo.tgbotapi.types.chat.ChannelChatImpl
|
||||
|
||||
public inline fun <T> Chat.ifChannelChatImpl(block: (ChannelChatImpl) -> T): T? =
|
||||
channelChatImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Chat.userOrNull(): User? = this as? dev.inmo.tgbotapi.types.chat.User
|
||||
|
||||
public inline fun Chat.userOrThrow(): User = this as dev.inmo.tgbotapi.types.chat.User
|
||||
@@ -3240,18 +2892,6 @@ public inline fun <T>
|
||||
ForwardInfo.ifSentByChannel(block: (ForwardInfo.PublicChat.SentByChannel) -> T): T? =
|
||||
sentByChannelOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.channelContentMessageImplOrNull():
|
||||
ChannelContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.ChannelContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.channelContentMessageImplOrThrow():
|
||||
ChannelContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.ChannelContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifChannelContentMessageImpl(block: (ChannelContentMessageImpl<MessageContent>) -> T): T?
|
||||
= channelContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.channelEventMessageOrNull(): ChannelEventMessage<ChannelEvent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.ChannelEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent>
|
||||
|
||||
@@ -3286,90 +2926,6 @@ public inline fun <T>
|
||||
Message.ifCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T):
|
||||
T? = commonSupergroupEventMessageOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.connectedFromChannelGroupContentMessageImplOrNull():
|
||||
ConnectedFromChannelGroupContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.ConnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.connectedFromChannelGroupContentMessageImplOrThrow():
|
||||
ConnectedFromChannelGroupContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.ConnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifConnectedFromChannelGroupContentMessageImpl(block: (ConnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T):
|
||||
T? = connectedFromChannelGroupContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.unconnectedFromChannelGroupContentMessageImplOrNull():
|
||||
UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.UnconnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.unconnectedFromChannelGroupContentMessageImplOrThrow():
|
||||
UnconnectedFromChannelGroupContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.UnconnectedFromChannelGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifUnconnectedFromChannelGroupContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T):
|
||||
T? = unconnectedFromChannelGroupContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.anonymousGroupContentMessageImplOrNull():
|
||||
AnonymousGroupContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.AnonymousGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.anonymousGroupContentMessageImplOrThrow():
|
||||
AnonymousGroupContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.AnonymousGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T):
|
||||
T? = anonymousGroupContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.commonGroupContentMessageImplOrNull():
|
||||
CommonGroupContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.commonGroupContentMessageImplOrThrow():
|
||||
CommonGroupContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.CommonGroupContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifCommonGroupContentMessageImpl(block: (CommonGroupContentMessageImpl<MessageContent>) -> T):
|
||||
T? = commonGroupContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.fromChannelForumContentMessageImplOrNull():
|
||||
FromChannelForumContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.FromChannelForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.fromChannelForumContentMessageImplOrThrow():
|
||||
FromChannelForumContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.FromChannelForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifFromChannelForumContentMessageImpl(block: (FromChannelForumContentMessageImpl<MessageContent>) -> T):
|
||||
T? = fromChannelForumContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.anonymousForumContentMessageImplOrNull():
|
||||
AnonymousForumContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.AnonymousForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.anonymousForumContentMessageImplOrThrow():
|
||||
AnonymousForumContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.AnonymousForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifAnonymousForumContentMessageImpl(block: (AnonymousForumContentMessageImpl<MessageContent>) -> T):
|
||||
T? = anonymousForumContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.commonForumContentMessageImplOrNull():
|
||||
CommonForumContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.commonForumContentMessageImplOrThrow():
|
||||
CommonForumContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.CommonForumContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifCommonForumContentMessageImpl(block: (CommonForumContentMessageImpl<MessageContent>) -> T):
|
||||
T? = commonForumContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.passportMessageOrNull(): PassportMessage? = this as?
|
||||
dev.inmo.tgbotapi.types.message.PassportMessage
|
||||
|
||||
@@ -3379,18 +2935,6 @@ public inline fun Message.passportMessageOrThrow(): PassportMessage = this as
|
||||
public inline fun <T> Message.ifPassportMessage(block: (PassportMessage) -> T): T? =
|
||||
passportMessageOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.privateContentMessageImplOrNull():
|
||||
PrivateContentMessageImpl<MessageContent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun Message.privateContentMessageImplOrThrow():
|
||||
PrivateContentMessageImpl<MessageContent> = this as
|
||||
dev.inmo.tgbotapi.types.message.PrivateContentMessageImpl<dev.inmo.tgbotapi.types.message.content.MessageContent>
|
||||
|
||||
public inline fun <T>
|
||||
Message.ifPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T): T?
|
||||
= privateContentMessageImplOrNull() ?.let(block)
|
||||
|
||||
public inline fun Message.privateEventMessageOrNull(): PrivateEventMessage<PrivateEvent>? = this as?
|
||||
dev.inmo.tgbotapi.types.message.PrivateEventMessage<dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent>
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import io.ktor.http.encodeURLQueryComponent
|
||||
|
||||
|
||||
fun makeUsernameLink(username: String, threadId: MessageThreadId? = null) = "$internalLinkBeginning/$username${threadId ?.let { "/$it" } ?: ""}"
|
||||
fun makeInternalTgUsernameLink(username: String) = "${internalTgAppLinksBeginning}resolve?domain=$username"
|
||||
fun makeUserLink(userId: UserId) = userId.userLink
|
||||
fun makeChatLink(identifier: Identifier, threadId: MessageThreadId? = null) = identifier.toString().replace(
|
||||
linkIdRedundantPartRegex,
|
||||
@@ -16,6 +17,7 @@ fun makeChatLink(identifier: Identifier, threadId: MessageThreadId? = null) = id
|
||||
"$internalLinkBeginning/c/$bareId${threadId ?.let { "/$it" } ?: ""}"
|
||||
}
|
||||
fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start="
|
||||
fun makeInternalTgUsernameDeepLinkPrefix(username: String) = "${makeInternalTgUsernameLink(username)}&start="
|
||||
fun makeUsernameStartattachPrefix(username: String) = "$internalLinkBeginning/$username?startattach"
|
||||
fun makeUsernameStartattachLink(username: String, data: String? = null) = "${makeUsernameStartattachPrefix(username)}${data?.let { "=$it" } ?: ""}"
|
||||
inline val Username.usernameLink
|
||||
@@ -30,6 +32,9 @@ inline val Username.startattachPrefix
|
||||
get() = makeUsernameStartattachPrefix(usernameWithoutAt)
|
||||
inline fun makeLink(username: Username, threadId: MessageThreadId? = null) = username.link(threadId)
|
||||
inline fun makeTelegramDeepLink(username: String, startParameter: String) = "${makeUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent()
|
||||
inline fun makeInternalTgDeepLink(username: String, startParameter: String) = "${makeInternalTgUsernameDeepLinkPrefix(username)}$startParameter".encodeURLQueryComponent()
|
||||
inline fun makeInternalTgDeepLink(username: Username, startParameter: String) =
|
||||
makeInternalTgDeepLink(username.usernameWithoutAt, startParameter)
|
||||
inline fun makeTelegramStartattach(username: String, data: String? = null) = makeUsernameStartattachLink(username, data)
|
||||
inline fun makeDeepLink(username: Username, startParameter: String) = makeTelegramDeepLink(username.usernameWithoutAt, startParameter)
|
||||
inline fun makeTelegramDeepLink(username: Username, startParameter: String) = makeDeepLink(username, startParameter)
|
||||
|
||||
Reference in New Issue
Block a user