1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-27 09:45:46 +00:00

Compare commits

..

37 Commits

Author SHA1 Message Date
1f40ce1a81 add a lot of shortcuts for events 2020-11-12 22:35:27 +06:00
b0219389fc add several functions and changelog notes 2020-11-12 22:23:10 +06:00
f6ec82b449 deprecate old asChatEventsFlow 2020-11-12 22:04:46 +06:00
71dac70635 deprecations in old functions 2020-11-12 22:02:06 +06:00
98f68a9e1e filling of changelog 2020-11-12 21:54:14 +06:00
e7199e7451 fix use user in group messages 2020-11-12 21:46:33 +06:00
33b50c6c68 events filters 2020-11-12 21:17:11 +06:00
e4ce6f8fc7 fixes in events 2020-11-12 17:44:33 +06:00
8764f18ca8 TextContent now implements TextedInput 2020-11-12 16:57:32 +06:00
b2fa7fee9d rename MultilevelTextSource#textSources 2020-11-12 16:37:17 +06:00
0121e3a104 update micro_utils 2020-11-12 16:33:48 +06:00
f6e5664632 start 0.30.4 2020-11-12 16:31:02 +06:00
c5b7c4e1f5 Merge pull request #209 from InsanusMokrassar/0.30.3
0.30.3
2020-11-11 11:25:25 +06:00
53800d49bf small rework in ExceptionsOnlyLimiter 2020-11-11 11:23:24 +06:00
d83e3eb10a add handling of 429 status 2020-11-11 11:15:19 +06:00
66b4d06064 limiter rework 2020-11-11 10:23:20 +06:00
4fab01b2a2 update micro_utils 2020-11-11 10:15:06 +06:00
b81086c4bb start 0.30.3 2020-11-11 10:14:10 +06:00
d776071cac Update build.gradle 2020-11-11 01:32:25 +06:00
5f33d05deb Update extensions utils dependencies 2020-11-11 01:31:28 +06:00
912cc7217c Update extensions api dependencies 2020-11-11 01:30:31 +06:00
96e00f6e31 Merge pull request #207 from InsanusMokrassar/0.30.2
0.30.2
2020-11-10 21:52:37 +06:00
f8ea5f9515 fix in changelog 2020-11-10 21:45:07 +06:00
9f11c4f1c4 update ktor 2020-11-10 20:56:11 +06:00
9c91980d5d webhook fixes 2020-11-10 20:44:39 +06:00
7376eb5b10 start 0.30.2 2020-11-10 20:01:22 +06:00
6654f27f9d Merge pull request #202 from InsanusMokrassar/0.30.1
0.30.1
2020-11-09 15:16:26 +06:00
d29acce417 add suppressing of unused in EntitiesBuilder 2020-11-09 15:14:48 +06:00
f0f18209f3 a little bit improve EntitiesBuilder 2020-11-09 15:12:57 +06:00
324018a0f6 update publication scripts 2020-11-09 14:45:29 +06:00
b621325e92 update version of microutils and changelog 2020-11-09 08:37:30 +06:00
43e92555c2 Merge pull request #203 from Djaler/entities-dsl
Add builder-style dsl for text sources
2020-11-09 08:26:44 +06:00
Kirill Romanov
5f1ca51e60 Add builder-style dsl for text sources 2020-11-08 23:12:32 +03:00
83edda2dfe add link to bot template 2020-11-08 18:58:52 +06:00
1974c20229 start 0.30.1 2020-11-08 12:07:14 +06:00
499d9b1791 Update README.md 2020-11-08 00:03:41 +06:00
6caa7dd428 Merge pull request #163 from InsanusMokrassar/0.30.0
0.30.0
2020-11-07 23:00:35 +06:00
55 changed files with 547 additions and 201 deletions

View File

