mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-08 09:23:47 +00:00
add kicked changes listening
This commit is contained in:
parent
048599414a
commit
9f2ccde589
@ -738,6 +738,7 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/filters/ChatMe
|
||||
public static final fun getChatMemberGotRestrictionsChangedFilter ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
|
||||
public static final fun getChatMemberGotUnrestrictedFilter ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
|
||||
public static final fun getChatMemberJoinedFilter ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
|
||||
public static final fun getChatMemberKickedFilter ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
|
||||
public static final fun getChatMemberLeftFilter ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
|
||||
public static final fun getChatMemberSubscribedFilter ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
|
||||
public static final fun getChatMemberSubscriptionChangedFilter ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;
|
||||
@ -904,6 +905,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
|
||||
public static synthetic fun onMyChatMemberGotUnrestricted$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun onMyChatMemberJoined (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun onMyChatMemberJoined$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun onMyChatMemberKicked (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun onMyChatMemberKicked$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun onMyChatMemberLeft (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
public static synthetic fun onMyChatMemberLeft$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
|
||||
public static final fun onMyChatMemberSubscribed (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/SimpleFilter;Lkotlin/jvm/functions/Function4;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/marker_factories/MarkerFactory;Lkotlin/jvm/functions/Function3;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
|
||||
|
@ -93,4 +93,11 @@ val chatMemberGotRestrictionsChangedFilter = SimpleFilter<ChatMemberUpdated> {
|
||||
*/
|
||||
val chatMemberGotUnrestrictedFilter = SimpleFilter<ChatMemberUpdated> {
|
||||
it.gotUnrestricted
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows only member [gotUnrestricted] updates
|
||||
*/
|
||||
val chatMemberKickedFilter = SimpleFilter<ChatMemberUpdated> {
|
||||
it.kicked
|
||||
}
|
@ -1071,4 +1071,29 @@ suspend fun <BC : BehaviourContext> BC.onMyChatMemberGotUnrestricted(
|
||||
subcontextUpdatesFilter,
|
||||
markerFactory,
|
||||
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
|
||||
*/
|
||||
suspend fun <BC : BehaviourContext> BC.onMyChatMemberKicked(
|
||||
initialFilter: SimpleFilter<ChatMemberUpdated>? = null,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatMemberUpdated, Update>? = ChatMemberUpdatedFilterByChat,
|
||||
markerFactory: MarkerFactory<ChatMemberUpdated, Any>? = ByChatChatMemberUpdatedMarkerFactory,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatMemberUpdated>
|
||||
) = onChatMemberUpdatedInternal<BC, MyChatMemberUpdatedUpdate>(
|
||||
chatMemberKickedFilter * initialFilter,
|
||||
subcontextUpdatesFilter,
|
||||
markerFactory,
|
||||
scenarioReceiver
|
||||
)
|
||||
|
@ -2796,6 +2796,7 @@ public final class dev/inmo/tgbotapi/extensions/utils/extensions/ChatMemberUpdat
|
||||
public static final fun getGotRestrictionsChanged (Ldev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated;)Z
|
||||
public static final fun getGotUnrestricted (Ldev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated;)Z
|
||||
public static final fun getJoinedChat (Ldev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated;)Z
|
||||
public static final fun getKicked (Ldev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated;)Z
|
||||
public static final fun getLeftChat (Ldev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated;)Z
|
||||
public static final fun getSubscribed (Ldev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated;)Z
|
||||
public static final fun getSubscriptionUpdated (Ldev/inmo/tgbotapi/types/chat/member/ChatMemberUpdated;)Z
|
||||
|
@ -73,3 +73,8 @@ val ChatMemberUpdated.gotRestrictionsChanged: Boolean get() = newChatMemberState
|
||||
* All member restrictions were removed
|
||||
*/
|
||||
val ChatMemberUpdated.gotUnrestricted: Boolean get() = oldChatMemberState.isRestricted && !newChatMemberState.isRestricted
|
||||
|
||||
/**
|
||||
* [ChatMemberUpdated.newChatMemberState] of [this] [isKicked]
|
||||
*/
|
||||
val ChatMemberUpdated.kicked: Boolean get() = newChatMemberState.isKicked
|
||||
|
Loading…
Reference in New Issue
Block a user