1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-26 03:58:44 +00:00

Merge pull request #543 from InsanusMokrassar/0.38.8

0.38.8
This commit is contained in:
InsanusMokrassar 2022-03-19 21:15:03 +06:00 committed by GitHub
commit 1369680419
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 5 deletions

View File

@ -1,5 +1,19 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 0.38.8
* `Common`:
* `Version`:
* `MicroUtils`: `0.9.12` -> `0.9.16`
* `Klock`: `2.6.2` -> `2.6.3`
* `Ktor`: `1.6.7` -> `1.6.8`
* `BehaviourBuilder`:
* Fixes in `onMediaGroup` and dependent functions
* Add several new extensions for `SimpleFilter`:
* `SimpleFilter#listAll`
* `SimpleFilter#listAny`
* `SimpleFilter#listNone`
## 0.38.7 ## 0.38.7
* `Common`: * `Common`:

View File

@ -8,11 +8,11 @@ kotlin.incremental.js=true
kotlin_version=1.6.10 kotlin_version=1.6.10
kotlin_coroutines_version=1.6.0 kotlin_coroutines_version=1.6.0
kotlin_serialisation_runtime_version=1.3.2 kotlin_serialisation_runtime_version=1.3.2
klock_version=2.6.2 klock_version=2.6.3
uuid_version=0.4.0 uuid_version=0.4.0
ktor_version=1.6.7 ktor_version=1.6.8
micro_utils_version=0.9.12 micro_utils_version=0.9.16
javax_activation_version=1.1.1 javax_activation_version=1.1.1
@ -20,6 +20,6 @@ javax_activation_version=1.1.1
dokka_version=1.6.10 dokka_version=1.6.10
library_group=dev.inmo library_group=dev.inmo
library_version=0.38.7 library_version=0.38.8
github_release_plugin_version=2.2.12 github_release_plugin_version=2.2.12

View File

@ -22,7 +22,11 @@ internal suspend inline fun <BC : BehaviourContext, reified T : MediaGroupConten
markerFactory: MarkerFactory<in List<MediaGroupMessage<T>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in List<MediaGroupMessage<T>>, Any> = ByChatMediaGroupMarkerFactory,
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<T>>> noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<T>>>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
(it.asSentMediaGroupUpdate() ?.data ?.takeIf { it.all { it is T } } as? List<MediaGroupMessage<T>>) ?.let(::listOfNotNull) (it.asSentMediaGroupUpdate() ?.data ?.takeIf { messages ->
messages.all { message ->
message.content is T
}
} as? List<MediaGroupMessage<T>>) ?.let(::listOfNotNull)
} }
/** /**

View File

@ -4,6 +4,27 @@ typealias SimpleFilter<T> = suspend (T) -> Boolean
inline fun <T> SimpleFilter(noinline block: SimpleFilter<T>) = block inline fun <T> SimpleFilter(noinline block: SimpleFilter<T>) = block
/**
* @return [SimpleFilter] which will return true in case when all the items in incoming data passed [this] filter
*/
fun <T> SimpleFilter<T>.listAll() = SimpleFilter<Iterable<T>> {
it.all { this@listAll(it) }
}
/**
* @return [SimpleFilter] which will return true in case when there is any item in incoming data passed [this] filter
*/
fun <T> SimpleFilter<T>.listAny() = SimpleFilter<Iterable<T>> {
it.any { this@listAny(it) }
}
/**
* @return [SimpleFilter] which will return true in case when there is no any item in incoming data passed [this] filter
*/
fun <T> SimpleFilter<T>.listNone() = SimpleFilter<Iterable<T>> {
it.none { this@listNone(it) }
}
/** /**
* Makes an AND (&&) operation between [this] and [other] * Makes an AND (&&) operation between [this] and [other]
*/ */