mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
add several functions and changelog notes
This commit is contained in:
parent
f6ec82b449
commit
b0219389fc
10
CHANGELOG.md
10
CHANGELOG.md
@ -4,7 +4,7 @@
|
||||
|
||||
* `Common`:
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.3.1` -> `0.3.2`
|
||||
* `MicroUtils`: `0.3.1` -> `0.3.3`
|
||||
* `Core`:
|
||||
* `MultilevelTextSource#textSources` has been safely renamed to `subsources`
|
||||
* `TextContent#fullEntitiesList` has been deprecated
|
||||
@ -14,7 +14,13 @@
|
||||
* `SupergroupEventMessage` now overrides `chatEvent` with type `SupergroupEvent`
|
||||
* Any `ChatEventMessage` now have generic type of its `chatEvent` (just like messages)
|
||||
* `Utils`:
|
||||
* A lot of extensions for `Flow<ChatEventMessage>` has been added
|
||||
* 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#channelEvents`
|
||||
|
||||
## 0.30.3
|
||||
|
||||
|
@ -12,7 +12,7 @@ klock_version=1.12.1
|
||||
uuid_version=0.2.2
|
||||
ktor_version=1.4.2
|
||||
|
||||
micro_utils_version=0.3.2
|
||||
micro_utils_version=0.3.3
|
||||
|
||||
javax_activation_version=1.1.1
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
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.*
|
||||
@ -10,14 +11,24 @@ 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 <reified T: GroupEventMessage<*>> FlowsUpdatesFilter.groupEvents(): Flow<T> = messageFlow.mapNotNull {
|
||||
it.data as? T
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user