1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00
This commit is contained in:
InsanusMokrassar 2020-05-10 16:33:44 +06:00
parent 34eb6eb4bf
commit 21e3e10222
3 changed files with 11 additions and 11 deletions

View File

@ -61,9 +61,9 @@
* `MediaGroupMemberInputMedia` children now can be deserialized (but only those ones who are declared inside library)
* `TelegramBotAPI-extensions-utils`:
* Chat events splitters added:
* Extension `Flow<ChatEventMessage>#channelEvents` was added
* Extension `Flow<ChatEventMessage>#groupEvents` was added
* Extension `Flow<ChatEventMessage>#supergroupEvents` was added
* Extension `Flow<ChatEventMessage>#onlyChannelEvents` was added
* Extension `Flow<ChatEventMessage>#onlyGroupEvents` was added
* Extension `Flow<ChatEventMessage>#onlySupergroupEvents` was added
### 0.27.1

View File

@ -116,15 +116,15 @@ filter.messageFlow.asContentMessagesFlow().onlyPhotoContentMessages().onEach {
)
```
##### Chat actions
#### Chat actions
Chat actions can be divided for three types of events source:
| Type | Flow extension |
|:---- |:-------------- |
| Channel events | `channelEvents` |
| Group events | `groupEvents` |
| Supergroup events | `supergroupEvents` |
| Channel events | `onlyChannelEvents` |
| Group events | `onlyGroupEvents` |
| Supergroup events | `onlySupergroupEvents` |
## Shortcuts

View File

@ -1,4 +1,4 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.chat_events
import com.github.insanusmokrassar.TelegramBotAPI.types.message.*
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ChatEventMessage
@ -16,6 +16,6 @@ fun <T : ChatEventMessage> Flow<ChatEventMessage>.divideBySource(contentType: KC
}
}
fun Flow<ChatEventMessage>.channelEvents() = divideBySource(ChannelEventMessage::class)
fun Flow<ChatEventMessage>.groupEvents() = divideBySource(GroupEventMessage::class)
fun Flow<ChatEventMessage>.supergroupEvents() = divideBySource(SupergroupEventMessage::class)
fun Flow<ChatEventMessage>.onlyChannelEvents() = divideBySource(ChannelEventMessage::class)
fun Flow<ChatEventMessage>.onlyGroupEvents() = divideBySource(GroupEventMessage::class)
fun Flow<ChatEventMessage>.onlySupergroupEvents() = divideBySource(SupergroupEventMessage::class)