mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 00:03:48 +00:00
commit
c8413e1d18
@ -1,5 +1,14 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 3.3.1
|
||||
|
||||
* `Versions`:
|
||||
* `Ktor`: `2.1.2` -> `2.1.3`
|
||||
* `Klock`: `3.2.0` -> `3.3.1`
|
||||
* `MicroUtils`: `0.13.1` -> `0.13.2`
|
||||
* `Utils`:
|
||||
* New extensions on `CommonMessage`: `hasCommands` and `hasNoCommands`. Useful for the `initialFilter` parameter in behaviour builder triggers.
|
||||
|
||||
## 3.3.0
|
||||
|
||||
**THIS VERSION CONTAINS UPGRADE KOTLIN (AND ALL RELATED LIBRARIES) UP TO 1.7.20**
|
||||
|
@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=3.3.0
|
||||
library_version=3.3.1
|
||||
|
@ -6,14 +6,14 @@ kotlin-coroutines = "1.6.4"
|
||||
|
||||
javax-activation = "1.1.1"
|
||||
|
||||
korlibs = "3.2.0"
|
||||
korlibs = "3.3.1"
|
||||
uuid = "0.5.0"
|
||||
ktor = "2.1.2"
|
||||
ktor = "2.1.3"
|
||||
|
||||
ksp = "1.7.20-1.0.7"
|
||||
kotlin-poet = "1.12.0"
|
||||
|
||||
microutils = "0.13.1"
|
||||
microutils = "0.13.2"
|
||||
|
||||
github-release-plugin = "2.4.1"
|
||||
|
||||
|
@ -17,7 +17,7 @@ class MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
||||
): Any? = (request as? MultipartRequest) ?.let { castedRequest ->
|
||||
MultiPartFormDataContent(
|
||||
formData {
|
||||
val params = castedRequest.paramsJson.mapWithCommonValues()
|
||||
val params = castedRequest.paramsJson.mapWithCommonValues() - castedRequest.mediaMap.keys
|
||||
for ((key, value) in castedRequest.mediaMap + params) {
|
||||
when (value) {
|
||||
is MultipartFile -> appendInput(
|
||||
|
@ -13,6 +13,7 @@ import kotlinx.serialization.json.JsonObject
|
||||
data class SetChatPhoto (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@Transient
|
||||
val photo: MultipartFile = throw IllegalArgumentException("Unfortunately, this type of objects can't be parsed automatically")
|
||||
): ChatRequest, MultipartRequest<Boolean> {
|
||||
override fun method(): String = "setChatPhoto"
|
||||
|
@ -0,0 +1,44 @@
|
||||
package dev.inmo.tgbotapi.extensions.utils.updates
|
||||
|
||||
import dev.inmo.tgbotapi.extensions.utils.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||
import dev.inmo.tgbotapi.types.message.textsources.BotCommandTextSource
|
||||
|
||||
/**
|
||||
* A predicate to test whether a message contains any commands in its body.
|
||||
* Use it as the `initialFilter` parameter in behaviour builder triggers.
|
||||
* E.g.
|
||||
*
|
||||
* ```kotlin
|
||||
* onContentMessage(
|
||||
* initialFilter = CommonMessage<MessageContent>::hasCommands
|
||||
* ) {
|
||||
* // the message contains at least one command here
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @return true if this [CommonMessage] contains any commands. False otherwise.
|
||||
* @see hasNoCommands
|
||||
*/
|
||||
fun CommonMessage<*>.hasCommands(): Boolean = withContentOrNull<TextContent>() ?.content ?.textSources ?.any {
|
||||
it is BotCommandTextSource
|
||||
} ?: false
|
||||
|
||||
/**
|
||||
* A predicate to test whether a message contains any commands in its body.
|
||||
* Use it as the `initialFilter` parameter in behaviour builder triggers.
|
||||
* E.g.
|
||||
*
|
||||
* ```kotlin
|
||||
* onContentMessage(
|
||||
* initialFilter = CommonMessage<MessageContent>::hasNoCommands
|
||||
* ) {
|
||||
* // the message contains no commands here
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @return true if this [CommonMessage] does not contain any commands. False otherwise.
|
||||
* @see hasCommands
|
||||
*/
|
||||
fun CommonMessage<*>.hasNoCommands(): Boolean = !this.hasCommands()
|
Loading…
Reference in New Issue
Block a user