mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-26 03:58:44 +00:00
fixes in UpdatesChatFilters
This commit is contained in:
parent
ba76eaeb90
commit
bd87938e9c
@ -40,11 +40,13 @@
|
|||||||
|
|
||||||
### 0.26.2
|
### 0.26.2
|
||||||
|
|
||||||
|
* `TelegramBotAPI`:
|
||||||
|
* Now `EditMediaGroupUpdate` also extends `BaseEditMessageUpdate`
|
||||||
* `TelegramBotAPI-extensions-api`:
|
* `TelegramBotAPI-extensions-api`:
|
||||||
* `startGettingOfUpdates` extension which do not require filter (but return a new one) was added
|
* `startGettingOfUpdates` extension which do not require filter (but return a new one) was added
|
||||||
* `TelegramBotAPI-extensions-utils`:
|
* `TelegramBotAPI-extensions-utils`:
|
||||||
* Subproject was added
|
* Subproject was added
|
||||||
* `filterByChat` and `filterByChatId` extensions was added
|
* `filterBaseMessageUpdates`, `filterSentMediaGroupUpdates` and `filterEditMediaGroupUpdates` extensions was added
|
||||||
* `filterExactCommands` and `filterCommandsInsideTextMessages` extensions was added
|
* `filterExactCommands` and `filterCommandsInsideTextMessages` extensions was added
|
||||||
* `asContentMessagesFlow`, `asChatEventsFlow` and `asUnknownMessagesFlow` extensions was added
|
* `asContentMessagesFlow`, `asChatEventsFlow` and `asUnknownMessagesFlow` extensions was added
|
||||||
* `withContentType` extension was added
|
* `withContentType` extension was added
|
||||||
|
@ -7,19 +7,13 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMes
|
|||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.filter
|
import kotlinx.coroutines.flow.filter
|
||||||
|
|
||||||
fun <T : BaseMessageUpdate> Flow<T>.filterByChatId(chatId: ChatId): Flow<T> = filter {
|
fun <T : BaseMessageUpdate> Flow<T>.filterBaseMessageUpdates(chatId: ChatId): Flow<T> = filter {
|
||||||
it.data.chat.id == chatId
|
it.data.chat.id == chatId
|
||||||
}
|
}
|
||||||
fun <T : BaseMessageUpdate> Flow<T>.filterByChat(chat: Chat): Flow<T> = filterByChatId(chat.id)
|
fun <T : BaseMessageUpdate> Flow<T>.filterBaseMessageUpdates(chat: Chat): Flow<T> = filterBaseMessageUpdates(chat.id)
|
||||||
|
|
||||||
|
|
||||||
fun <T : SentMediaGroupUpdate> Flow<T>.filterByChatId(chatId: ChatId): Flow<T> = filter {
|
fun <T : SentMediaGroupUpdate> Flow<T>.filterSentMediaGroupUpdates(chatId: ChatId): Flow<T> = filter {
|
||||||
it.data.first().chat.id == chatId
|
it.data.first().chat.id == chatId
|
||||||
}
|
}
|
||||||
fun <T : SentMediaGroupUpdate> Flow<T>.filterByChatId(chat: Chat): Flow<T> = filterByChatId(chat.id)
|
fun <T : SentMediaGroupUpdate> Flow<T>.filterSentMediaGroupUpdates(chat: Chat): Flow<T> = filterSentMediaGroupUpdates(chat.id)
|
||||||
|
|
||||||
|
|
||||||
fun <T : EditMediaGroupUpdate> Flow<T>.filterByChatId(chatId: ChatId): Flow<T> = filter {
|
|
||||||
it.data.chat.id == chatId
|
|
||||||
}
|
|
||||||
fun <T : EditMediaGroupUpdate> Flow<T>.filterByChatId(chat: Chat): Flow<T> = filterByChatId(chat.id)
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
package com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates
|
package com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates
|
||||||
|
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
|
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate
|
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.*
|
||||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
|
||||||
|
|
||||||
interface MediaGroupUpdate : Update
|
interface MediaGroupUpdate : Update
|
||||||
|
|
||||||
@ -11,7 +10,7 @@ interface SentMediaGroupUpdate: MediaGroupUpdate {
|
|||||||
val origins: List<BaseMessageUpdate>
|
val origins: List<BaseMessageUpdate>
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EditMediaGroupUpdate : MediaGroupUpdate {
|
interface EditMediaGroupUpdate : BaseEditMessageUpdate, MediaGroupUpdate {
|
||||||
override val data: MediaGroupMessage
|
override val data: MediaGroupMessage
|
||||||
val origin: BaseMessageUpdate
|
val origin: BaseMessageUpdate
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user