mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-29 13:38:43 +00:00
deprecate onEditPoll and rename poll updates triggers
This commit is contained in:
parent
5831cc6d37
commit
834e31906a
@ -166,18 +166,7 @@ suspend fun BehaviourContext.onEditedLocation(
|
|||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
@Deprecated("Potentially, this trigger will never be used. Use `onPollUpdated` instead")
|
||||||
* @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 BehaviourContext.onEditedPoll(
|
suspend fun BehaviourContext.onEditedPoll(
|
||||||
initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups,
|
initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups,
|
||||||
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat,
|
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat,
|
||||||
|
@ -9,7 +9,7 @@ import dev.inmo.tgbotapi.extensions.utils.asPollUpdate
|
|||||||
import dev.inmo.tgbotapi.types.polls.*
|
import dev.inmo.tgbotapi.types.polls.*
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
internal suspend inline fun <reified T : Poll> BehaviourContext.onPollBase(
|
internal suspend inline fun <reified T : Poll> BehaviourContext.onPollUpdatedBase(
|
||||||
noinline initialFilter: SimpleFilter<T>? = null,
|
noinline initialFilter: SimpleFilter<T>? = null,
|
||||||
noinline subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, T, Update>? = null,
|
noinline subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, T, Update>? = null,
|
||||||
markerFactory: MarkerFactory<in T, Any> = ByIdPollMarkerFactory,
|
markerFactory: MarkerFactory<in T, Any> = ByIdPollMarkerFactory,
|
||||||
@ -30,12 +30,12 @@ internal suspend inline fun <reified T : Poll> BehaviourContext.onPollBase(
|
|||||||
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
* data
|
* data
|
||||||
*/
|
*/
|
||||||
suspend fun BehaviourContext.onPoll(
|
suspend fun BehaviourContext.onPollUpdated(
|
||||||
initialFilter: SimpleFilter<Poll>? = null,
|
initialFilter: SimpleFilter<Poll>? = null,
|
||||||
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, Poll, Update>? = null,
|
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, Poll, Update>? = null,
|
||||||
markerFactory: MarkerFactory<in Poll, Any> = ByIdPollMarkerFactory,
|
markerFactory: MarkerFactory<in Poll, Any> = ByIdPollMarkerFactory,
|
||||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, Poll>
|
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, Poll>
|
||||||
) = onPollBase(
|
) = onPollUpdatedBase(
|
||||||
initialFilter,
|
initialFilter,
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
markerFactory,
|
markerFactory,
|
||||||
@ -54,12 +54,12 @@ suspend fun BehaviourContext.onPoll(
|
|||||||
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
* data
|
* data
|
||||||
*/
|
*/
|
||||||
suspend fun BehaviourContext.onRegularPoll(
|
suspend fun BehaviourContext.onRegularPollUpdated(
|
||||||
initialFilter: SimpleFilter<RegularPoll>? = null,
|
initialFilter: SimpleFilter<RegularPoll>? = null,
|
||||||
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, RegularPoll, Update>? = null,
|
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, RegularPoll, Update>? = null,
|
||||||
markerFactory: MarkerFactory<in RegularPoll, Any> = ByIdPollMarkerFactory,
|
markerFactory: MarkerFactory<in RegularPoll, Any> = ByIdPollMarkerFactory,
|
||||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, RegularPoll>
|
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, RegularPoll>
|
||||||
) = onPollBase(
|
) = onPollUpdatedBase(
|
||||||
initialFilter,
|
initialFilter,
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
markerFactory,
|
markerFactory,
|
||||||
@ -78,12 +78,12 @@ suspend fun BehaviourContext.onRegularPoll(
|
|||||||
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
* data
|
* data
|
||||||
*/
|
*/
|
||||||
suspend fun BehaviourContext.onQuizPoll(
|
suspend fun BehaviourContext.onQuizPollUpdated(
|
||||||
initialFilter: SimpleFilter<QuizPoll>? = null,
|
initialFilter: SimpleFilter<QuizPoll>? = null,
|
||||||
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, QuizPoll, Update>? = null,
|
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, QuizPoll, Update>? = null,
|
||||||
markerFactory: MarkerFactory<in QuizPoll, Any> = ByIdPollMarkerFactory,
|
markerFactory: MarkerFactory<in QuizPoll, Any> = ByIdPollMarkerFactory,
|
||||||
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, QuizPoll>
|
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, QuizPoll>
|
||||||
) = onPollBase(
|
) = onPollUpdatedBase(
|
||||||
initialFilter,
|
initialFilter,
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
markerFactory,
|
markerFactory,
|
||||||
|
Loading…
Reference in New Issue
Block a user