diff --git a/CHANGELOG.md b/CHANGELOG.md index cf6154cc1b..b710340ca6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -59,6 +59,9 @@ * `onlyMediaGroupsUpdates` * `onlySentMediaGroupUpdates` * `onlyEditMediaGroupUpdates` + * Renames in chat filters extensions: + * `filterBaseMessageUpdates` -> `filterByChatId` and `filterByChat` + * `filterSentMediaGroupUpdates` -> `filterByChatId` and `filterByChat` ### 0.27.3 diff --git a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt index 4ee90dd8f9..2ad478455a 100644 --- a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt +++ b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt @@ -2,6 +2,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates import com.github.insanusmokrassar.TelegramBotAPI.types.ChatId import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat +import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.EditMediaGroupUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.SentMediaGroupUpdate import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseMessageUpdate import kotlinx.coroutines.flow.Flow @@ -10,22 +11,38 @@ import kotlinx.coroutines.flow.filter /** * [Flow.filter] incoming [BaseMessageUpdate]s by their [ChatId] */ -fun Flow.filterBaseMessageUpdates(chatId: ChatId): Flow = filter { - it.data.chat.id == chatId -} +fun Flow.filterByChatId(chatId: ChatId): Flow = filter { it.data.chat.id == chatId } /** * [Flow.filter] incoming [BaseMessageUpdate]s by their [ChatId] using [Chat.id] of [chat] */ -fun Flow.filterBaseMessageUpdates(chat: Chat): Flow = filterBaseMessageUpdates(chat.id) +fun Flow.filterByChat(chat: Chat): Flow = filterByChatId(chat.id) +/** + * [Flow.filter] incoming [BaseMessageUpdate]s by their [ChatId] + */ +@Deprecated("Renamed", ReplaceWith("filterByChatId")) +fun Flow.filterBaseMessageUpdates(chatId: ChatId): Flow = filterByChatId(chatId) +/** + * [Flow.filter] incoming [BaseMessageUpdate]s by their [ChatId] using [Chat.id] of [chat] + */ +@Deprecated("Renamed", ReplaceWith("filterByChat")) +fun Flow.filterBaseMessageUpdates(chat: Chat): Flow = filterByChatId(chat.id) /** * [Flow.filter] incoming [SentMediaGroupUpdate]s by their [ChatId] */ -fun Flow.filterSentMediaGroupUpdates(chatId: ChatId): Flow = filter { - it.data.first().chat.id == chatId -} +fun Flow.filterByChatId(chatId: ChatId): Flow = filter { it.data.first().chat.id == chatId } /** * [Flow.filter] incoming [SentMediaGroupUpdate]s by their [ChatId] using [Chat.id] of [chat] */ -fun Flow.filterSentMediaGroupUpdates(chat: Chat): Flow = filterSentMediaGroupUpdates(chat.id) +fun Flow.filterByChat(chat: Chat): Flow = filterByChatId(chat.id) +/** + * [Flow.filter] incoming [SentMediaGroupUpdate]s by their [ChatId] + */ +@Deprecated("Renamed", ReplaceWith("filterByChatId")) +fun Flow.filterSentMediaGroupUpdates(chatId: ChatId): Flow = filterByChatId(chatId) +/** + * [Flow.filter] incoming [SentMediaGroupUpdate]s by their [ChatId] using [Chat.id] of [chat] + */ +@Deprecated("Renamed", ReplaceWith("filterByChat")) +fun Flow.filterSentMediaGroupUpdates(chat: Chat): Flow = filterByChatId(chat.id)