1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 08:13:47 +00:00

a little bit refactor MediaGroupTriggers.kt

This commit is contained in:
InsanusMokrassar 2022-03-19 10:15:44 +06:00
parent be710612b5
commit bace2724da

View File

@ -22,7 +22,11 @@ internal suspend inline fun <BC : BehaviourContext, reified T : MediaGroupConten
markerFactory: MarkerFactory<in List<MediaGroupMessage<T>>, Any> = ByChatMediaGroupMarkerFactory, markerFactory: MarkerFactory<in List<MediaGroupMessage<T>>, Any> = ByChatMediaGroupMarkerFactory,
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<T>>> noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, List<MediaGroupMessage<T>>>
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) { ) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
(it.asSentMediaGroupUpdate() ?.data ?.takeIf { it.all { it.content is T } } as? List<MediaGroupMessage<T>>) ?.let(::listOfNotNull) (it.asSentMediaGroupUpdate() ?.data ?.takeIf { messages ->
messages.all { message ->
message.content is T
}
} as? List<MediaGroupMessage<T>>) ?.let(::listOfNotNull)
} }
/** /**