mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-11-22 16:23:48 +00:00
remove deprecations
This commit is contained in:
parent
10c62bf2c7
commit
44e9dc9253
@ -27,7 +27,7 @@ expect var defaultCoroutineScopeProvider: () -> CoroutineScope
|
|||||||
*/
|
*/
|
||||||
@PreviewFeature
|
@PreviewFeature
|
||||||
suspend fun TelegramBot.buildBehaviour(
|
suspend fun TelegramBot.buildBehaviour(
|
||||||
flowUpdatesFilter: FlowsUpdatesFilter,
|
flowUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter(),
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
block: BehaviourContextReceiver<Unit>
|
block: BehaviourContextReceiver<Unit>
|
||||||
@ -70,11 +70,3 @@ suspend fun TelegramBot.buildBehaviourWithLongPolling(
|
|||||||
scope = scope
|
scope = scope
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@PreviewFeature
|
|
||||||
@Deprecated("Renamed to buildBehaviourWithLongPolling")
|
|
||||||
suspend fun TelegramBot.buildBehaviour(
|
|
||||||
scope: CoroutineScope = defaultCoroutineScopeProvider(),
|
|
||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
|
||||||
block: BehaviourContextReceiver<Unit>
|
|
||||||
) = buildBehaviourWithLongPolling(scope, defaultExceptionsHandler, block)
|
|
||||||
|
@ -55,13 +55,6 @@ interface BehaviourContext : FlowsUpdatesFilter, TelegramBot, CoroutineScope {
|
|||||||
upstreamUpdatesFlow: Flow<Update>? = null,
|
upstreamUpdatesFlow: Flow<Update>? = null,
|
||||||
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>? = null
|
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>? = null
|
||||||
): BehaviourContext
|
): 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(
|
class DefaultBehaviourContext(
|
||||||
@ -113,30 +106,6 @@ inline fun <T> BehaviourContext(
|
|||||||
crossinline block: BehaviourContext.() -> T
|
crossinline block: BehaviourContext.() -> T
|
||||||
) = DefaultBehaviourContext(bot, scope, upstreamUpdatesFlow = flowsUpdatesFilter.allUpdatesFlow).run(block)
|
) = 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 <T, BC : BehaviourContext> BC.doInSubContextWithFlowsUpdatesFilterSetup(
|
|
||||||
newFlowsUpdatesFilterSetUp: CustomBehaviourContextAndTypeReceiver<BC, Unit, FlowsUpdatesFilter>?,
|
|
||||||
stopOnCompletion: Boolean = true,
|
|
||||||
behaviourContextReceiver: CustomBehaviourContextReceiver<BC, T>
|
|
||||||
): 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
|
* Creates new one [BehaviourContext], adding subsequent [FlowsUpdatesFilter] in case [updatesFilter] is provided and
|
||||||
* [CoroutineScope] as new [BehaviourContext.scope]
|
* [CoroutineScope] as new [BehaviourContext.scope]
|
||||||
|
@ -25,7 +25,7 @@ import kotlin.coroutines.coroutineContext
|
|||||||
*/
|
*/
|
||||||
suspend fun telegramBotWithBehaviour(
|
suspend fun telegramBotWithBehaviour(
|
||||||
token: String,
|
token: String,
|
||||||
flowsUpdatesFilter: FlowsUpdatesFilter,
|
flowsUpdatesFilter: FlowsUpdatesFilter = FlowsUpdatesFilter(),
|
||||||
scope: CoroutineScope? = null,
|
scope: CoroutineScope? = null,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
builder: KtorRequestsExecutorBuilder.() -> Unit = {},
|
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<Unit>? = null,
|
|
||||||
block: BehaviourContextReceiver<Unit>
|
|
||||||
) = telegramBotWithBehaviourAndLongPolling(token, scope, apiUrl, builder, defaultExceptionsHandler, block)
|
|
||||||
|
@ -119,14 +119,6 @@ suspend fun BehaviourContext.waitEditedStaticLocation(
|
|||||||
filter: SimpleFilter<CommonMessage<StaticLocationContent>>? = null,
|
filter: SimpleFilter<CommonMessage<StaticLocationContent>>? = null,
|
||||||
mapper: CommonMessageToContentMapper<StaticLocationContent>? = null
|
mapper: CommonMessageToContentMapper<StaticLocationContent>? = null
|
||||||
) = waitEditedContent(count, initRequest, false, errorFactory, filter, mapper)
|
) = 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<CommonMessage<PollContent>>? = null,
|
|
||||||
mapper: CommonMessageToContentMapper<PollContent>? = null
|
|
||||||
) = waitEditedContent(count, initRequest, false, errorFactory, filter, mapper)
|
|
||||||
suspend fun BehaviourContext.waitEditedText(
|
suspend fun BehaviourContext.waitEditedText(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
@ -166,19 +166,6 @@ suspend fun <BC : BehaviourContext> BC.onEditedLocation(
|
|||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
)
|
)
|
||||||
|
|
||||||
@Deprecated("Potentially, this trigger will never be used. Use `onPollUpdated` instead")
|
|
||||||
suspend fun <BC : BehaviourContext> BC.onEditedPoll(
|
|
||||||
initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups,
|
|
||||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat,
|
|
||||||
markerFactory: MarkerFactory<in CommonMessage<PollContent>, Any> = ByChatMessageMarkerFactory,
|
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PollContent>>
|
|
||||||
)= onEditedContent(
|
|
||||||
initialFilter,
|
|
||||||
subcontextUpdatesFilter,
|
|
||||||
markerFactory,
|
|
||||||
scenarioReceiver
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
* @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,
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
@ -26,10 +26,7 @@ data class UnknownInlineKeyboardButton internal constructor(
|
|||||||
*/
|
*/
|
||||||
@Serializable
|
@Serializable
|
||||||
data class PayInlineKeyboardButton(
|
data class PayInlineKeyboardButton(
|
||||||
override val text: String,
|
override val text: String
|
||||||
@Deprecated("Don't use this button due to removing of this in near release")
|
|
||||||
@Transient
|
|
||||||
val pay: Boolean = true
|
|
||||||
) : InlineKeyboardButton {
|
) : InlineKeyboardButton {
|
||||||
@ExperimentalSerializationApi
|
@ExperimentalSerializationApi
|
||||||
@EncodeDefault
|
@EncodeDefault
|
||||||
|
@ -20,7 +20,4 @@ data class PrivateContentMessageImpl<T: MessageContent>(
|
|||||||
override val replyTo: Message?,
|
override val replyTo: Message?,
|
||||||
override val replyMarkup: InlineKeyboardMarkup?,
|
override val replyMarkup: InlineKeyboardMarkup?,
|
||||||
override val senderBot: CommonBot?,
|
override val senderBot: CommonBot?,
|
||||||
) : PrivateContentMessage<T> {
|
) : PrivateContentMessage<T>
|
||||||
@Deprecated("This value will always be null. You may get SuccessfulPayment as one of ChatEvents")
|
|
||||||
val paymentInfo: SuccessfulPaymentEvent? = null
|
|
||||||
}
|
|
||||||
|
@ -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.message.payments.abstracts.PaymentInfo
|
||||||
import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
|
import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
|
||||||
|
|
||||||
@Deprecated("Renamed", ReplaceWith("SuccessfulPaymentEvent", "dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent"))
|
|
||||||
typealias SuccessfulPaymentInfo = SuccessfulPaymentEvent
|
|
||||||
data class SuccessfulPaymentEvent(
|
data class SuccessfulPaymentEvent(
|
||||||
val payment: SuccessfulPayment
|
val payment: SuccessfulPayment
|
||||||
) : PaymentInfo, CommonEvent
|
) : PaymentInfo, CommonEvent
|
||||||
|
Loading…
Reference in New Issue
Block a user