1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-30 03:15:42 +00:00

Compare commits

..

26 Commits

Author SHA1 Message Date
e8022a2ded add kdocs to the requests 2021-12-20 12:50:06 +06:00
d6cef5984b filling of changelog and several fixes 2021-12-20 12:47:55 +06:00
49bea1bcef update gradle wrapper 2021-12-20 12:32:21 +06:00
85a4459072 Update RawMessage.kt 2021-12-19 00:46:06 +06:00
ce74631580 actualizing of readmes 2021-12-18 23:19:05 +06:00
1e5ce6bb5c add ContentMessage#hasProtectedContent 2021-12-18 23:12:12 +06:00
dc89e914a1 support of has_protected_content field 2021-12-18 23:11:28 +06:00
ee815c7335 update micro_utils 2021-12-18 22:29:25 +06:00
69f4033807 add support of is_automatic_forward 2021-12-18 22:28:01 +06:00
0581587adf add support of has_private_forwards 2021-12-10 12:53:00 +06:00
23f93075a4 update microutils and add banChatSenderChat and unbanChatSenderChat support 2021-12-10 12:49:13 +06:00
6c3425d5f9 Update CHANGELOG.md 2021-12-04 21:23:34 +06:00
d285590348 Update gradle-wrapper.properties 2021-12-04 21:12:12 +06:00
2e0ad6dd3c Merge pull request #505 from InsanusMokrassar/fix/linkln
Fix of linkln
2021-12-04 21:08:46 +06:00
96a5e55894 Merge pull request #499 from InsanusMokrassar/renovate/micro_utils_version
Update micro_utils_version to v0.8.5
2021-12-04 21:08:06 +06:00
4e3b085cdb start 0.37.2 2021-12-04 21:07:00 +06:00
8baa601af7 Fix of linkln 2021-12-04 12:51:55 +06:00
Renovate Bot
facd732fa8 Update micro_utils_version to v0.8.5 2021-11-27 17:38:58 +00:00
e19561367e Merge pull request #500 from InsanusMokrassar/0.37.1
0.37.1
2021-11-14 20:03:57 +06:00
249efeee7e update scripts 2021-11-14 19:42:03 +06:00
b8cc2421b6 update dependencies 2021-11-14 19:15:09 +06:00
2fa1a064ec start 0.37.1 2021-11-14 19:14:06 +06:00
63e864741e update changelog and several kdocs 2021-11-11 12:24:10 +06:00
e4f35c0eba update KDocs 2021-11-11 12:11:58 +06:00
944fe6d820 Update CHANGELOG.md 2021-11-11 11:14:05 +06:00
8ea50f36aa Merge pull request #493 from InsanusMokrassar/0.37.0
0.37.0
2021-11-10 14:48:53 +06:00
41 changed files with 550 additions and 103 deletions

View File

