diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt index e6111623bd..dd17203ef3 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourBuilders.kt @@ -27,7 +27,7 @@ expect var defaultCoroutineScopeProvider: () -> CoroutineScope */ @PreviewFeature suspend fun TelegramBot.buildBehaviour( - flowUpdatesFilter: FlowsUpdatesFilter, + flowUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter(), scope: CoroutineScope = defaultCoroutineScopeProvider(), defaultExceptionsHandler: ExceptionHandler? = null, block: BehaviourContextReceiver @@ -70,11 +70,3 @@ suspend fun TelegramBot.buildBehaviourWithLongPolling( scope = scope ) } - -@PreviewFeature -@Deprecated("Renamed to buildBehaviourWithLongPolling") -suspend fun TelegramBot.buildBehaviour( - scope: CoroutineScope = defaultCoroutineScopeProvider(), - defaultExceptionsHandler: ExceptionHandler? = null, - block: BehaviourContextReceiver -) = buildBehaviourWithLongPolling(scope, defaultExceptionsHandler, block) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt index 0b62483ba6..6d99c2c291 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext.kt @@ -55,13 +55,6 @@ interface BehaviourContext : FlowsUpdatesFilter, TelegramBot, CoroutineScope { upstreamUpdatesFlow: Flow? = null, updatesFilter: BehaviourContextAndTypeReceiver? = null ): BehaviourContext - - @Deprecated("This method is not recommended to use and will be removed in near release") - fun copy( - bot: TelegramBot, - scope: CoroutineScope = this.scope, - flowsUpdatesFilter: FlowsUpdatesFilter = this.flowsUpdatesFilter - ): BehaviourContext = copy(upstreamUpdatesFlow = flowsUpdatesFilter.allUpdatesFlow) } class DefaultBehaviourContext( @@ -113,30 +106,6 @@ inline fun BehaviourContext( crossinline block: BehaviourContext.() -> T ) = DefaultBehaviourContext(bot, scope, upstreamUpdatesFlow = flowsUpdatesFilter.allUpdatesFlow).run(block) -/** - * Creates new one [BehaviourContext], adding subsequent [FlowsUpdatesFilter] in case [newFlowsUpdatesFilterSetUp] is provided and - * [CoroutineScope] as new [BehaviourContext.scope]. You must do all subscription/running of longPolling manually. - * - * @param newFlowsUpdatesFilterSetUp As a parameter receives [FlowsUpdatesFilter] from old [this] [BehaviourContext.flowsUpdatesFilter] - */ -@RiskFeature("It is recommended to use doInSubContextWithUpdatesFilter instead. " + - "This method is low level and should not be used in case you are not pretty sure you need it.") -@Deprecated("This method is useless and will not be used in future") -suspend fun BC.doInSubContextWithFlowsUpdatesFilterSetup( - newFlowsUpdatesFilterSetUp: CustomBehaviourContextAndTypeReceiver?, - stopOnCompletion: Boolean = true, - behaviourContextReceiver: CustomBehaviourContextReceiver -): T = (copy( - scope = LinkedSupervisorScope(), -) as BC).run { - withContext(coroutineContext) { - newFlowsUpdatesFilterSetUp ?.let { - it.apply { invoke(this@run, this@doInSubContextWithFlowsUpdatesFilterSetup.flowsUpdatesFilter) } - } - behaviourContextReceiver().also { if (stopOnCompletion) stop() } - } -} - /** * Creates new one [BehaviourContext], adding subsequent [FlowsUpdatesFilter] in case [updatesFilter] is provided and * [CoroutineScope] as new [BehaviourContext.scope] diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt index b0ab06183d..6ab989cd08 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBot.kt @@ -25,7 +25,7 @@ import kotlin.coroutines.coroutineContext */ suspend fun telegramBotWithBehaviour( token: String, - flowsUpdatesFilter: FlowsUpdatesFilter, + flowsUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter(), scope: CoroutineScope? = null, apiUrl: String = telegramBotAPIDefaultUrl, builder: KtorRequestsExecutorBuilder.() -> Unit = {}, @@ -77,13 +77,3 @@ suspend fun telegramBotWithBehaviourAndLongPolling( ) } } - -@Deprecated("Renamed to telegramBotWithBehaviourAndLongPolling") -suspend fun telegramBotWithBehaviour( - token: String, - scope: CoroutineScope? = null, - apiUrl: String = telegramBotAPIDefaultUrl, - builder: KtorRequestsExecutorBuilder.() -> Unit = {}, - defaultExceptionsHandler: ExceptionHandler? = null, - block: BehaviourContextReceiver -) = telegramBotWithBehaviourAndLongPolling(token, scope, apiUrl, builder, defaultExceptionsHandler, block) diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEditedContent.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEditedContent.kt index 8489961012..9ca984ccc2 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEditedContent.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/expectations/WaitEditedContent.kt @@ -119,14 +119,6 @@ suspend fun BehaviourContext.waitEditedStaticLocation( filter: SimpleFilter>? = null, mapper: CommonMessageToContentMapper? = null ) = waitEditedContent(count, initRequest, false, errorFactory, filter, mapper) -@Deprecated("Potentially, this trigger will never be used. Use `waitPollUpdates` instead") -suspend fun BehaviourContext.waitEditedPoll( - initRequest: Request<*>? = null, - errorFactory: NullableRequestBuilder<*> = { null }, - count: Int = 1, - filter: SimpleFilter>? = null, - mapper: CommonMessageToContentMapper? = null -) = waitEditedContent(count, initRequest, false, errorFactory, filter, mapper) suspend fun BehaviourContext.waitEditedText( initRequest: Request<*>? = null, errorFactory: NullableRequestBuilder<*> = { null }, diff --git a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt index a78aa2ca76..ba36d62331 100644 --- a/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt +++ b/tgbotapi.behaviour_builder/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/behaviour_builder/triggers_handling/EditedContentTriggers.kt @@ -166,19 +166,6 @@ suspend fun BC.onEditedLocation( scenarioReceiver ) -@Deprecated("Potentially, this trigger will never be used. Use `onPollUpdated` instead") -suspend fun BC.onEditedPoll( - initialFilter: CommonMessageFilter? = CommonMessageFilterExcludeMediaGroups, - subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver, Update> = MessageFilterByChat, - markerFactory: MarkerFactory, Any> = ByChatMessageMarkerFactory, - scenarioReceiver: CustomBehaviourContextAndTypeReceiver> -)= onEditedContent( - initialFilter, - 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, diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt index e2693ae023..098e8c582a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt @@ -26,10 +26,7 @@ data class UnknownInlineKeyboardButton internal constructor( */ @Serializable data class PayInlineKeyboardButton( - override val text: String, - @Deprecated("Don't use this button due to removing of this in near release") - @Transient - val pay: Boolean = true + override val text: String ) : InlineKeyboardButton { @ExperimentalSerializationApi @EncodeDefault diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt index e08dd2d4ba..e8c0db2a94 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/PrivateMessageImpl.kt @@ -20,7 +20,4 @@ data class PrivateContentMessageImpl( override val replyTo: Message?, override val replyMarkup: InlineKeyboardMarkup?, override val senderBot: CommonBot?, -) : PrivateContentMessage { - @Deprecated("This value will always be null. You may get SuccessfulPayment as one of ChatEvents") - val paymentInfo: SuccessfulPaymentEvent? = null -} +) : PrivateContentMessage diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/SuccessfulPaymentEvent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/SuccessfulPaymentEvent.kt index e981ab08a4..7fe6b71102 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/SuccessfulPaymentEvent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/payments/SuccessfulPaymentEvent.kt @@ -4,8 +4,6 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.CommonEvent import dev.inmo.tgbotapi.types.message.payments.abstracts.PaymentInfo import dev.inmo.tgbotapi.types.payments.SuccessfulPayment -@Deprecated("Renamed", ReplaceWith("SuccessfulPaymentEvent", "dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent")) -typealias SuccessfulPaymentInfo = SuccessfulPaymentEvent data class SuccessfulPaymentEvent( val payment: SuccessfulPayment ) : PaymentInfo, CommonEvent