1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

small update of utils readme

This commit is contained in:
InsanusMokrassar 2020-05-10 16:40:53 +06:00
parent 21e3e10222
commit 603efe9259

View File

@ -87,7 +87,7 @@ Unfortunately, due to the erasing of generic types, when you are using `asConten
data with type `ContentMessage<*>`. For correct filtering of content type for retrieved objects, was created special
filters:
| Type | Result type | Flow extension |
| Content type | Result type | Flow extension |
|:---- |:----------- |:-------------- |
| Animation | `ContentMessage<AnimationContent>`| `onlyAnimationContentMessages` |
| Audio | `ContentMessage<AudioContent>` | `onlyAudioContentMessages` |
@ -116,7 +116,7 @@ filter.messageFlow.asContentMessagesFlow().onlyPhotoContentMessages().onEach {
)
```
#### Chat actions
##### Chat actions
Chat actions can be divided for three types of events source:
@ -126,6 +126,16 @@ Chat actions can be divided for three types of events source:
| Group events | `onlyGroupEvents` |
| Supergroup events | `onlySupergroupEvents` |
According to this table, if you want to add filtering by supergroup events, you will use code like this:
```kotlin
filter.messageFlow.asChatEventsFlow().onlySupergroupEvents().onEach {
println(it.chatEvent)
}.launchIn(
CoroutineScope(Dispatchers.Default)
)
```
## Shortcuts
With shortcuts you are able to use simple factories for several things.