1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

deprecate onEditPoll and rename poll updates triggers

This commit is contained in:
InsanusMokrassar 2021-10-03 21:12:17 +06:00
parent 5831cc6d37
commit 834e31906a
2 changed files with 8 additions and 19 deletions

View File

@ -166,18 +166,7 @@ suspend fun BehaviourContext.onEditedLocation(
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
*/
@Deprecated("Potentially, this trigger will never be used. Use `onPollUpdated` instead")
suspend fun BehaviourContext.onEditedPoll(
initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat,

View File

@ -9,7 +9,7 @@ import dev.inmo.tgbotapi.extensions.utils.asPollUpdate
import dev.inmo.tgbotapi.types.polls.*
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 subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, T, Update>? = null,
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
* data
*/
suspend fun BehaviourContext.onPoll(
suspend fun BehaviourContext.onPollUpdated(
initialFilter: SimpleFilter<Poll>? = null,
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, Poll, Update>? = null,
markerFactory: MarkerFactory<in Poll, Any> = ByIdPollMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, Poll>
) = onPollBase(
) = onPollUpdatedBase(
initialFilter,
subcontextUpdatesFilter,
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
* data
*/
suspend fun BehaviourContext.onRegularPoll(
suspend fun BehaviourContext.onRegularPollUpdated(
initialFilter: SimpleFilter<RegularPoll>? = null,
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, RegularPoll, Update>? = null,
markerFactory: MarkerFactory<in RegularPoll, Any> = ByIdPollMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, RegularPoll>
) = onPollBase(
) = onPollUpdatedBase(
initialFilter,
subcontextUpdatesFilter,
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
* data
*/
suspend fun BehaviourContext.onQuizPoll(
suspend fun BehaviourContext.onQuizPollUpdated(
initialFilter: SimpleFilter<QuizPoll>? = null,
subcontextUpdatesFilter: BehaviourContextAndTwoTypesReceiver<Boolean, QuizPoll, Update>? = null,
markerFactory: MarkerFactory<in QuizPoll, Any> = ByIdPollMarkerFactory,
scenarioReceiver: BehaviourContextAndTypeReceiver<Unit, QuizPoll>
) = onPollBase(
) = onPollUpdatedBase(
initialFilter,
subcontextUpdatesFilter,
markerFactory,