mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
small update of utils readme
This commit is contained in:
parent
21e3e10222
commit
603efe9259
@ -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
|
data with type `ContentMessage<*>`. For correct filtering of content type for retrieved objects, was created special
|
||||||
filters:
|
filters:
|
||||||
|
|
||||||
| Type | Result type | Flow extension |
|
| Content type | Result type | Flow extension |
|
||||||
|:---- |:----------- |:-------------- |
|
|:---- |:----------- |:-------------- |
|
||||||
| Animation | `ContentMessage<AnimationContent>`| `onlyAnimationContentMessages` |
|
| Animation | `ContentMessage<AnimationContent>`| `onlyAnimationContentMessages` |
|
||||||
| Audio | `ContentMessage<AudioContent>` | `onlyAudioContentMessages` |
|
| 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:
|
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` |
|
| Group events | `onlyGroupEvents` |
|
||||||
| Supergroup events | `onlySupergroupEvents` |
|
| 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
|
## Shortcuts
|
||||||
|
|
||||||
With shortcuts you are able to use simple factories for several things.
|
With shortcuts you are able to use simple factories for several things.
|
||||||
|
Loading…
Reference in New Issue
Block a user