mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 08:13:47 +00:00
waitMediaContent/waitMediaContentMessage/onMediaContent
This commit is contained in:
parent
1a21fa85ac
commit
cb4c48d025
@ -5,6 +5,8 @@
|
|||||||
* `Versions`:
|
* `Versions`:
|
||||||
* `Serialization`: `1.5.0` -> `1.5.1`
|
* `Serialization`: `1.5.0` -> `1.5.1`
|
||||||
* `MicroUtils`: `0.18.1` -> `0.18.4`
|
* `MicroUtils`: `0.18.1` -> `0.18.4`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Now it is possible to use `waitMediaContent`/`waitMediaContentMessage`/`onMediaContent`
|
||||||
|
|
||||||
## 7.1.2
|
## 7.1.2
|
||||||
|
|
||||||
|
@ -124,3 +124,7 @@ suspend fun BehaviourContext.waitVisualContent(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitMediaContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent<MediaContent>(initRequest, errorFactory)
|
||||||
|
@ -151,3 +151,8 @@ suspend fun BehaviourContext.waitVisualContentMessage(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitMediaContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage<MediaContent>(initRequest, errorFactory)
|
||||||
|
@ -631,3 +631,27 @@ suspend fun <BC : BehaviourContext> BC.onVisualContent(
|
|||||||
markerFactory,
|
markerFactory,
|
||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onMediaContent(
|
||||||
|
initialFilter: CommonMessageFilter<MediaContent>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaMessage, Update> = MessageFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in MediaMessage, Any> = ByChatMessageMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaMessage>
|
||||||
|
) = onContentMessageWithType(
|
||||||
|
initialFilter,
|
||||||
|
subcontextUpdatesFilter,
|
||||||
|
markerFactory,
|
||||||
|
scenarioReceiver
|
||||||
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user