@@ -1,6 +1,36 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 0.37.0 ## 0.37.2 Telegram Bot API 5.5
* `Common`:
* `Version`:
* `MicroUtils`: `0.8.2` -> `0.8.7`
* `Core`:
* New request type: `ChatSenderRequest`
* New request `BanChatSenderChat`
* New request `UnbanChatSenderChat`
* `ExtendedPrivateChat` got new properties: `hasPrivateForwards` and `allowCreateUserIdLink` (same as `hasPrivateForwards`)
* All `ContentMessage` got field `forwardable` (old constructors marked as `Deprecated`)
* `ChannelContentMessage` has been divided for two interfaces (and corresponding classes):
* `ConnectedChannelContentMessage` (and `ConnectedChannelContentMessageImpl`) for connected to the group channels messages
* `UnconnectedChannelContentMessage` (and `UnconnectedChannelContentMessageImpl`) for unconnected channels
* `API`:
* New extensions `TelegramBot#banChatSenderChat`
* New extensions `TelegramBot#unbanChatSenderChat`
* `Utils`:
* Fix of `EntitiesBuilder#linkln`
## 0.37.1
* `Common`:
* `Version`:
* `Serialization`: `1.3.0` -> `1.3.1`
* `Klock`: `2.4.7` -> `2.4.8`
* `MicroUtils`: `0.8.1` -> `0.8.2`
## 0.37.0 Telegram Bot API 5.4
**ALL DEPRECATIONS WERE REMOVED**
* `Common`: * `Common`:
* `Version`: * `Version`:
@@ -15,6 +45,13 @@
* `EditChatInviteLinkSimple` * `EditChatInviteLinkSimple`
* `EditChatInviteLinkWithLimitedMembers` * `EditChatInviteLinkWithLimitedMembers`
* `EditChatInviteLinkWithJoinRequest` * `EditChatInviteLinkWithJoinRequest`
* New `BotAction`: `ChooseStickerAction`
* Now requester will throw exceptions related to responses decoding directly instead of wrapping in
`RequestException`
*
* `BehaviourBuilder FSM`:
* **Incompatible changes** (now generics are used in state machines)
* `strictlyOn` and `onStateOrSubstate` now are part of `BehaviourContextWithFSMBuilder`
## 0.36.1 ## 0.36.1

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-5.4-blue)](https://core.telegram.org/bots/api-changelog#november-5-2021) # TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-5.5-blue)](https://core.telegram.org/bots/api-changelog#december-7-2021)
| [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://github.com/InsanusMokrassar/TelegramBotAPI/workflows/Build/badge.svg)](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [![Small survey](https://img.shields.io/static/v1?label=Google&message=Survey&color=blue)](https://forms.gle/2Hex2ynbHWHhi1KY7) [![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram&message=Chat&color=blue)](https://t.me/InMoTelegramBotAPI) | | [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://github.com/InsanusMokrassar/TelegramBotAPI/workflows/Build/badge.svg)](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [![Small survey](https://img.shields.io/static/v1?label=Google&message=Survey&color=blue)](https://forms.gle/2Hex2ynbHWHhi1KY7) [![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram&message=Chat&color=blue)](https://t.me/InMoTelegramBotAPI) |
|:---:| |:---:|

View File

@@ -23,7 +23,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -91,3 +97,8 @@ Object callback = {
tasks.dokkaGfm(callback) tasks.dokkaGfm(callback)
tasks.dokkaHtml(callback) tasks.dokkaHtml(callback)
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -7,16 +7,16 @@ kotlin.incremental.js=true
kotlin_version=1.5.31 kotlin_version=1.5.31
kotlin_coroutines_version=1.5.2 kotlin_coroutines_version=1.5.2
kotlin_serialisation_runtime_version=1.3.0 kotlin_serialisation_runtime_version=1.3.1
klock_version=2.4.7 klock_version=2.4.8
uuid_version=0.3.1 uuid_version=0.3.1
ktor_version=1.6.5 ktor_version=1.6.5
micro_utils_version=0.8.1 micro_utils_version=0.8.7
javax_activation_version=1.1.1 javax_activation_version=1.1.1
library_group=dev.inmo library_group=dev.inmo
library_version=0.37.0 library_version=0.37.2
github_release_plugin_version=2.2.12 github_release_plugin_version=2.2.12

View File

@@ -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-7.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -43,8 +49,7 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -0,0 +1,27 @@
package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.BanChatMember
import dev.inmo.tgbotapi.requests.chat.members.BanChatSenderChat
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
suspend fun TelegramBot.banChatSenderChat(
chatId: ChatIdentifier,
senderChatId: ChatId
) = execute(BanChatSenderChat(chatId, senderChatId))
suspend fun TelegramBot.banChatSenderChat(
chat: PublicChat,
senderChatId: ChatId
) = banChatSenderChat(chat.id, senderChatId)
suspend fun TelegramBot.banChatSenderChat(
chatId: ChatId,
senderChat: PublicChat
) = banChatSenderChat(chatId, senderChat.id)
suspend fun TelegramBot.banChatSenderChat(
chat: PublicChat,
senderChat: PublicChat,
) = banChatSenderChat(chat.id, senderChat)

View File

@@ -0,0 +1,26 @@
package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.*
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
suspend fun TelegramBot.unbanChatSenderChat(
chatId: ChatIdentifier,
senderChatId: ChatId
) = execute(UnbanChatSenderChat(chatId, senderChatId))
suspend fun TelegramBot.unbanChatSenderChat(
chat: PublicChat,
senderChatId: ChatId
) = unbanChatSenderChat(chat.id, senderChatId)
suspend fun TelegramBot.unbanChatSenderChat(
chatId: ChatId,
senderChat: PublicChat
) = unbanChatSenderChat(chatId, senderChat.id)
suspend fun TelegramBot.unbanChatSenderChat(
chat: PublicChat,
senderChat: PublicChat,
) = unbanChatSenderChat(chat.id, senderChat)

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -44,7 +50,6 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -43,7 +49,6 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -26,9 +26,9 @@ moments are describing by official [Telegram Bot API](https://core.telegram.org/
Common ways to implement this library are presented here. In some cases it will require additional steps Common ways to implement this library are presented here. In some cases it will require additional steps
like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable
`telegrambotapi.version`, which must be set up by developer. Available versions are presented on `telegrambotapi.version`, which must be set up by developer. Available versions are presented on
[bintray](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.core), next version is last published: maven central, next version is last published:
[![Download](https://api.bintray.com/packages/insanusmokrassar/TelegramBotAPI/tgbotapi.core/images/download.svg) ](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.core/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.core)
Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing
of signed artifacts in Bintray). You can: of signed artifacts in Bintray). You can:

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -94,7 +100,6 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -0,0 +1,10 @@
package dev.inmo.tgbotapi.requests.chat.abstracts
import dev.inmo.tgbotapi.CommonAbstracts.types.ChatRequest
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ChatId
import dev.inmo.tgbotapi.types.UserId
interface ChatSenderRequest : ChatRequest, SimpleRequest<Boolean> {
val senderChatId: ChatId
}

View File

@@ -5,6 +5,9 @@ import dev.inmo.tgbotapi.types.*
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer import kotlinx.serialization.builtins.serializer
/**
* Represent a join request answer. See inheritors for more info
*/
sealed interface ChatJoinRequestAnswer : SimpleRequest<Boolean> { sealed interface ChatJoinRequestAnswer : SimpleRequest<Boolean> {
val chatId: ChatIdentifier val chatId: ChatIdentifier
val userId: UserId val userId: UserId
@@ -13,6 +16,10 @@ sealed interface ChatJoinRequestAnswer : SimpleRequest<Boolean> {
get() = Boolean.serializer() get() = Boolean.serializer()
} }
/**
* Represent [approve](https://core.telegram.org/bots/api#approvechatjoinrequest) [ChatJoinRequestAnswer]. You may approve
* the requests retrieved in with [ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate])
*/
@Serializable @Serializable
data class ApproveChatJoinRequest( data class ApproveChatJoinRequest(
@SerialName(chatIdField) @SerialName(chatIdField)
@@ -26,6 +33,10 @@ data class ApproveChatJoinRequest(
override fun method(): String = "approveChatJoinRequest" override fun method(): String = "approveChatJoinRequest"
} }
/**
* Represent [decline](https://core.telegram.org/bots/api#declinechatjoinrequest) [ChatJoinRequestAnswer]. You may approve
* the requests retrieved in with [ChatJoinRequest] (in [dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate])
*/
@Serializable @Serializable
data class DeclineChatJoinRequest( data class DeclineChatJoinRequest(
@SerialName(chatIdField) @SerialName(chatIdField)

View File

@@ -0,0 +1,23 @@
package dev.inmo.tgbotapi.requests.chat.members
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatSenderRequest
import dev.inmo.tgbotapi.types.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
/**
* Representation of [banChatSenderChat](https://core.telegram.org/bots/api#banchatsenderchat) request
*/
@Serializable
data class BanChatSenderChat(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(senderChatIdField)
override val senderChatId: ChatId
) : ChatSenderRequest {
override fun method(): String = "banChatSenderChat"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -0,0 +1,23 @@
package dev.inmo.tgbotapi.requests.chat.members
import dev.inmo.tgbotapi.requests.chat.abstracts.ChatSenderRequest
import dev.inmo.tgbotapi.types.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
/**
* Representation of [unbanChatSenderChat](https://core.telegram.org/bots/api#unbanchatsenderchat) request
*/
@Serializable
data class UnbanChatSenderChat(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(senderChatIdField)
override val senderChatId: ChatId
) : ChatSenderRequest {
override fun method(): String = "unbanChatSenderChat"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -42,6 +42,9 @@ private fun ChatInviteLink.toRawChatInviteLink() = RawChatInviteLink(
(this as? ChatInviteLinkWithJoinRequest) ?.leftToReview (this as? ChatInviteLinkWithJoinRequest) ?.leftToReview
) )
/**
* Base interface for all chat invite links. See inheritors for more info or official [docs](https://core.telegram.org/bots/api#chatinvitelink)
*/
@Serializable(ChatInviteLinkSerializer::class) @Serializable(ChatInviteLinkSerializer::class)
sealed interface ChatInviteLink : WithUser { sealed interface ChatInviteLink : WithUser {
val inviteLink: String val inviteLink: String
@@ -60,6 +63,9 @@ sealed interface ChatInviteLink : WithUser {
} }
} }
/**
* Base interface for all [ChatInviteLink]s which are NOT [PrimaryInviteLink]
*/
@Serializable(ChatInviteLinkSerializer::class) @Serializable(ChatInviteLinkSerializer::class)
sealed interface SecondaryChatInviteLink : ChatInviteLink { sealed interface SecondaryChatInviteLink : ChatInviteLink {
override val isPrimary: Boolean override val isPrimary: Boolean
@@ -70,6 +76,9 @@ sealed interface SecondaryChatInviteLink : ChatInviteLink {
} }
} }
/**
* Primary invite link in the chat for this bot
*/
@Serializable @Serializable
data class PrimaryInviteLink( data class PrimaryInviteLink(
@SerialName(inviteLinkField) @SerialName(inviteLinkField)
@@ -87,6 +96,12 @@ data class PrimaryInviteLink(
get() = null get() = null
} }
/**
* Represent [SecondaryChatInviteLink] which will require an aprovement from one of the administrators
*
* @see ChatJoinRequest
* @see dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
*/
@Serializable @Serializable
data class ChatInviteLinkWithJoinRequest( data class ChatInviteLinkWithJoinRequest(
@SerialName(inviteLinkField) @SerialName(inviteLinkField)
@@ -106,6 +121,9 @@ data class ChatInviteLinkWithJoinRequest(
get() = expireDate ?.asDate get() = expireDate ?.asDate
} }
/**
* Represent [SecondaryChatInviteLink] which will have limitation for the amount of chat members to join
*/
@Serializable @Serializable
data class ChatInviteLinkWithLimitedMembers( data class ChatInviteLinkWithLimitedMembers(
@SerialName(inviteLinkField) @SerialName(inviteLinkField)
@@ -125,6 +143,10 @@ data class ChatInviteLinkWithLimitedMembers(
get() = expireDate ?.asDate get() = expireDate ?.asDate
} }
/**
* Represent [SecondaryChatInviteLink] which have no any restrictions like [ChatInviteLinkWithJoinRequest] or
* [ChatInviteLinkWithLimitedMembers]
*/
@Serializable @Serializable
data class ChatInviteLinkUnlimited( data class ChatInviteLinkUnlimited(
@SerialName(inviteLinkField) @SerialName(inviteLinkField)

View File

@@ -5,6 +5,9 @@ import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
/**
* Represent a [ChatJoinRequest](https://core.telegram.org/bots/api#chatjoinrequest)
*/
@Serializable @Serializable
data class ChatJoinRequest( data class ChatJoinRequest(
@SerialName(chatField) @SerialName(chatField)

View File

@@ -96,6 +96,7 @@ val telegramInlineModeGifPermittedMimeTypes by lazy {
} }
const val chatIdField = "chat_id" const val chatIdField = "chat_id"
const val senderChatIdField = "sender_chat_id"
const val messageIdField = "message_id" const val messageIdField = "message_id"
const val updateIdField = "update_id" const val updateIdField = "update_id"
const val fromChatIdField = "from_chat_id" const val fromChatIdField = "from_chat_id"
@@ -112,6 +113,7 @@ const val isBotField = "is_bot"
const val firstNameField = "first_name" const val firstNameField = "first_name"
const val lastNameField = "last_name" const val lastNameField = "last_name"
const val languageCodeField = "language_code" const val languageCodeField = "language_code"
const val hasPrivateForwardsField = "has_private_forwards"
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"
const val supportInlineQueriesField = "supports_inline_queries" const val supportInlineQueriesField = "supports_inline_queries"

View File

@@ -7,4 +7,8 @@ import kotlinx.serialization.Serializable
@Serializable(ExtendedChatSerializer::class) @Serializable(ExtendedChatSerializer::class)
interface ExtendedPrivateChat : PrivateChat, ExtendedChat { interface ExtendedPrivateChat : PrivateChat, ExtendedChat {
val bio: String val bio: String
val hasPrivateForwards: Boolean
val allowCreateUserIdLink: Boolean
get() = hasPrivateForwards
} }

View File

@@ -18,5 +18,7 @@ data class ExtendedPrivateChatImpl(
@SerialName(lastNameField) @SerialName(lastNameField)
override val lastName: String = "", override val lastName: String = "",
@SerialName(bioField) @SerialName(bioField)
override val bio: String = "" override val bio: String = "",
@SerialName(hasPrivateForwardsField)
override val hasPrivateForwards: Boolean = false
) : ExtendedPrivateChat ) : ExtendedPrivateChat

View File

@@ -16,7 +16,21 @@ data class ChannelMediaGroupMessage<T : MediaGroupContent>(
override val mediaGroupId: MediaGroupIdentifier, override val mediaGroupId: MediaGroupIdentifier,
override val content: T, override val content: T,
override val editDate: DateTime?, override val editDate: DateTime?,
override val forwardable: Boolean,
override val forwardInfo: ForwardInfo?, override val forwardInfo: ForwardInfo?,
override val replyTo: Message?, override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup? override val replyMarkup: InlineKeyboardMarkup?
) : MediaGroupMessage<T> ) : MediaGroupMessage<T> {
@Deprecated("Use the constructor with forwardable field")
constructor(
messageId: MessageIdentifier,
chat: Chat,
date: DateTime,
mediaGroupId: MediaGroupIdentifier,
content: T,
editDate: DateTime?,
forwardInfo: ForwardInfo?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?
) : this(messageId, chat, date, mediaGroupId, content, editDate, true, forwardInfo, replyTo, replyMarkup)
}

View File

@@ -1,22 +0,0 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
import dev.inmo.tgbotapi.types.message.abstracts.ChannelContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
data class ChannelContentMessageImpl<T: MessageContent>(
override val messageId: MessageIdentifier,
override val chat: ChannelChat,
override val content: T,
override val date: DateTime,
override val editDate: DateTime?,
override val forwardInfo: ForwardInfo?,
override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?
) : ChannelContentMessage<T>

View File

@@ -15,7 +15,22 @@ data class CommonMediaGroupMessage<T : MediaGroupContent>(
override val mediaGroupId: MediaGroupIdentifier, override val mediaGroupId: MediaGroupIdentifier,
override val content: T, override val content: T,
override val editDate: DateTime?, override val editDate: DateTime?,
override val forwardable: Boolean,
override val forwardInfo: ForwardInfo?, override val forwardInfo: ForwardInfo?,
override val replyTo: Message?, override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup? override val replyMarkup: InlineKeyboardMarkup?
) : MediaGroupMessage<T>, FromUserMessage ) : MediaGroupMessage<T>, FromUserMessage {
@Deprecated("Use the constructor with forwardable field")
constructor(
messageId: MessageIdentifier,
from: User,
chat: Chat,
date: DateTime,
mediaGroupId: MediaGroupIdentifier,
content: T,
editDate: DateTime?,
forwardInfo: ForwardInfo?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?
) : this(messageId, from, chat, date, mediaGroupId, content, editDate, true, forwardInfo, replyTo, replyMarkup)
}

View File

@@ -0,0 +1,36 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
data class ConnectedChannelContentMessageImpl<T: MessageContent>(
override val messageId: MessageIdentifier,
override val chat: ChannelChat,
override val content: T,
override val date: DateTime,
override val editDate: DateTime?,
override val forwardable: Boolean,
override val forwardInfo: ForwardInfo?,
override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?
) : ConnectedChannelContentMessage<T> {
@Deprecated("Use the constructor with forwardable field")
constructor(
messageId: MessageIdentifier,
chat: ChannelChat,
content: T,
date: DateTime,
editDate: DateTime?,
forwardInfo: ForwardInfo?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?,
senderBot: CommonBot?,
authorSignature: AuthorSignature?
) : this(messageId, chat, content, date, editDate, true, forwardInfo, replyTo, replyMarkup, senderBot, authorSignature)
}

View File

@@ -15,12 +15,28 @@ data class FromChannelGroupContentMessageImpl<T : MessageContent>(
override val date: DateTime, override val date: DateTime,
override val forwardInfo: ForwardInfo?, override val forwardInfo: ForwardInfo?,
override val editDate: DateTime?, override val editDate: DateTime?,
override val forwardable: Boolean,
override val replyTo: Message?, override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup?, override val replyMarkup: InlineKeyboardMarkup?,
override val content: T, override val content: T,
override val senderBot: CommonBot?, override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature? override val authorSignature: AuthorSignature?
) : FromChannelGroupContentMessage<T> ) : FromChannelGroupContentMessage<T> {
@Deprecated("Use the constructor with forwardable field")
constructor(
chat: GroupChat,
channel: ChannelChat,
messageId: MessageIdentifier,
date: DateTime,
forwardInfo: ForwardInfo?,
editDate: DateTime?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?,
content: T,
senderBot: CommonBot?,
authorSignature: AuthorSignature?
) : this(chat, channel, messageId, date, forwardInfo, editDate, true, replyTo, replyMarkup, content, senderBot, authorSignature)
}
data class AnonymousGroupContentMessageImpl<T : MessageContent>( data class AnonymousGroupContentMessageImpl<T : MessageContent>(
override val chat: GroupChat, override val chat: GroupChat,
@@ -28,12 +44,27 @@ data class AnonymousGroupContentMessageImpl<T : MessageContent>(
override val date: DateTime, override val date: DateTime,
override val forwardInfo: ForwardInfo?, override val forwardInfo: ForwardInfo?,
override val editDate: DateTime?, override val editDate: DateTime?,
override val forwardable: Boolean,
override val replyTo: Message?, override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup?, override val replyMarkup: InlineKeyboardMarkup?,
override val content: T, override val content: T,
override val senderBot: CommonBot?, override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature? override val authorSignature: AuthorSignature?
) : AnonymousGroupContentMessage<T> ) : AnonymousGroupContentMessage<T> {
@Deprecated("Use the constructor with forwardable field")
constructor(
chat: GroupChat,
messageId: MessageIdentifier,
date: DateTime,
forwardInfo: ForwardInfo?,
editDate: DateTime?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?,
content: T,
senderBot: CommonBot?,
authorSignature: AuthorSignature?
) : this(chat, messageId, date, forwardInfo, editDate, true, replyTo, replyMarkup, content, senderBot, authorSignature)
}
data class CommonGroupContentMessageImpl<T : MessageContent>( data class CommonGroupContentMessageImpl<T : MessageContent>(
override val chat: GroupChat, override val chat: GroupChat,
@@ -42,8 +73,23 @@ data class CommonGroupContentMessageImpl<T : MessageContent>(
override val date: DateTime, override val date: DateTime,
override val forwardInfo: ForwardInfo?, override val forwardInfo: ForwardInfo?,
override val editDate: DateTime?, override val editDate: DateTime?,
override val forwardable: Boolean,
override val replyTo: Message?, override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup?, override val replyMarkup: InlineKeyboardMarkup?,
override val content: T, override val content: T,
override val senderBot: CommonBot? override val senderBot: CommonBot?
) : CommonGroupContentMessage<T> ) : CommonGroupContentMessage<T> {
@Deprecated("Use the constructor with forwardable field")
constructor(
chat: GroupChat,
messageId: MessageIdentifier,
from: User,
date: DateTime,
forwardInfo: ForwardInfo?,
editDate: DateTime?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?,
content: T,
senderBot: CommonBot?
) : this(chat, messageId, from, date, forwardInfo, editDate, true, replyTo, replyMarkup, content, senderBot)
}

View File

@@ -7,7 +7,6 @@ import dev.inmo.tgbotapi.types.chat.abstracts.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage import dev.inmo.tgbotapi.types.message.abstracts.PrivateContentMessage
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
data class PrivateContentMessageImpl<T: MessageContent>( data class PrivateContentMessageImpl<T: MessageContent>(
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,
@@ -16,8 +15,23 @@ data class PrivateContentMessageImpl<T: MessageContent>(
override val content: T, override val content: T,
override val date: DateTime, override val date: DateTime,
override val editDate: DateTime?, override val editDate: DateTime?,
override val forwardable: Boolean,
override val forwardInfo: ForwardInfo?, override val forwardInfo: ForwardInfo?,
override val replyTo: Message?, override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup?, override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?, override val senderBot: CommonBot?
) : PrivateContentMessage<T> ) : PrivateContentMessage<T> {
@Deprecated("Use the constructor with forwardable field")
constructor(
messageId: MessageIdentifier,
from: User,
chat: Chat,
content: T,
date: DateTime,
editDate: DateTime?,
forwardInfo: ForwardInfo?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?,
senderBot: CommonBot?
) : this(messageId, from, chat, content, date, editDate, true, forwardInfo, replyTo, replyMarkup, senderBot)
}

View File

@@ -42,9 +42,11 @@ internal data class RawMessage(
private val forward_signature: ForwardSignature? = null, private val forward_signature: ForwardSignature? = null,
private val forward_sender_name: ForwardSenderName? = null, private val forward_sender_name: ForwardSenderName? = null,
private val forward_date: TelegramDate? = null, private val forward_date: TelegramDate? = null,
private val is_automatic_forward: Boolean? = null,
private val reply_to_message: RawMessage? = null, private val reply_to_message: RawMessage? = null,
private val via_bot: CommonBot? = null, private val via_bot: CommonBot? = null,
private val edit_date: TelegramDate? = null, private val edit_date: TelegramDate? = null,
private val has_protected_content: Boolean? = null,
private val media_group_id: MediaGroupIdentifier? = null, private val media_group_id: MediaGroupIdentifier? = null,
private val author_signature: AuthorSignature? = null, private val author_signature: AuthorSignature? = null,
private val text: String? = null, private val text: String? = null,
@@ -250,6 +252,7 @@ internal data class RawMessage(
it, it,
checkedContent, checkedContent,
edit_date?.asDate, edit_date?.asDate,
has_protected_content != true,
forwarded, forwarded,
reply_to_message?.asMessage, reply_to_message?.asMessage,
reply_markup reply_markup
@@ -262,6 +265,7 @@ internal data class RawMessage(
it, it,
checkedContent, checkedContent,
edit_date?.asDate, edit_date?.asDate,
has_protected_content != true,
forwarded, forwarded,
reply_to_message?.asMessage, reply_to_message?.asMessage,
reply_markup reply_markup
@@ -269,18 +273,35 @@ internal data class RawMessage(
} }
} ?: when (chat) { } ?: when (chat) {
is PublicChat -> when (chat) { is PublicChat -> when (chat) {
is ChannelChat -> ChannelContentMessageImpl( is ChannelChat -> if (is_automatic_forward == true) {
messageId, ConnectedChannelContentMessageImpl(
chat, messageId,
content, chat,
date.asDate, content,
edit_date?.asDate, date.asDate,
forwarded, edit_date?.asDate,
reply_to_message?.asMessage, has_protected_content != true,
reply_markup, forwarded,
via_bot, reply_to_message?.asMessage,
author_signature reply_markup,
) via_bot,
author_signature
)
} else {
UnconnectedChannelContentMessageImpl(
messageId,
chat,
content,
date.asDate,
edit_date?.asDate,
has_protected_content != true,
forwarded,
reply_to_message?.asMessage,
reply_markup,
via_bot,
author_signature
)
}
is GroupChat -> when (sender_chat) { is GroupChat -> when (sender_chat) {
is ChannelChat -> FromChannelGroupContentMessageImpl( is ChannelChat -> FromChannelGroupContentMessageImpl(
chat, chat,
@@ -289,6 +310,7 @@ internal data class RawMessage(
date.asDate, date.asDate,
forwarded, forwarded,
edit_date ?.asDate, edit_date ?.asDate,
has_protected_content != true,
reply_to_message ?.asMessage, reply_to_message ?.asMessage,
reply_markup, reply_markup,
content, content,
@@ -301,6 +323,7 @@ internal data class RawMessage(
date.asDate, date.asDate,
forwarded, forwarded,
edit_date ?.asDate, edit_date ?.asDate,
has_protected_content != true,
reply_to_message ?.asMessage, reply_to_message ?.asMessage,
reply_markup, reply_markup,
content, content,
@@ -314,6 +337,7 @@ internal data class RawMessage(
date.asDate, date.asDate,
forwarded, forwarded,
edit_date ?.asDate, edit_date ?.asDate,
has_protected_content != true,
reply_to_message ?.asMessage, reply_to_message ?.asMessage,
reply_markup, reply_markup,
content, content,
@@ -330,6 +354,7 @@ internal data class RawMessage(
content, content,
date.asDate, date.asDate,
edit_date?.asDate, edit_date?.asDate,
has_protected_content != true,
forwarded, forwarded,
reply_to_message?.asMessage, reply_to_message?.asMessage,
reply_markup, reply_markup,

View File

@@ -0,0 +1,39 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
data class UnconnectedChannelContentMessageImpl<T: MessageContent>(
override val messageId: MessageIdentifier,
override val chat: ChannelChat,
override val content: T,
override val date: DateTime,
override val editDate: DateTime?,
override val forwardable: Boolean,
override val forwardInfo: ForwardInfo?,
override val replyTo: Message?,
override val replyMarkup: InlineKeyboardMarkup?,
override val senderBot: CommonBot?,
override val authorSignature: AuthorSignature?
) : UnconnectedChannelContentMessage<T> {
@Deprecated("Use the constructor with forwardable field")
constructor(
messageId: MessageIdentifier,
chat: ChannelChat,
content: T,
date: DateTime,
editDate: DateTime?,
forwardInfo: ForwardInfo?,
replyTo: Message?,
replyMarkup: InlineKeyboardMarkup?,
senderBot: CommonBot?,
authorSignature: AuthorSignature?
) : this(messageId, chat, content, date, editDate, true, forwardInfo, replyTo, replyMarkup, senderBot, authorSignature)
}
@Deprecated("Renamed to UnconnectedChannelContentMessage", ReplaceWith("UnconnectedChannelContentMessage", "dev.inmo.tgbotapi.types.message.UnconnectedChannelContentMessageImpl"))
typealias ChannelContentMessageImpl<T> = UnconnectedChannelContentMessage<T>

View File

@@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
import dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage import dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage
interface ChannelContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage { sealed interface ChannelContentMessage<T: MessageContent> : PossiblySentViaBotCommonMessage<T>, SignedMessage, WithSenderChatMessage {
override val chat: ChannelChat override val chat: ChannelChat
override val senderChat: ChannelChat override val senderChat: ChannelChat
get() = chat get() = chat

View File

@@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
interface ConnectedChannelContentMessage<T: MessageContent> : ChannelContentMessage<T>

View File

@@ -3,5 +3,9 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
interface ContentMessage<T: MessageContent>: Message { interface ContentMessage<T: MessageContent>: Message {
val forwardable: Boolean
val content: T val content: T
val hasProtectedContent: Boolean
get() = !forwardable
} }

View File

@@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
interface UnconnectedChannelContentMessage<T: MessageContent> : ChannelContentMessage<T>

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -43,8 +49,7 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -43,8 +43,7 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -43,8 +49,7 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -43,8 +49,7 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -61,7 +67,6 @@ kotlin {
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }

View File

@@ -915,15 +915,15 @@ inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupCont
this as AnonymousGroupContentMessageImpl<MessageContent> this as AnonymousGroupContentMessageImpl<MessageContent>
@PreviewFeature @PreviewFeature
inline fun <T> Message.whenChannelContentMessageImpl(block: (ChannelContentMessageImpl<MessageContent>) -> T) = asChannelContentMessageImpl() ?.let(block) inline fun <T> Message.whenChannelContentMessageImpl(block: (UnconnectedChannelContentMessageImpl<MessageContent>) -> T) = asChannelContentMessageImpl() ?.let(block)
@PreviewFeature @PreviewFeature
inline fun Message.asChannelContentMessageImpl(): ChannelContentMessageImpl<MessageContent>? = inline fun Message.asChannelContentMessageImpl(): UnconnectedChannelContentMessageImpl<MessageContent>? =
this as? ChannelContentMessageImpl<MessageContent> this as? UnconnectedChannelContentMessageImpl<MessageContent>
@PreviewFeature @PreviewFeature
inline fun Message.requireChannelContentMessageImpl(): ChannelContentMessageImpl<MessageContent> = inline fun Message.requireChannelContentMessageImpl(): UnconnectedChannelContentMessageImpl<MessageContent> =
this as ChannelContentMessageImpl<MessageContent> this as UnconnectedChannelContentMessageImpl<MessageContent>
@PreviewFeature @PreviewFeature
inline fun <T> Message.whenFromChannelGroupContentMessageImpl(block: (FromChannelGroupContentMessageImpl<MessageContent>) -> T) = asFromChannelGroupContentMessageImpl() ?.let(block) inline fun <T> Message.whenFromChannelGroupContentMessageImpl(block: (FromChannelGroupContentMessageImpl<MessageContent>) -> T) = asFromChannelGroupContentMessageImpl() ?.let(block)
@@ -1027,11 +1027,33 @@ inline fun <T> Message.whenChannelContentMessage(block: (ChannelContentMessage<M
@PreviewFeature @PreviewFeature
inline fun Message.asChannelContentMessage(): ChannelContentMessage<MessageContent>? = inline fun Message.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
this as? ChannelContentMessageImpl<MessageContent> this as? ChannelContentMessage<MessageContent>
@PreviewFeature @PreviewFeature
inline fun Message.requireChannelContentMessage(): ChannelContentMessageImpl<MessageContent> = inline fun Message.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
this as ChannelContentMessageImpl<MessageContent> this as ChannelContentMessage<MessageContent>
@PreviewFeature
inline fun <T> Message.whenConnectedChannelContentMessage(block: (ConnectedChannelContentMessage<MessageContent>) -> T) = asConnectedChannelContentMessage() ?.let(block)
@PreviewFeature
inline fun Message.asConnectedChannelContentMessage(): ConnectedChannelContentMessage<MessageContent>? =
this as? ConnectedChannelContentMessageImpl<MessageContent>
@PreviewFeature
inline fun Message.requireConnectedChannelContentMessage(): ConnectedChannelContentMessage<MessageContent> =
this as ConnectedChannelContentMessage<MessageContent>
@PreviewFeature
inline fun <T> Message.whenUnconnectedChannelContentMessage(block: (UnconnectedChannelContentMessage<MessageContent>) -> T) = asUnconnectedChannelContentMessage() ?.let(block)
@PreviewFeature
inline fun Message.asUnconnectedChannelContentMessage(): UnconnectedChannelContentMessage<MessageContent>? =
this as? UnconnectedChannelContentMessage<MessageContent>
@PreviewFeature
inline fun Message.requireUnconnectedChannelContentMessage(): UnconnectedChannelContentMessage<MessageContent> =
this as UnconnectedChannelContentMessage<MessageContent>
@PreviewFeature @PreviewFeature
inline fun <T> Message.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) = asChatEventMessage() ?.let(block) inline fun <T> Message.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) = asChatEventMessage() ?.let(block)

View File

@@ -429,7 +429,7 @@ inline fun EntitiesBuilder.link(text: String, url: String) = add(dev.inmo.tgbota
/** /**
* Version of [EntitiesBuilder.link] with new line at the end * Version of [EntitiesBuilder.link] with new line at the end
*/ */
inline fun EntitiesBuilder.linkln(text: String, url: String) = link(text) + newLine inline fun EntitiesBuilder.linkln(text: String, url: String) = link(text, url) + newLine
/** /**
* Add link using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.MessageEntity.textsources.link] * Add link using [EntitiesBuilder.add] with [dev.inmo.tgbotapi.types.MessageEntity.textsources.link]
*/ */

View File

@@ -26,7 +26,13 @@ repositories {
} }
kotlin { kotlin {
jvm() jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) { js(IR) {
browser() browser()
nodejs() nodejs()
@@ -46,10 +52,8 @@ kotlin {
} }
} }
java { java {
toolchain { sourceCompatibility = JavaVersion.VERSION_1_8
languageVersion = JavaLanguageVersion.of(8) targetCompatibility = JavaVersion.VERSION_1_8
}
} }