mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-02 22:59:48 +00:00
several fixes
This commit is contained in:
@@ -506,6 +506,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/W
|
||||
public static synthetic fun waitEditedAudio$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
|
||||
public static final fun waitEditedAudioMediaGroupContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
|
||||
public static synthetic fun waitEditedAudioMediaGroupContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
|
||||
public static final fun waitEditedChecklistContent (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
|
||||
public static synthetic fun waitEditedChecklistContent$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
|
||||
public static final fun waitEditedContact (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
|
||||
public static synthetic fun waitEditedContact$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
|
||||
public static final fun waitEditedContentMessage (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/jvm/functions/Function2;)Lkotlinx/coroutines/flow/Flow;
|
||||
@@ -1283,6 +1285,8 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handl
|
||||
public static synthetic fun onEditedAudio$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/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
|
||||
public static final fun onEditedAudioMediaGroup (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/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
|
||||
public static synthetic fun onEditedAudioMediaGroup$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/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
|
||||
public static final fun onEditedChecklist (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/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
|
||||
public static synthetic fun onEditedChecklist$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/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
|
||||
public static final fun onEditedContact (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/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
|
||||
public static synthetic fun onEditedContact$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/Function4;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Lkotlinx/coroutines/Job;
|
||||
public static final fun onEditedContentMessage (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/Function4;Lkotlin/jvm/functions/Function3;)Lkotlinx/coroutines/Job;
|
||||
|
@@ -128,3 +128,8 @@ fun BehaviourContext.waitEditedGiveawayPublicResultsContent(
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, errorFactory)
|
||||
|
||||
fun BehaviourContext.waitEditedChecklistContent(
|
||||
initRequest: Request<*>? = null,
|
||||
errorFactory: NullableRequestBuilder<*> = { null }
|
||||
) = waitEditedContent<ChecklistContent>(initRequest, errorFactory)
|
||||
|
||||
|
@@ -591,3 +591,31 @@ fun <BC : BehaviourContext> BC.onEditedInvoice(
|
||||
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.onEditedChecklist(
|
||||
initialFilter: CommonMessageFilter<ChecklistContent>? = CommonMessageFilterExcludeMediaGroups,
|
||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChecklistMessage, Update>? = MessageFilterByChat,
|
||||
markerFactory: MarkerFactory<in ChecklistMessage, Any>? = ByChatMessageMarkerFactory,
|
||||
additionalSubcontextInitialAction: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, Update, ChecklistMessage>? = null,
|
||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChecklistMessage>
|
||||
)= onEditedContent(
|
||||
initialFilter,
|
||||
subcontextUpdatesFilter,
|
||||
markerFactory,
|
||||
additionalSubcontextInitialAction,
|
||||
scenarioReceiver
|
||||
)
|
||||
|
@@ -4,7 +4,10 @@ import dev.inmo.tgbotapi.types.checklistMessageField
|
||||
import dev.inmo.tgbotapi.types.markedAsDoneTaskIdsField
|
||||
import dev.inmo.tgbotapi.types.markedAsNotDoneTaskIdsField
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
|
||||
import dev.inmo.tgbotapi.types.message.RawMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass
|
||||
import dev.inmo.tgbotapi.types.message.content.ChecklistContent
|
||||
import dev.inmo.tgbotapi.types.tasksField
|
||||
import dev.inmo.tgbotapi.types.userField
|
||||
@@ -14,6 +17,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class ChecklistTasksAdded(
|
||||
@SerialName(checklistMessageField)
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializerClass::class)
|
||||
val checklistMessage: CommonMessage<ChecklistContent>,
|
||||
@SerialName(tasksField)
|
||||
val tasks: List<ChecklistTask.Created>,
|
||||
|
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.types.markedAsDoneTaskIdsField
|
||||
import dev.inmo.tgbotapi.types.markedAsNotDoneTaskIdsField
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass
|
||||
import dev.inmo.tgbotapi.types.message.content.ChecklistContent
|
||||
import dev.inmo.tgbotapi.types.userField
|
||||
import kotlinx.serialization.SerialName
|
||||
@@ -13,6 +14,7 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class ChecklistTasksDone(
|
||||
@SerialName(checklistMessageField)
|
||||
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializerClass::class)
|
||||
val checklistMessage: CommonMessage<ChecklistContent>,
|
||||
@SerialName(markedAsDoneTaskIdsField)
|
||||
val markedAsDone: List<ChecklistTaskId>? = null,
|
||||
|
@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.*
|
||||
import dev.inmo.tgbotapi.types.chat.CommonBot
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.checklists.Checklist
|
||||
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksAdded
|
||||
import dev.inmo.tgbotapi.types.checklists.ChecklistTasksDone
|
||||
import dev.inmo.tgbotapi.types.dice.Dice
|
||||
@@ -168,6 +169,7 @@ internal data class RawMessage(
|
||||
private val giveaway_completed: GiveawayPrivateResults? = null,
|
||||
|
||||
// Checklists
|
||||
private val checklist: Checklist.Created? = null,
|
||||
private val checklist_tasks_done: ChecklistTasksDone? = null,
|
||||
private val checklist_tasks_added: ChecklistTasksAdded? = null,
|
||||
|
||||
@@ -249,6 +251,7 @@ internal data class RawMessage(
|
||||
venue != null -> VenueContent(venue)
|
||||
poll != null -> PollContent(poll)
|
||||
invoice != null -> InvoiceContent(invoice)
|
||||
checklist != null -> ChecklistContent(checklist)
|
||||
giveaway != null -> GiveawayContent(chat, messageId, giveaway)
|
||||
giveaway_winners is GiveawayPublicResults -> GiveawayPublicResultsContent(giveaway_winners)
|
||||
else -> null
|
||||
|
@@ -35,5 +35,6 @@ typealias AnimationMessage = CommonMessage<AnimationContent>
|
||||
typealias ScheduledGiveawayContentMessage = CommonMessage<GiveawayContent>
|
||||
typealias GiveawayPublicResultsContentMessage = CommonMessage<GiveawayPublicResultsContent>
|
||||
typealias PaidMediaInfoContentMessage = CommonMessage<PaidMediaInfoContent>
|
||||
typealias ChecklistMessage = CommonMessage<ChecklistContent>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user