mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-25 19:48:43 +00:00
a little bit refactor MediaGroupTriggers.kt
This commit is contained in:
parent
be710612b5
commit
bace2724da
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user