From 603efe9259cfa259b8decfa4da04b13f85434834 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 10 May 2020 16:40:53 +0600 Subject: [PATCH] small update of utils readme --- TelegramBotAPI-extensions-utils/README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/TelegramBotAPI-extensions-utils/README.md b/TelegramBotAPI-extensions-utils/README.md index 3353490ac4..b4b1e5bb66 100644 --- a/TelegramBotAPI-extensions-utils/README.md +++ b/TelegramBotAPI-extensions-utils/README.md @@ -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`| `onlyAnimationContentMessages` | | Audio | `ContentMessage` | `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.