mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2024-12-23 00:57:13 +00:00
remove deprecations
This commit is contained in:
parent
ea614b790b
commit
86937cc096
@ -57,20 +57,6 @@ interface BehaviourContext : FlowsUpdatesFilter, TelegramBot, CoroutineScope {
|
||||
upstreamUpdatesFlow: Flow<Update>? = null,
|
||||
triggersHolder: TriggersHolder = TriggersHolder()
|
||||
): BehaviourContext
|
||||
|
||||
/**
|
||||
* @param updatesFilter unused
|
||||
*/
|
||||
@Deprecated("Do not use this method")
|
||||
fun copy(
|
||||
bot: TelegramBot = this.bot,
|
||||
scope: CoroutineScope = this.scope,
|
||||
broadcastChannelsSize: Int = 100,
|
||||
onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND,
|
||||
upstreamUpdatesFlow: Flow<Update>? = null,
|
||||
triggersHolder: TriggersHolder = TriggersHolder(),
|
||||
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>? = null
|
||||
): BehaviourContext = copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, triggersHolder)
|
||||
}
|
||||
|
||||
class DefaultBehaviourContext(
|
||||
@ -79,9 +65,7 @@ class DefaultBehaviourContext(
|
||||
broadcastChannelsSize: Int = 100,
|
||||
onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND,
|
||||
private val upstreamUpdatesFlow: Flow<Update>? = null,
|
||||
override val triggersHolder: TriggersHolder = TriggersHolder(),
|
||||
@Deprecated("This parameter is not used anymore")
|
||||
private val updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>? = null
|
||||
override val triggersHolder: TriggersHolder = TriggersHolder()
|
||||
) : AbstractFlowsUpdatesFilter(), TelegramBot by bot, CoroutineScope by scope, BehaviourContext {
|
||||
|
||||
private val additionalUpdatesSharedFlow = MutableSharedFlow<Update>(0, broadcastChannelsSize, onBufferOverflow)
|
||||
@ -137,19 +121,6 @@ fun <BC : BehaviourContext> BC.createSubContext(
|
||||
triggersHolder = triggersHolder
|
||||
) as BC
|
||||
|
||||
/**
|
||||
* Creates new [BehaviourContext] using its [BehaviourContext.copy] method
|
||||
*
|
||||
* @param updatesFilter This param will not be used anymore
|
||||
*/
|
||||
@Deprecated("It is not recommended to use updates filter anymore")
|
||||
fun <BC : BehaviourContext> BC.createSubContext(
|
||||
scope: CoroutineScope = LinkedSupervisorScope(),
|
||||
triggersHolder: TriggersHolder = this.triggersHolder,
|
||||
updatesUpstreamFlow: Flow<Update> = allUpdatesFlow,
|
||||
updatesFilter: CustomBehaviourContextAndTypeReceiver<BC, Boolean, Update>?,
|
||||
) = createSubContext(scope, triggersHolder, updatesUpstreamFlow)
|
||||
|
||||
/**
|
||||
* Launch [behaviourContextReceiver] in context of [this] as [BehaviourContext] and as [kotlin.coroutines.CoroutineContext]
|
||||
*
|
||||
@ -187,27 +158,6 @@ suspend fun <T, BC : BehaviourContext> BC.createSubContextAndDoWithUpdatesFilter
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates new one [BehaviourContext] using [createSubContext] and launches [behaviourContextReceiver] in a new context
|
||||
* using [doInContext]
|
||||
*
|
||||
* @param stopOnCompletion ___TRUE BY DEFAULT___
|
||||
* @param updatesFilter Is not used anymore
|
||||
*/
|
||||
@Deprecated("It is not recommended to use updates filter anymore")
|
||||
suspend fun <T, BC : BehaviourContext> BC.createSubContextAndDoWithUpdatesFilter(
|
||||
scope: CoroutineScope = LinkedSupervisorScope(),
|
||||
triggersHolder: TriggersHolder = this.triggersHolder,
|
||||
updatesUpstreamFlow: Flow<Update> = allUpdatesFlow,
|
||||
updatesFilter: CustomBehaviourContextAndTypeReceiver<BC, Boolean, Update>?,
|
||||
stopOnCompletion: Boolean = true,
|
||||
behaviourContextReceiver: CustomBehaviourContextReceiver<BC, T>
|
||||
): T {
|
||||
return createSubContextAndDoWithUpdatesFilter(
|
||||
scope, triggersHolder, updatesUpstreamFlow, stopOnCompletion, behaviourContextReceiver
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will cancel ALL subsequent contexts, expectations and waiters
|
||||
*/
|
||||
|
@ -39,19 +39,6 @@ val UserId.userLink: String
|
||||
val User.link: String
|
||||
get() = id.userLink
|
||||
|
||||
/**
|
||||
* https://core.telegram.org/bots/api#formatting-options
|
||||
*/
|
||||
@Deprecated("Renamed", ReplaceWith("userLink", "dev.inmo.tgbotapi.types.userLink"))
|
||||
val Identifier.link: String
|
||||
get() = "tg://user?id=$this"
|
||||
/**
|
||||
* https://core.telegram.org/bots/api#formatting-options
|
||||
*/
|
||||
@Deprecated("Renamed", ReplaceWith("userLink", "dev.inmo.tgbotapi.types.userLink"))
|
||||
val ChatId.link: String
|
||||
get() = chatId.link
|
||||
|
||||
typealias UserId = ChatId
|
||||
|
||||
fun Identifier.toChatId(): ChatId = ChatId(this)
|
||||
|
@ -19,15 +19,6 @@ data class ReplyForce(
|
||||
val Selective = Selective()
|
||||
val NonSelective = NonSelective()
|
||||
val Default = ReplyForce()
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce.Selective"))
|
||||
inline val ReplyForceSelective
|
||||
get() = Selective
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce.NonSelective"))
|
||||
inline val ReplyForceNonSelective
|
||||
get() = NonSelective
|
||||
@Deprecated("Renamed", ReplaceWith("ReplyForce.Default"))
|
||||
val ReplyForceDefault = ReplyForce()
|
||||
}
|
||||
|
||||
init {
|
||||
|
@ -38,6 +38,3 @@ data class OwnerChatMember(
|
||||
@Required
|
||||
private val type: String = "creator"
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("OwnerChatMember", "dev.inmo.tgbotapi.types.chat.member.OwnerChatMember"))
|
||||
typealias CreatorChatMember = OwnerChatMember
|
||||
|
@ -1,6 +0,0 @@
|
||||
package dev.inmo.tgbotapi.requests.abstracts
|
||||
|
||||
import java.io.File
|
||||
|
||||
@Deprecated("Duplacation of asMultipartFile", ReplaceWith("asMultipartFile", "dev.inmo.tgbotapi.requests.abstracts.asMultipartFile"))
|
||||
fun File.toInputFile() = asMultipartFile()
|
@ -1828,18 +1828,6 @@ inline fun InlineQueryResult.asInlineQueryResultVoiceCommon(): InlineQueryResult
|
||||
inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryResultVoiceCommon =
|
||||
this as InlineQueryResultVoiceCommon
|
||||
|
||||
@PreviewFeature
|
||||
@Deprecated("Renamed", ReplaceWith("whenOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.whenOwnerChatMember"))
|
||||
inline fun <T> ChatMember.whenCreatorChatMember(block: (CreatorChatMember) -> T) = asCreatorChatMember() ?.let(block)
|
||||
|
||||
@PreviewFeature
|
||||
@Deprecated("Renamed", ReplaceWith("asOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.asOwnerChatMember"))
|
||||
inline fun ChatMember.asCreatorChatMember(): CreatorChatMember? = this as? CreatorChatMember
|
||||
|
||||
@PreviewFeature
|
||||
@Deprecated("Renamed", ReplaceWith("requireOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.requireOwnerChatMember"))
|
||||
inline fun ChatMember.requireCreatorChatMember(): CreatorChatMember = this as CreatorChatMember
|
||||
|
||||
@PreviewFeature
|
||||
inline fun <T> ChatMember.whenOwnerChatMember(block: (OwnerChatMember) -> T) = asOwnerChatMember() ?.let(block)
|
||||
|
||||
|
@ -30,9 +30,6 @@ fun <T> Flow<Iterable<T>>.flatten(): Flow<T> = flow {
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("flatten", "dev.inmo.tgbotapi.extensions.utils.flatten"))
|
||||
fun <T> Flow<Iterable<T>>.flatMap(): Flow<T> = flatten()
|
||||
|
||||
fun <T, R> Flow<T>.flatMap(mapper: (T) -> Iterable<R>): Flow<R> = flow {
|
||||
collect {
|
||||
mapper(it).forEach {
|
||||
|
Loading…
Reference in New Issue
Block a user