@@ -1,5 +1,64 @@
# TelegramBotAPI changelog
## 0.30.4
* `Common`:
* `Version`:
* `MicroUtils`: `0.3.1` -> `0.3.3`
* `Core`:
* `MultilevelTextSource#textSources` has been safely renamed to `subsources`
* `TextContent#fullEntitiesList` has been deprecated
* Now `TextContent` implements `TextedInput`
* `TextContent#entities` has been deprecated
* `GroupEventMessage` now overrides `chatEvent` with type `GroupEvent`
* `SupergroupEventMessage` now overrides `chatEvent` with type `SupergroupEvent`
* Any `ChatEventMessage` now have generic type of its `chatEvent` (just like messages)
* `Utils`:
* Old extensions related to chat events are deprecated:
* `Flow<ChatEventMessage<*>>#divideBySource`
* `Flow<ChatEventMessage<*>>#onlyChannelEvents`
* `Flow<ChatEventMessage<*>>#onlyGroupEvents`
* `Flow<ChatEventMessage<*>>#onlySupergroupEvents`
* A lot of extensions for `Flow<ChatEventMessage>` has been added:
* `FlowsUpdatesFilter#events`
* `FlowsUpdatesFilter#channelEvents`
* `FlowsUpdatesFilter#groupEvents`
* `FlowsUpdatesFilter#supergroupEvents`
* And a lot of other filters with specific types
## 0.30.3
* `Common`:
* `Version`:
* `MicroUtils`: `0.3.0` -> `0.3.1`
* `Core`:
* New type of requests exceptions `TooMuchRequestsException`. In fact it will be rare case when you will get this
exception
* `EmptyLimiter` has been renamed to `ExceptionsOnlyLimiter` and currently will stop requests after
`TooMuchRequestsException` happen until retry time is actual
* Now `ExceptionsOnlyLimiter` (previously `EmptyLimiter`) is a class
* `AbstractRequestCallFactory` currently will not look at the response and wait if it have `RetryAfter` error. New
behaviour aimed on delegating of this work to `RequestsLimiter`
## 0.30.2
* `Common`:
* `Version`:
* `Ktor`: `1.4.1` -> `1.4.2`
* `Core`:
* New sealed class `SetWebhookRequest` which can be used in `SetWebhook` requests
* `Utils`:
* Extensions `setWebhookInfoAndStartListenWebhooks` has been united in one extension with `SetWebhookRequest`
incoming parameter
## 0.30.1
* `Common`:
* `Version`:
* `MicroUtils`: `0.2.7` -> `0.3.0`
* `Utils`:
* Builder-style DSL for text sources - `buildEntities` (thanks to [djaler](https://github.com/djaler))
## 0.30.0 Bot API 5.0
**THIS UPDATE CONTAINS A LOT OF BREAKING CHANGES. PLEASE, BE CAREFUL ON UPGRADING OF YOUR PROJECT**

View File

@@ -2,7 +2,7 @@
| Common info | [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://travis-ci.com/InsanusMokrassar/TelegramBotAPI.svg?branch=master)](https://travis-ci.com/InsanusMokrassar/TelegramBotAPI) [Small survey](https://forms.gle/2Hex2ynbHWHhi1KY7)|
| -------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Useful links | [![Chat in Telegram](badges/chat.svg)](https://t.me/InMoTelegramBotAPI) [![KDocs](badges/kdocs.svg)](https://tgbotapi.inmo.dev/docs/index.html) [Examples](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/), [Mini tutorial](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
| Useful links | [![Chat in Telegram](badges/chat.svg)](https://t.me/InMoTelegramBotAPI) [![Create bot](badges/template.svg)](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [![KDocs](badges/kdocs.svg)](https://tgbotapi.inmo.dev/docs/index.html) [Examples](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/), [Mini tutorial](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
| TelegramBotAPI Core status | [![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) |
| TelegramBotAPI Extensions status | [![Download](https://api.bintray.com/packages/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.api/images/download.svg)](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.api/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.api) |
| TelegramBotAPI Util Extensions status | [![Download](https://api.bintray.com/packages/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.utils/images/download.svg)](https://bintray.com/insanusmokrassar/TelegramBotAPI/tgbotapi.extensions.utils/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi.extensions.utils) |

20
badges/template.svg Normal file
View File

@@ -0,0 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="104" height="20">
<linearGradient id="b" x2="0" y2="100%">
<stop offset="0" stop-color="#bbb" stop-opacity=".1"/>
<stop offset="1" stop-opacity=".1"/>
</linearGradient>
<clipPath id="a">
<rect width="104" height="20" rx="3" fill="#fff"/>
</clipPath>
<g clip-path="url(#a)">
<path fill="#555" d="M0 0h65v20H0z"/>
<path fill="#007ec6" d="M35 0h69v20H35z"/>
<path fill="url(#b)" d="M0 0h104v20H0z"/>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
<text x="175" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)">Bot</text>
<text x="175" y="140" transform="scale(.1)">Bot</text>
<text x="690" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)">Template</text>
<text x="690" y="140" transform="scale(.1)">Template</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1016 B

View File

@@ -10,14 +10,14 @@ kotlin_coroutines_version=1.4.1
kotlin_serialisation_runtime_version=1.0.1
klock_version=1.12.1
uuid_version=0.2.2
ktor_version=1.4.1
ktor_version=1.4.2
micro_utils_version=0.2.7
micro_utils_version=0.3.3
javax_activation_version=1.1.1
library_group=dev.inmo
library_version=0.30.0
library_version=0.30.4
gradle_bintray_plugin_version=1.8.5
github_release_plugin_version=2.2.12

View File

@@ -10,7 +10,7 @@ moments are describing by official [Telegram Bot API](https://core.telegram.org/
## Compatibility
This version compatible with [4th of June 2020 update of TelegramBotAPI (version 4.9)](https://core.telegram.org/bots/api#june-4-2020).
This version compatible with [4th of November 2020 update of TelegramBotAPI (version 5.0)](https://core.telegram.org/bots/api#november-4-2020).
There is only one exception of implemented functionality - Telegram Passport API, which was presented in
[August 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api-changelog#august-27-2018) update. It will be implemented
as soon as possible.

View File

@@ -1 +1 @@
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}

View File

@@ -27,6 +27,7 @@ bintray {
}
publish = true
override = true
pkg {
repo = "TelegramBotAPI"

View File

@@ -36,7 +36,10 @@ interface MultilevelTextSource : TextSource {
@Deprecated("Will be removed in near major release")
val textParts: List<TextPart>
get() = textParts(0)
val subsources: List<TextSource>
@Deprecated("Will be removed in near major release", ReplaceWith("subsources"))
val textSources: List<TextSource>
get() = subsources
}
data class TextPart(
@@ -46,7 +49,7 @@ data class TextPart(
fun List<TextPart>.justTextSources() = map { it.source }
fun List<TextSource>.makeString() = joinToString("") { it.source }
internal fun MultilevelTextSource.textParts(offset: Int): List<TextPart> = textSources.toTextParts(offset)
internal fun MultilevelTextSource.textParts(offset: Int): List<TextPart> = subsources.toTextParts(offset)
fun List<TextSource>.separateForMessage(limit: IntRange, numberOfParts: Int? = null): List<List<TextSource>> {
if (isEmpty()) {
return emptyList()

View File

@@ -4,8 +4,7 @@ import dev.inmo.micro_utils.coroutines.safely
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
import dev.inmo.tgbotapi.bot.Ktor.base.*
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
import dev.inmo.tgbotapi.bot.settings.limiters.EmptyLimiter
import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter
import dev.inmo.tgbotapi.bot.settings.limiters.*
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.types.Response
import dev.inmo.tgbotapi.utils.*
@@ -19,7 +18,7 @@ class KtorRequestsExecutor(
client: HttpClient = HttpClient(),
callsFactories: List<KtorCallFactory> = emptyList(),
excludeDefaultFactories: Boolean = false,
private val requestsLimiter: RequestLimiter = EmptyLimiter,
private val requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter(),
private val jsonFormatter: Json = nonstrictJsonFormat
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
private val callsFactories: List<KtorCallFactory> = callsFactories.run {

View File

@@ -1,5 +1,6 @@
package dev.inmo.tgbotapi.bot.Ktor.base
import dev.inmo.micro_utils.coroutines.safely
import dev.inmo.tgbotapi.bot.Ktor.KtorCallFactory
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
import dev.inmo.tgbotapi.requests.GetUpdates
@@ -51,23 +52,17 @@ abstract class AbstractRequestCallFactory : KtorCallFactory {
val content = response.receive<String>()
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
return (responseObject.result?.let {
jsonFormatter.decodeFromJsonElement(request.resultDeserializer, it)
} ?: responseObject.parameters?.let {
val error = it.error
if (error is RetryAfterError) {
delay(error.leftToRetry)
makeCall(client, urlsKeeper, request, jsonFormatter)
} else {
null
}
} ?: response.let {
throw newRequestException(
responseObject,
content,
"Can't get result object from $content"
)
})
return safely {
(responseObject.result?.let {
jsonFormatter.decodeFromJsonElement(request.resultDeserializer, it)
} ?: response.let {
throw newRequestException(
responseObject,
content,
"Can't get result object from $content"
)
})
}
}
}

View File

@@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.bot.exceptions
import dev.inmo.tgbotapi.types.Response
import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.types.*
import io.ktor.utils.io.errors.IOException
fun newRequestException(
@@ -16,6 +17,13 @@ fun newRequestException(
description == "Unauthorized" -> UnauthorizedException(response, plainAnswer, message, cause)
description.contains("PHOTO_INVALID_DIMENSIONS") -> InvalidPhotoDimensionsException(response, plainAnswer, message, cause)
description.contains("wrong file identifier") -> WrongFileIdentifierException(response, plainAnswer, message, cause)
description.contains("Too Many Requests") -> TooMuchRequestsException(
(response.parameters ?.error as? RetryAfterError) ?: RetryAfterError(60, DateTime.now().unixMillisLong),
response,
plainAnswer,
message,
cause
)
else -> null
}
} ?: CommonRequestException(response, plainAnswer, message, cause)
@@ -49,3 +57,6 @@ class InvalidPhotoDimensionsException(response: Response, plainAnswer: String, m
class WrongFileIdentifierException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
RequestException(response, plainAnswer, message, cause)
class TooMuchRequestsException(val retryAfter: RetryAfterError, response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
RequestException(response, plainAnswer, message, cause)

View File

@@ -1,5 +0,0 @@
package dev.inmo.tgbotapi.bot.settings.limiters
object EmptyLimiter : RequestLimiter {
override suspend fun <T> limit(block: suspend () -> T): T = block()
}

View File

@@ -0,0 +1,65 @@
package dev.inmo.tgbotapi.bot.settings.limiters
import dev.inmo.micro_utils.coroutines.safely
import dev.inmo.tgbotapi.bot.exceptions.TooMuchRequestsException
import dev.inmo.tgbotapi.types.*
import io.ktor.client.features.ClientRequestException
import io.ktor.http.HttpStatusCode
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.*
/**
* This limiter will limit requests only after getting a [RetryAfterError] or [ClientRequestException] with
* [HttpStatusCode.TooManyRequests] status code. Important thing is that in case if some of block has been blocked, all
* the others will wait until it will be possible to be called
*
* @param defaultTooManyRequestsDelay This parameter will be used in case of getting [ClientRequestException] with
* [HttpStatusCode.TooManyRequests] as a parameter for delay like it would be [TooMuchRequestsException]. The reason of
* it is that in [ClientRequestException] there is no information about required delay between requests
*/
class ExceptionsOnlyLimiter(
private val defaultTooManyRequestsDelay: MilliSeconds = 1000L
) : RequestLimiter {
private val lockState = MutableStateFlow(false)
private suspend fun lock(timeMillis: MilliSeconds) {
try {
safely {
lockState.emit(true)
delay(timeMillis)
}
} finally {
lockState.emit(false)
}
}
override suspend fun <T> limit(block: suspend () -> T): T {
while (true) {
lockState.first { !it }
val result = safely({
when (it) {
is TooMuchRequestsException -> {
lock(it.retryAfter.leftToRetry)
Result.failure(it)
}
is ClientRequestException -> {
if (it.response.status == HttpStatusCode.TooManyRequests) {
lock(defaultTooManyRequestsDelay)
} else {
throw it
}
Result.failure(it)
}
else -> throw it
}
}) {
Result.success(block())
}
if (result.isSuccess) {
return result.getOrNull()!!
}
}
}
}
@Deprecated("Renamed", ReplaceWith("ExceptionsOnlyLimiter", "dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter"))
typealias EmptyLimiter = ExceptionsOnlyLimiter

View File

@@ -1,8 +1,7 @@
package dev.inmo.tgbotapi.requests.webhook
import dev.inmo.tgbotapi.requests.abstracts.*
import dev.inmo.tgbotapi.requests.send.media.base.DataRequest
import dev.inmo.tgbotapi.requests.send.media.base.MultipartRequestImpl
import dev.inmo.tgbotapi.requests.send.media.base.*
import dev.inmo.tgbotapi.types.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@@ -13,14 +12,15 @@ private fun correctWebhookUrl(sourceUrl: String) = if (sourceUrl.contains("://")
"https://$sourceUrl"
}
fun SetWebhook(
sealed class SetWebhookRequest : Request<Boolean>
class MultipartSetWebhookRequest(
url: String,
certificate: MultipartFile,
ipAddress: String? = null,
maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null,
dropPendingUpdates: Boolean? = null
): MultipartRequestImpl<SetWebhook, Map<String, MultipartFile>, Boolean> = MultipartRequestImpl(
) : SetWebhookRequest(), MultipartRequest<Boolean> by MultipartRequestImpl(
SetWebhook(
correctWebhookUrl(url),
null as String?,
@@ -32,6 +32,22 @@ fun SetWebhook(
mapOf(certificateField to certificate)
)
fun SetWebhook(
url: String,
certificate: MultipartFile,
ipAddress: String? = null,
maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null,
dropPendingUpdates: Boolean? = null
): MultipartSetWebhookRequest = MultipartSetWebhookRequest(
correctWebhookUrl(url),
certificate,
ipAddress,
maxAllowedConnections,
allowedUpdates,
dropPendingUpdates
)
fun SetWebhook(
url: String,
certificate: FileId,
@@ -63,7 +79,7 @@ fun SetWebhook(
maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null,
dropPendingUpdates: Boolean? = null
): Request<Boolean> = when (certificate) {
) = when (certificate) {
is MultipartFile -> SetWebhook(correctWebhookUrl(url), certificate as MultipartFile, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates)
is FileId -> SetWebhook(correctWebhookUrl(url), certificate as FileId, ipAddress, maxAllowedConnections, allowedUpdates, dropPendingUpdates)
}
@@ -82,7 +98,7 @@ fun SetWebhook(
maxAllowedConnections: Int? = null,
allowedUpdates: List<String>? = null,
dropPendingUpdates: Boolean? = null
): Request<Boolean> = SetWebhook(
) = SetWebhook(
correctWebhookUrl(url),
null,
ipAddress,
@@ -112,7 +128,7 @@ data class SetWebhook internal constructor(
val allowedUpdates: List<String>? = null,
@SerialName(dropPendingUpdatesField)
val dropPendingUpdates: Boolean? = null
) : DataRequest<Boolean> {
) : SetWebhookRequest(), DataRequest<Boolean> {
override fun method(): String = "setWebhook"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()

View File

@@ -28,6 +28,7 @@ typealias GooglePlaceId = String
typealias GooglePlaceType = String
typealias Seconds = Int
typealias MilliSeconds = Long
typealias LongSeconds = Long
typealias Meters = Float

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.boldMarkdownV2
*/
data class BoldTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.boldMarkdown() }
override val asMarkdownV2Source: String by lazy { boldMarkdownV2() }

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.cashTagMarkdownV2
*/
data class CashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.cashTagMarkdown() }
override val asMarkdownV2Source: String by lazy { cashTagMarkdownV2() }

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.emailMarkdownV2
*/
data class EMailTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.emailMarkdown() }
override val asMarkdownV2Source: String by lazy { emailMarkdownV2(source) }

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.hashTagMarkdownV2
*/
data class HashTagTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.hashTagMarkdown() }
override val asMarkdownV2Source: String by lazy { hashTagMarkdownV2() }

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.italicMarkdownV2
*/
data class ItalicTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.italicMarkdown() }
override val asMarkdownV2Source: String by lazy { italicMarkdownV2() }

View File

@@ -18,7 +18,7 @@ private val String.withoutCommercialAt
*/
data class MentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.mentionMarkdown() }
override val asMarkdownV2Source: String by lazy { mentionMarkdownV2() }

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.phoneMarkdownV2
*/
data class PhoneNumberTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.phoneMarkdown() }
override val asMarkdownV2Source: String by lazy { phoneMarkdownV2() }

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.strikethroughMarkdownV2
*/
data class StrikethroughTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asHtmlSource: String by lazy { strikethroughHTML() }
override val asMarkdownV2Source: String by lazy { strikethroughMarkdownV2() }

View File

@@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.utils.internal.textMentionMarkdownV2
data class TextMentionTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
val user: User,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.textMentionMarkdown(user.id) }
override val asMarkdownV2Source: String by lazy { textMentionMarkdownV2(user.id) }

View File

@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.utils.internal.underlineMarkdownV2
*/
data class UnderlineTextSource @RiskFeature(DirectInvocationOfTextSourceConstructor) constructor (
override val source: String,
override val textSources: List<TextSource>
override val subsources: List<TextSource>
) : MultilevelTextSource {
override val asMarkdownSource: String by lazy { source.underlineMarkdown() }
override val asMarkdownV2Source: String by lazy { underlineMarkdownV2() }

View File

@@ -5,7 +5,7 @@ import com.soywiz.klock.DateTime
sealed class RequestError
data class RetryAfterError(
val seconds: Long,
val seconds: Seconds,
val startCountingMillis: Long
) : RequestError() {
val canContinue = (seconds * 1000L) + startCountingMillis

View File

@@ -8,7 +8,7 @@ data class ResponseParametersRaw(
@SerialName("migrate_to_chat_id")
private val migrateToChatId: ChatId? = null,
@SerialName("retry_after")
private val retryAfter: Long? = null
private val retryAfter: Seconds? = null
) {
@Transient
private val createTime: Long = DateTime.now().unixMillisLong

View File

@@ -4,11 +4,12 @@ import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.chat.abstracts.ChannelChat
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent
import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
data class ChannelEventMessage(
data class ChannelEventMessage<T : ChannelEvent>(
override val messageId: MessageIdentifier,
override val chat: ChannelChat,
override val chatEvent: ChannelEvent,
override val chatEvent: T,
override val date: DateTime
) : ChatEventMessage
) : ChatEventMessage<T>

View File

@@ -1,3 +1,3 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.abstracts
interface SupergroupEvent: ChatEvent
interface SupergroupEvent: GroupEvent

View File

@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent
import dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage
@Deprecated("Renamed", ReplaceWith("CommonGroupEventMessage"))
typealias GroupEventMessage = CommonGroupEventMessage
typealias GroupEventMessage = CommonGroupEventMessage<*>
data class CommonGroupEventMessage(
data class CommonGroupEventMessage<T : GroupEvent>(
override val messageId: MessageIdentifier,
override val user: User,
override val chat: GroupChat,
override val chatEvent: GroupEvent,
override val chatEvent: T,
override val date: DateTime
) : GroupEventMessage
) : GroupEventMessage<T>

View File

@@ -4,16 +4,17 @@ import com.soywiz.klock.DateTime
import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.User
import dev.inmo.tgbotapi.types.chat.abstracts.SupergroupChat
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent
import dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage
@Deprecated("Renamed", ReplaceWith("CommonSupergroupEventMessage"))
typealias SupergroupEventMessage = CommonSupergroupEventMessage
typealias SupergroupEventMessage = CommonSupergroupEventMessage<*>
data class CommonSupergroupEventMessage(
data class CommonSupergroupEventMessage<T : SupergroupEvent>(
override val messageId: MessageIdentifier,
override val user: User,
override val chat: SupergroupChat,
override val chatEvent: SupergroupEvent,
override val chatEvent: T,
override val date: DateTime
) : SupergroupEventMessage
) : SupergroupEventMessage<T>

View File

@@ -38,6 +38,7 @@ data class AnonymousGroupMessageImpl<T : MessageContent>(
data class CommonGroupMessageImpl<T : MessageContent>(
override val chat: GroupChat,
override val messageId: MessageIdentifier,
override val user: User,
override val date: DateTime,
override val forwardInfo: ForwardInfo?,
override val editDate: DateTime?,

View File

@@ -296,6 +296,7 @@ internal data class RawMessage(
null -> CommonGroupMessageImpl(
chat,
messageId,
from ?: error("It is expected that in messages from non anonymous users and channels user must be specified"),
date.asDate,
forwarded,
edit_date ?.asDate,

View File

@@ -2,6 +2,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChatEvent
interface ChatEventMessage : Message {
val chatEvent: ChatEvent
interface ChatEventMessage<T : ChatEvent> : Message {
val chatEvent: T
}

View File

@@ -1,3 +1,5 @@
package dev.inmo.tgbotapi.types.message.abstracts
interface GroupEventMessage : ChatEventMessage, FromUserMessage
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent
interface GroupEventMessage<T : GroupEvent> : ChatEventMessage<T>, FromUserMessage

View File

@@ -17,4 +17,4 @@ interface AnonymousGroupMessage<T : MessageContent> : GroupMessage<T>, SignedMes
override val senderChat: GroupChat
get() = chat
}
interface CommonGroupMessage<T : MessageContent> : GroupMessage<T>
interface CommonGroupMessage<T : MessageContent> : GroupMessage<T>, FromUserMessage

View File

@@ -1,3 +1,5 @@
package dev.inmo.tgbotapi.types.message.abstracts
interface SupergroupEventMessage : GroupEventMessage
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent
interface SupergroupEventMessage<T : SupergroupEvent> : GroupEventMessage<T>

View File

@@ -1,7 +1,6 @@
package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.CommonAbstracts.TextSourcesList
import dev.inmo.tgbotapi.CommonAbstracts.TextPart
import dev.inmo.tgbotapi.CommonAbstracts.*
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.SendTextMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
@@ -15,13 +14,13 @@ import dev.inmo.tgbotapi.utils.internal.fullListOfSubSource
import dev.inmo.tgbotapi.utils.internal.toMarkdownTexts
data class TextContent(
val text: String,
/**
* Not full list of entities. This list WILL NOT contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
* @see [TextContent.fullEntitiesList]
*/
val entities: List<TextPart> = emptyList()
) : MessageContent {
override val text: String,
override val textEntities: List<TextPart> = emptyList()
) : MessageContent, TextedInput {
@Deprecated("Has been renamed", ReplaceWith("textEntities"))
val entities: List<TextPart>
get() = textEntities
override fun createResend(
chatId: ChatIdentifier,
disableNotification: Boolean,
@@ -83,4 +82,5 @@ data class TextContent(
* Convert its [TextContent.entities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
*/
@Deprecated("Useless due to the fact that currently every message contains full list of sources")
fun TextContent.fullEntitiesList(): TextSourcesList = text.fullListOfSubSource(entities).map { it.source }

View File

@@ -83,19 +83,19 @@ private fun List<TextSource>.joinSubSourcesHtml() = joinToString("") {
internal fun MultilevelTextSource.markdownV2Default(
openControlSymbol: String,
closeControlSymbol: String = openControlSymbol
) = "$openControlSymbol${textSources.joinSubSourcesMarkdownV2()}$closeControlSymbol"
) = "$openControlSymbol${subsources.joinSubSourcesMarkdownV2()}$closeControlSymbol"
internal fun MultilevelTextSource.htmlDefault(
openControlSymbol: String,
closeControlSymbol: String = openControlSymbol
) = "<$openControlSymbol>${textSources.joinSubSourcesHtml()}</$closeControlSymbol>"
) = "<$openControlSymbol>${subsources.joinSubSourcesHtml()}</$closeControlSymbol>"
internal fun MultilevelTextSource.linkMarkdownV2(
link: String
) = "[${textSources.joinSubSourcesMarkdownV2()}](${link.escapeMarkdownV2Link()})"
) = "[${subsources.joinSubSourcesMarkdownV2()}](${link.escapeMarkdownV2Link()})"
internal fun MultilevelTextSource.linkHTML(
link: String
) = "<a href=\"${link.toHtml()}\">${textSources.joinSubSourcesHtml()}</a>"
) = "<a href=\"${link.toHtml()}\">${subsources.joinSubSourcesHtml()}</a>"
internal fun MultilevelTextSource.optionalPrefix(
@@ -116,8 +116,8 @@ internal fun MultilevelTextSource.boldMarkdownV2(): String = markdownV2Default(m
internal fun MultilevelTextSource.boldHTML(): String = htmlDefault(htmlBoldControl)
internal fun MultilevelTextSource.cashTagMarkdownV2(): String = textSources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.cashTagHTML(): String = textSources.joinSubSourcesHtml()
internal fun MultilevelTextSource.cashTagMarkdownV2(): String = subsources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.cashTagHTML(): String = subsources.joinSubSourcesHtml()
internal fun MultilevelTextSource.italicMarkdownV2(): String = markdownV2Default(markdownItalicControl)
@@ -135,21 +135,21 @@ internal fun MultilevelTextSource.underlineHTML(): String = htmlDefault(htmlUnde
internal fun MultilevelTextSource.textMentionMarkdownV2(userId: UserId): String = linkMarkdownV2(userId.link)
internal fun MultilevelTextSource.textMentionHTML(userId: UserId): String = linkHTML(userId.link)
internal fun MultilevelTextSource.mentionMarkdownV2(): String = optionalPrefix("@") + textSources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.mentionHTML(): String = optionalPrefix("@") + textSources.joinSubSourcesHtml()
internal fun MultilevelTextSource.mentionMarkdownV2(): String = optionalPrefix("@") + subsources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.mentionHTML(): String = optionalPrefix("@") + subsources.joinSubSourcesHtml()
internal fun MultilevelTextSource.hashTagMarkdownV2(): String = when {
source.startsWith("\\#") || source.startsWith("#") -> ""
else -> "\\#"
} + textSources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.hashTagHTML(): String = optionalPrefix("#") + textSources.joinSubSourcesHtml()
} + subsources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.hashTagHTML(): String = optionalPrefix("#") + subsources.joinSubSourcesHtml()
internal fun MultilevelTextSource.phoneMarkdownV2(): String = textSources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.phoneHTML(): String = textSources.joinSubSourcesHtml()
internal fun MultilevelTextSource.phoneMarkdownV2(): String = subsources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.phoneHTML(): String = subsources.joinSubSourcesHtml()
internal fun MultilevelTextSource.commandMarkdownV2(): String = optionalPrefix("/") + textSources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.commandHTML(): String = optionalPrefix("/") + textSources.joinSubSourcesHtml()
internal fun MultilevelTextSource.commandMarkdownV2(): String = optionalPrefix("/") + subsources.joinSubSourcesMarkdownV2()
internal fun MultilevelTextSource.commandHTML(): String = optionalPrefix("/") + subsources.joinSubSourcesHtml()

View File

@@ -49,8 +49,8 @@ fun List<TextPart>.testTextParts() {
assertTrue (get(5).source is MentionTextSource)
val boldSource = get(1).source as BoldTextSource
assertTrue (boldSource.textSources.first() is ItalicTextSource)
assertTrue (boldSource.textSources[1] is RegularTextSource)
assertTrue (boldSource.textSources[2] is StrikethroughTextSource)
assertTrue ((boldSource.textSources[2] as StrikethroughTextSource).textSources.first() is UnderlineTextSource)
assertTrue (boldSource.subsources.first() is ItalicTextSource)
assertTrue (boldSource.subsources[1] is RegularTextSource)
assertTrue (boldSource.subsources[2] is StrikethroughTextSource)
assertTrue ((boldSource.subsources[2] as StrikethroughTextSource).subsources.first() is UnderlineTextSource)
}

View File

@@ -40,11 +40,7 @@ kotlin {
commonMain {
dependencies {
implementation kotlin('stdlib')
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
api "${project.group}:tgbotapi.core:$library_version"
} else {
api project(":tgbotapi.core")
}
api project(":tgbotapi.core")
}
}
}

View File

@@ -1 +1 @@
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}

View File

@@ -27,6 +27,7 @@ bintray {
}
publish = true
override = true
pkg {
repo = "TelegramBotAPI"

View File

@@ -40,11 +40,7 @@ kotlin {
commonMain {
dependencies {
implementation kotlin('stdlib')
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
api "${project.group}:tgbotapi.core:$library_version"
} else {
api project(":tgbotapi.core")
}
api project(":tgbotapi.core")
}
}
}

View File

@@ -1 +1 @@
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Utility Extensions","description":"Util extensions for more useful work with updates and other things","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-utils","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Utility Extensions","description":"Util extensions for more useful work with updates and other things","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-utils","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}

View File

@@ -27,6 +27,7 @@ bintray {
}
publish = true
override = true
pkg {
repo = "TelegramBotAPI"

View File

@@ -1,13 +1,13 @@
package dev.inmo.tgbotapi.extensions.utils.chat_events
import dev.inmo.tgbotapi.types.message.*
import dev.inmo.tgbotapi.extensions.utils.shortcuts.*
import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.mapNotNull
import kotlin.reflect.KClass
fun <T : ChatEventMessage> Flow<ChatEventMessage>.divideBySource(contentType: KClass<T>) = mapNotNull {
@Deprecated("Refactored, replaced and renamed", ReplaceWith("filterByChatEvent", "dev.inmo.tgbotapi.extensions.utils.shortcuts.filterByChatEvent"))
fun <T : ChatEventMessage<*>> Flow<ChatEventMessage<*>>.divideBySource(contentType: KClass<T>) = mapNotNull {
if (contentType.isInstance(it)) {
@Suppress("UNCHECKED_CAST")
it as T
@@ -16,6 +16,9 @@ fun <T : ChatEventMessage> Flow<ChatEventMessage>.divideBySource(contentType: KC
}
}
fun Flow<ChatEventMessage>.onlyChannelEvents() = divideBySource(ChannelEventMessage::class)
fun Flow<ChatEventMessage>.onlyGroupEvents() = divideBySource(CommonGroupEventMessage::class)
fun Flow<ChatEventMessage>.onlySupergroupEvents() = divideBySource(CommonSupergroupEventMessage::class)
@Deprecated("Replaced and renamed", ReplaceWith("channelEvents", "dev.inmo.tgbotapi.extensions.utils.shortcuts.channelEvents"))
fun Flow<ChatEventMessage<*>>.onlyChannelEvents() = channelEvents()
@Deprecated("Replaced and renamed", ReplaceWith("groupEvents", "dev.inmo.tgbotapi.extensions.utils.shortcuts.groupEvents"))
fun Flow<ChatEventMessage<*>>.onlyGroupEvents() = groupEvents()
@Deprecated("Replaced and renamed", ReplaceWith("supergroupEvents", "dev.inmo.tgbotapi.extensions.utils.shortcuts.supergroupEvents"))
fun Flow<ChatEventMessage<*>>.onlySupergroupEvents() = supergroupEvents()

View File

@@ -0,0 +1,140 @@
@file:Suppress("NOTHING_TO_INLINE", "unused")
package dev.inmo.tgbotapi.extensions.utils.formatting
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.types.User
fun buildEntities(init: EntitiesBuilder.() -> Unit): List<TextSource> = EntitiesBuilder().apply(init).build()
/**
* This builder can be used to provide building of [TextSource]s [List]
*
* @see buildEntities
*/
class EntitiesBuilder internal constructor(
private val entitiesList: MutableList<TextSource> = mutableListOf()
) {
/**
* It is not safe field which contains potentially changeable [List]
*/
val entities: List<TextSource>
get() = entitiesList
/**
* @return New immutable list which will be deattached from this builder
*/
fun build(): List<TextSource> = entities.toList()
fun add(source: TextSource) { entitiesList.add(source) }
operator fun TextSource.unaryPlus() = add(this)
operator fun List<TextSource>.unaryPlus() = entitiesList.addAll(this)
operator fun invoke(vararg source: TextSource) = entitiesList.addAll(source)
operator fun String.unaryPlus() {
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.regular(this))
}
}
inline fun EntitiesBuilder.bold(parts: List<TextSource>) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(parts))
inline fun EntitiesBuilder.bold(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(*parts))
inline fun EntitiesBuilder.bold(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.bold(text))
inline fun EntitiesBuilder.botCommand(command: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.botCommand(command))
inline fun EntitiesBuilder.cashTag(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.cashTag(parts))
inline fun EntitiesBuilder.cashTag(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.cashTag(*parts))
inline fun EntitiesBuilder.cashTag(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.cashTag(text))
inline fun EntitiesBuilder.code(code: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.code(code))
inline fun EntitiesBuilder.email(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(parts))
inline fun EntitiesBuilder.email(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(*parts))
inline fun EntitiesBuilder.email(emailAddress: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.email(emailAddress))
inline fun EntitiesBuilder.hashtag(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(parts))
inline fun EntitiesBuilder.hashtag(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(*parts))
inline fun EntitiesBuilder.hashtag(hashtag: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.hashtag(hashtag))
inline fun EntitiesBuilder.italic(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(parts))
inline fun EntitiesBuilder.italic(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(*parts))
inline fun EntitiesBuilder.italic(text: String) = add(dev.inmo.tgbotapi.types.MessageEntity.textsources.italic(text))
inline fun EntitiesBuilder.mention(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(parts))
inline fun EntitiesBuilder.mention(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(*parts))
inline fun EntitiesBuilder.mention(whoToMention: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(whoToMention))
inline fun EntitiesBuilder.mention(parts: List<TextSource>, user: User) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(parts, user))
inline fun EntitiesBuilder.mention(user: User, vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(user, *parts))
inline fun EntitiesBuilder.mention(text: String, user: User) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.mention(text, user))
inline fun EntitiesBuilder.phone(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.phone(parts))
inline fun EntitiesBuilder.phone(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.phone(*parts))
inline fun EntitiesBuilder.phone(number: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.phone(number))
inline fun EntitiesBuilder.pre(code: String, language: String?) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.pre(code, language))
inline fun EntitiesBuilder.regular(text: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.regular(text))
inline fun EntitiesBuilder.strikethrough(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough(parts))
inline fun EntitiesBuilder.strikethrough(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough(*parts))
inline fun EntitiesBuilder.strikethrough(text: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.strikethrough(text))
inline fun EntitiesBuilder.link(text: String, url: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.link(text, url))
inline fun EntitiesBuilder.link(url: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.link(url))
inline fun EntitiesBuilder.underline(parts: List<TextSource>) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.underline(parts))
inline fun EntitiesBuilder.underline(vararg parts: TextSource) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.underline(*parts))
inline fun EntitiesBuilder.underline(text: String) =
add(dev.inmo.tgbotapi.types.MessageEntity.textsources.underline(text))

View File

@@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.extensions.utils.shortcuts
import dev.inmo.tgbotapi.CommonAbstracts.TextSource
import dev.inmo.tgbotapi.CommonAbstracts.textSources
import dev.inmo.tgbotapi.extensions.utils.onlyTextContentMessages
import dev.inmo.tgbotapi.extensions.utils.updates.asContentMessagesFlow
import dev.inmo.tgbotapi.types.MessageEntity.textsources.BotCommandTextSource
@@ -27,7 +28,7 @@ import kotlinx.coroutines.flow.*
fun <T : ContentMessage<TextContent>> Flow<T>.filterExactCommands(
commandRegex: Regex
) = filter { contentMessage ->
(contentMessage.content.fullEntitiesList().singleOrNull() as? BotCommandTextSource) ?.let { commandRegex.matches(it.command) } == true
(contentMessage.content.textSources.singleOrNull() as? BotCommandTextSource) ?.let { commandRegex.matches(it.command) } == true
}
/**
@@ -46,7 +47,7 @@ fun <T : ContentMessage<TextContent>> Flow<T>.filterExactCommands(
fun <T : ContentMessage<TextContent>> Flow<T>.filterCommandsInsideTextMessages(
commandRegex: Regex
) = filter { contentMessage ->
contentMessage.content.fullEntitiesList().any {
contentMessage.content.textSources.any {
(it as? BotCommandTextSource) ?.let { commandRegex.matches(it.command) } == true
}
}
@@ -70,7 +71,7 @@ fun <T : ContentMessage<TextContent>> Flow<T>.filterCommandsInsideTextMessages(
fun <T : ContentMessage<TextContent>> Flow<T>.filterCommandsWithArgs(
commandRegex: Regex
) = mapNotNull { contentMessage ->
val allEntities = contentMessage.content.fullEntitiesList()
val allEntities = contentMessage.content.textSources
(allEntities.firstOrNull() as? BotCommandTextSource) ?.let {
if (commandRegex.matches(it.command)) {
contentMessage to allEntities.flatMap {

View File

@@ -0,0 +1,98 @@
@file:Suppress("NOTHING_TO_INLINE", "unused", "EXPERIMENTAL_API_USAGE")
package dev.inmo.tgbotapi.extensions.utils.shortcuts
import dev.inmo.micro_utils.coroutines.plus
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
import dev.inmo.tgbotapi.utils.RiskFeature
import kotlinx.coroutines.flow.*
@RiskFeature("Use with caution")
inline fun FlowsUpdatesFilter.events(): Flow<ChatEventMessage<*>> {
return channelPostFlow.mapNotNull { it.data as? ChatEventMessage<*> } + messageFlow.mapNotNull { it.data as? ChatEventMessage<*> }
}
@RiskFeature("Use with caution")
inline fun FlowsUpdatesFilter.channelEvents(): Flow<ChannelEventMessage<*>> = channelPostFlow.mapNotNull {
it.data as? ChannelEventMessage<*>
}
@RiskFeature("Use with caution")
inline fun FlowsUpdatesFilter.groupEvents(): Flow<GroupEventMessage<*>> = messageFlow.mapNotNull {
it.data as? GroupEventMessage<*>
}
@RiskFeature("Use with caution")
inline fun FlowsUpdatesFilter.supergroupEvents(): Flow<SupergroupEventMessage<*>> = messageFlow.mapNotNull {
it.data as? SupergroupEventMessage<*>
}
@RiskFeature("Use with caution")
inline fun <reified T: ChatEvent, reified O: ChatEventMessage<T>> Flow<ChatEventMessage<*>>.filterByChatEvent(): Flow<O> = mapNotNull {
if (it.chatEvent is T) it as? O else null
}
@RiskFeature("Use with caution")
inline fun <reified T : ChannelEvent> Flow<ChatEventMessage<*>>.filterChannelEvents() = filterByChatEvent<T, ChannelEventMessage<T>>()
@RiskFeature("Use with caution")
inline fun <reified T : ChannelEvent> FlowsUpdatesFilter.filterChannelEvents() = channelEvents().filterChannelEvents<T>()
inline fun Flow<ChatEventMessage<*>>.channelCreatedEvents() = filterChannelEvents<ChannelChatCreated>()
inline fun FlowsUpdatesFilter.channelCreatedEvents() = filterChannelEvents<ChannelChatCreated>()
inline fun Flow<ChatEventMessage<*>>.deletedChannelPhotoEvents() = filterChannelEvents<DeleteChatPhoto>()
inline fun FlowsUpdatesFilter.deletedChannelPhotoEvents() = filterChannelEvents<DeleteChatPhoto>()
inline fun Flow<ChatEventMessage<*>>.newChannelPhotoEvents() = filterChannelEvents<NewChatPhoto>()
inline fun FlowsUpdatesFilter.newChannelPhotoEvents() = filterChannelEvents<NewChatPhoto>()
inline fun Flow<ChatEventMessage<*>>.newChannelTitleEvents() = filterChannelEvents<NewChatTitle>()
inline fun FlowsUpdatesFilter.newChannelTitleEvents() = filterChannelEvents<NewChatTitle>()
inline fun Flow<ChatEventMessage<*>>.newChannelPinnedMessageEvents() = filterChannelEvents<PinnedMessage>()
inline fun FlowsUpdatesFilter.newChannelPinnedMessageEvents() = filterChannelEvents<PinnedMessage>()
inline fun Flow<ChatEventMessage<*>>.channelEvents() = filterChannelEvents<ChannelEvent>()
@RiskFeature("Use with caution")
inline fun <reified T : GroupEvent> Flow<ChatEventMessage<*>>.filterGroupEvents() = filterByChatEvent<T, GroupEventMessage<T>>()
@RiskFeature("Use with caution")
inline fun <reified T : GroupEvent> FlowsUpdatesFilter.filterGroupEvents() = groupEvents().filterByChatEvent<T, GroupEventMessage<T>>()
inline fun Flow<ChatEventMessage<*>>.groupCreatedEvents() = filterGroupEvents<GroupChatCreated>()
inline fun FlowsUpdatesFilter.groupCreatedEvents() = filterGroupEvents<GroupChatCreated>()
inline fun Flow<ChatEventMessage<*>>.deletedGroupPhotoEvents() = filterGroupEvents<DeleteChatPhoto>()
inline fun FlowsUpdatesFilter.deletedGroupPhotoEvents() = filterGroupEvents<DeleteChatPhoto>()
inline fun Flow<ChatEventMessage<*>>.newGroupMembersEvents() = filterGroupEvents<NewChatMembers>()
inline fun FlowsUpdatesFilter.newGroupMembersEvents() = filterGroupEvents<NewChatMembers>()
inline fun Flow<ChatEventMessage<*>>.leftGroupMemberEvents() = filterGroupEvents<LeftChatMember>()
inline fun FlowsUpdatesFilter.leftGroupMemberEvents() = filterGroupEvents<LeftChatMember>()
inline fun Flow<ChatEventMessage<*>>.newGroupPhotoEvents() = filterGroupEvents<NewChatPhoto>()
inline fun FlowsUpdatesFilter.newGroupPhotoEvents() = filterGroupEvents<NewChatPhoto>()
inline fun Flow<ChatEventMessage<*>>.newGroupTitleEvents() = filterGroupEvents<NewChatTitle>()
inline fun FlowsUpdatesFilter.newGroupTitleEvents() = filterGroupEvents<NewChatTitle>()
inline fun Flow<ChatEventMessage<*>>.newGroupPinnedMessageEvents() = filterGroupEvents<PinnedMessage>()
inline fun FlowsUpdatesFilter.newGroupPinnedMessageEvents() = filterGroupEvents<PinnedMessage>()
inline fun Flow<ChatEventMessage<*>>.proximityAlertTriggeredInGroupEvents() = filterGroupEvents<ProximityAlertTriggered>()
inline fun FlowsUpdatesFilter.proximityAlertTriggeredInGroupEvents() = filterGroupEvents<ProximityAlertTriggered>()
inline fun Flow<ChatEventMessage<*>>.groupEvents() = filterGroupEvents<GroupEvent>()
@RiskFeature("Use with caution")
inline fun <reified T : SupergroupEvent> Flow<ChatEventMessage<*>>.filterSupergroupEvents() = filterByChatEvent<T, SupergroupEventMessage<T>>()
@RiskFeature("Use with caution")
inline fun <reified T : SupergroupEvent> FlowsUpdatesFilter.filterSupergroupEvents() = supergroupEvents().filterByChatEvent<T, SupergroupEventMessage<T>>()
inline fun Flow<ChatEventMessage<*>>.supergroupCreatedEvents() = filterSupergroupEvents<SupergroupChatCreated>()
inline fun FlowsUpdatesFilter.supergroupCreatedEvents() = filterSupergroupEvents<SupergroupChatCreated>()
inline fun Flow<ChatEventMessage<*>>.deletedSupergroupPhotoEvents() = filterSupergroupEvents<DeleteChatPhoto>()
inline fun FlowsUpdatesFilter.deletedSupergroupPhotoEvents() = filterSupergroupEvents<DeleteChatPhoto>()
inline fun Flow<ChatEventMessage<*>>.newSupergroupMembersEvents() = filterSupergroupEvents<NewChatMembers>()
inline fun FlowsUpdatesFilter.newSupergroupMembersEvents() = filterSupergroupEvents<NewChatMembers>()
inline fun Flow<ChatEventMessage<*>>.leftSupergroupMemberEvents() = filterSupergroupEvents<LeftChatMember>()
inline fun FlowsUpdatesFilter.leftSupergroupMemberEvents() = filterSupergroupEvents<LeftChatMember>()
inline fun Flow<ChatEventMessage<*>>.newSupergroupPhotoEvents() = filterSupergroupEvents<NewChatPhoto>()
inline fun FlowsUpdatesFilter.newSupergroupPhotoEvents() = filterSupergroupEvents<NewChatPhoto>()
inline fun Flow<ChatEventMessage<*>>.newSupergroupTitleEvents() = filterSupergroupEvents<NewChatTitle>()
inline fun FlowsUpdatesFilter.newSupergroupTitleEvents() = filterSupergroupEvents<NewChatTitle>()
inline fun Flow<ChatEventMessage<*>>.newSupergroupPinnedMessageEvents() = filterSupergroupEvents<PinnedMessage>()
inline fun FlowsUpdatesFilter.newSupergroupPinnedMessageEvents() = filterSupergroupEvents<PinnedMessage>()
inline fun Flow<ChatEventMessage<*>>.proximityAlertTriggeredInSupergroupEvents() = filterSupergroupEvents<ProximityAlertTriggered>()
inline fun FlowsUpdatesFilter.proximityAlertTriggeredInSupergroupEvents() = filterSupergroupEvents<ProximityAlertTriggered>()
inline fun Flow<ChatEventMessage<*>>.supergroupEvents() = filterSupergroupEvents<SupergroupEvent>()

View File

@@ -19,12 +19,15 @@ fun <T : BaseSentMessageUpdate> Flow<T>.asCommonMessagesFlow() = mapNotNull {
it.data as? CommonMessage<*>
}
@Suppress("NOTHING_TO_INLINE")
inline fun <T : BaseSentMessageUpdate> Flow<T>.chatEvents() = mapNotNull {
it.data as? ChatEventMessage<*>
}
/**
* Will map incoming [BaseSentMessageUpdate]s to [ChatEventMessage] from [BaseSentMessageUpdate.data]
*/
fun <T : BaseSentMessageUpdate> Flow<T>.asChatEventsFlow() = mapNotNull {
it.data as? ChatEventMessage
}
@Deprecated("Renamed", ReplaceWith("chatEvents", "dev.inmo.tgbotapi.extensions.utils.updates.chatEvents"))
fun <T : BaseSentMessageUpdate> Flow<T>.asChatEventsFlow() = chatEvents()
/**
* Will map incoming [BaseSentMessageUpdate]s to [UnknownMessageType] from [BaseSentMessageUpdate.data]

View File

@@ -5,10 +5,7 @@ import dev.inmo.micro_utils.coroutines.safely
import dev.inmo.tgbotapi.bot.RequestsExecutor
import dev.inmo.tgbotapi.extensions.utils.nonstrictJsonFormat
import dev.inmo.tgbotapi.extensions.utils.updates.flowsUpdatesFilter
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.send.media.base.MultipartRequestImpl
import dev.inmo.tgbotapi.requests.webhook.SetWebhook
import dev.inmo.tgbotapi.requests.webhook.SetWebhookRequest
import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.types.update.abstracts.UpdateDeserializationStrategy
import dev.inmo.tgbotapi.updateshandlers.*
@@ -67,7 +64,7 @@ fun Route.includeWebhookHandlingInRouteWithFlows(
)
/**
* Setting up ktor server, set webhook info via [SetWebhook] request.
* Setting up ktor server
*
* @param listenPort port which will be listen by bot
* @param listenRoute address to listen by bot. If null - will be set up in root of host
@@ -119,27 +116,8 @@ fun startListenWebhooks(
}
}
private suspend fun RequestsExecutor.internalSetWebhookInfoAndStartListenWebhooks(
listenPort: Int,
engineFactory: ApplicationEngineFactory<*, *>,
setWebhookRequest: Request<Boolean>,
exceptionsHandler: ExceptionHandler<Unit> = {},
listenHost: String = "0.0.0.0",
listenRoute: String? = null,
privateKeyConfig: WebhookPrivateKeyConfig? = null,
scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),
block: UpdateReceiver<Update>
): ApplicationEngine {
return try {
execute(setWebhookRequest)
startListenWebhooks(listenPort, engineFactory, exceptionsHandler, listenHost, listenRoute, privateKeyConfig, scope, block)
} catch (e: Exception) {
throw e
}
}
/**
* Setting up ktor server, set webhook info via [SetWebhook] request.
* Setting up ktor server, set webhook info via [SetWebhookRequest] request.
*
* @param listenPort port which will be listen by bot
* @param listenRoute address to listen by bot
@@ -153,55 +131,16 @@ private suspend fun RequestsExecutor.internalSetWebhookInfoAndStartListenWebhook
suspend fun RequestsExecutor.setWebhookInfoAndStartListenWebhooks(
listenPort: Int,
engineFactory: ApplicationEngineFactory<*, *>,
setWebhookRequest: SetWebhook,
setWebhookRequest: SetWebhookRequest,
exceptionsHandler: ExceptionHandler<Unit> = {},
listenHost: String = "0.0.0.0",
listenRoute: String = "/",
privateKeyConfig: WebhookPrivateKeyConfig? = null,
scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),
block: UpdateReceiver<Update>
): ApplicationEngine = internalSetWebhookInfoAndStartListenWebhooks(
listenPort,
engineFactory,
setWebhookRequest as Request<Boolean>,
exceptionsHandler,
listenHost,
listenRoute,
privateKeyConfig,
scope,
block
)
/**
* Setting up ktor server, set webhook info via [SetWebhook] request.
*
* @param listenPort port which will be listen by bot
* @param listenRoute address to listen by bot
* @param scope Scope which will be used for
*
* @see dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
* @see UpdatesFilter
* @see UpdatesFilter.asUpdateReceiver
*/
@Suppress("unused")
suspend fun RequestsExecutor.setWebhookInfoAndStartListenWebhooks(
listenPort: Int,
engineFactory: ApplicationEngineFactory<*, *>,
setWebhookRequest: MultipartRequestImpl<SetWebhook, Map<String, MultipartFile>, Boolean>,
exceptionsHandler: ExceptionHandler<Unit> = {},
listenHost: String = "0.0.0.0",
listenRoute: String? = null,
privateKeyConfig: WebhookPrivateKeyConfig? = null,
scope: CoroutineScope = CoroutineScope(Executors.newFixedThreadPool(4).asCoroutineDispatcher()),
block: UpdateReceiver<Update>
): ApplicationEngine = internalSetWebhookInfoAndStartListenWebhooks(
listenPort,
engineFactory,
setWebhookRequest as Request<Boolean>,
exceptionsHandler,
listenHost,
listenRoute,
privateKeyConfig,
scope,
block
)
): ApplicationEngine = try {
execute(setWebhookRequest)
startListenWebhooks(listenPort, engineFactory, exceptionsHandler, listenHost, listenRoute, privateKeyConfig, scope, block)
} catch (e: Exception) {
throw e
}

View File

@@ -40,15 +40,9 @@ kotlin {
commonMain {
dependencies {
implementation kotlin('stdlib')
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
api "${project.group}:tgbotapi.core:$library_version"
api "${project.group}:tgbotapi.extensions.api:$library_version"
api "${project.group}:tgbotapi.extensions.utils:$library_version"
} else {
api project(":tgbotapi.core")
api project(":tgbotapi.extensions.api")
api project(":tgbotapi.extensions.utils")
}
api project(":tgbotapi.core")
api project(":tgbotapi.extensions.api")
api project(":tgbotapi.extensions.utils")
}
}
}

View File

@@ -1 +1 @@
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API","description":"This project just include all subproject of TelegramBotAPI","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
{"bintrayConfig":{"repo":"TelegramBotAPI","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API","description":"This project just include all subproject of TelegramBotAPI","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}

View File

@@ -27,6 +27,7 @@ bintray {
}
publish = true
override = true
pkg {
repo = "TelegramBotAPI"