mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-04-07 18:42:29 +00:00
add ManagedBotCreated and ManagedBotUpdated
This commit is contained in:
@@ -13,6 +13,8 @@ import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
|
||||
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
|
||||
import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated
|
||||
import dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults
|
||||
import dev.inmo.tgbotapi.types.managed_bots.ManagedBotCreated
|
||||
import dev.inmo.tgbotapi.types.managed_bots.ManagedBotUpdated
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.forum.ForumTopicClosed
|
||||
@@ -248,6 +250,16 @@ fun BehaviourContext.waitChatOwnerChanged(
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEvents<ChatOwnerChanged>(initRequest, errorFactory)
|
||||
|
||||
fun BehaviourContext.waitManagedBotCreatedEvents(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEvents<ManagedBotCreated>(initRequest, errorFactory)
|
||||
|
||||
fun BehaviourContext.waitManagedBotUpdatedEvents(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEvents<ManagedBotUpdated>(initRequest, errorFactory)
|
||||
|
||||
fun BehaviourContext.waitChatBackgroundSet(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
|
||||
@@ -18,6 +18,8 @@ import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
|
||||
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
|
||||
import dev.inmo.tgbotapi.types.giveaway.GiveawayCreated
|
||||
import dev.inmo.tgbotapi.types.giveaway.GiveawayPrivateResults
|
||||
import dev.inmo.tgbotapi.types.managed_bots.ManagedBotCreated
|
||||
import dev.inmo.tgbotapi.types.managed_bots.ManagedBotUpdated
|
||||
import dev.inmo.tgbotapi.types.message.ChannelEventMessage
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.*
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
|
||||
@@ -1054,6 +1056,50 @@ fun <BC : BehaviourContext> BC.onChatOwnerChanged(
|
||||
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, 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] **Pass null to handle requests fully parallel**. 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
|
||||
*/
|
||||
fun <BC : BehaviourContext> BC.onManagedBotCreated(
|
||||
initialFilter: SimpleFilter<ChatEventMessage<ManagedBotCreated>>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ManagedBotCreated>, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<ManagedBotCreated>, Any>? = ByChatMessageMarkerFactory,
|
||||
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<ManagedBotCreated>>? = null,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ManagedBotCreated>>
|
||||
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, 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] **Pass null to handle requests fully parallel**. 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
|
||||
*/
|
||||
fun <BC : BehaviourContext> BC.onManagedBotUpdated(
|
||||
initialFilter: SimpleFilter<ChatEventMessage<ManagedBotUpdated>>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatEventMessage<ManagedBotUpdated>, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ChatEventMessage<ManagedBotUpdated>, Any>? = ByChatMessageMarkerFactory,
|
||||
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChatEventMessage<ManagedBotUpdated>>? = null,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatEventMessage<ManagedBotUpdated>>
|
||||
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, additionalSubcontextInitialAction, 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,
|
||||
|
||||
Reference in New Issue
Block a user