mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-25 00:36:15 +00:00
deprecations removing
This commit is contained in:
@@ -30,5 +30,4 @@ val CaptionedInput.textSources
|
||||
* Convert its [CaptionedInput.captionEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||
*/
|
||||
@Deprecated("Currently list of entities already full. This method is redundant")
|
||||
fun CaptionedInput.fullEntitiesList(): TextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()
|
||||
internal fun CaptionedInput.fullEntitiesList(): TextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()
|
||||
|
||||
@@ -19,7 +19,7 @@ interface ExplainedOutput : ParsableExplainedOutput, EntitiesExplainedOutput
|
||||
|
||||
interface ExplainedInput : Explained {
|
||||
/**
|
||||
* Not full list of entities. This list WILL NOT contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||
* Full list of entities. This list WILL contain [TextPart]s with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||
* @see [ExplainedInput.fullEntitiesList]
|
||||
*/
|
||||
val explanationEntities: List<TextPart>
|
||||
@@ -36,5 +36,4 @@ val ExplainedInput.textSources
|
||||
* Convert its [ExplainedInput.explanationEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||
*/
|
||||
@Deprecated("Currently list of entities already full. This method is redundant")
|
||||
fun ExplainedInput.fullEntitiesList(): TextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()
|
||||
internal fun ExplainedInput.fullEntitiesList(): TextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()
|
||||
|
||||
@@ -8,10 +8,6 @@ import dev.inmo.tgbotapi.types.textLength
|
||||
const val DirectInvocationOfTextSourceConstructor = "It is strongly not recommended to use constructors directly instead of factory methods"
|
||||
|
||||
typealias TextSourcesList = List<TextSource>
|
||||
@Deprecated("All lists of TextSource in public API now are full. So, this typealias is redundant")
|
||||
typealias FullTextSourcesList = List<TextSource>
|
||||
@Deprecated("All lists of TextPart in public API now are full. So, this typealias is redundant")
|
||||
typealias FullTextPartsList = List<TextPart>
|
||||
|
||||
interface TextSource {
|
||||
val markdown: String
|
||||
@@ -21,16 +17,6 @@ interface TextSource {
|
||||
|
||||
val asText: String
|
||||
get() = source
|
||||
|
||||
@Deprecated("Rename", ReplaceWith("markdown"))
|
||||
val asMarkdownSource: String
|
||||
get() = markdown
|
||||
@Deprecated("Rename", ReplaceWith("markdownV2"))
|
||||
val asMarkdownV2Source: String
|
||||
get() = markdownV2
|
||||
@Deprecated("Rename", ReplaceWith("html"))
|
||||
val asHtmlSource: String
|
||||
get() = html
|
||||
}
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
@@ -43,13 +29,7 @@ inline operator fun TextSource.plus(text: String) = listOf(this, regular(text))
|
||||
inline operator fun List<TextSource>.plus(text: String) = this + regular(text)
|
||||
|
||||
interface MultilevelTextSource : TextSource {
|
||||
@Deprecated("Will be removed in near major release")
|
||||
val textParts: List<TextPart>
|
||||
get() = textParts(0)
|
||||
val subsources: List<TextSource>
|
||||
@Deprecated("Will be removed in near major release", ReplaceWith("subsources"))
|
||||
val textSources: List<TextSource>
|
||||
get() = subsources
|
||||
}
|
||||
|
||||
data class TextPart(
|
||||
|
||||
@@ -40,5 +40,4 @@ val TextedInput.textSources
|
||||
* Convert its [TextedInput.textEntities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||
*/
|
||||
@Deprecated("Currently list of entities already full. This method is redundant")
|
||||
fun TextedInput.fullEntitiesList(): TextSourcesList = text ?.fullListOfSubSource(textEntities) ?.map { it.source } ?: emptyList()
|
||||
internal fun TextedInput.fullEntitiesList(): TextSourcesList = text ?.fullListOfSubSource(textEntities) ?.map { it.source } ?: emptyList()
|
||||
|
||||
@@ -60,6 +60,3 @@ class ExceptionsOnlyLimiter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("ExceptionsOnlyLimiter", "dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter"))
|
||||
typealias EmptyLimiter = ExceptionsOnlyLimiter
|
||||
|
||||
@@ -62,12 +62,6 @@ val inlineQueryAnswerResultsLimit = 0 .. 50
|
||||
val customTitleLength = 0 .. 16
|
||||
|
||||
val dartsCubeAndBowlingDiceResultLimit = 1 .. 6
|
||||
@Deprecated("Renamed", ReplaceWith("dartsCubeAndBowlingDiceResultLimit", "dev.inmo.tgbotapi.types.dartsCubeAndBowlingDiceResultLimit"))
|
||||
val dartsAndCubeDiceResultLimit
|
||||
get() = dartsCubeAndBowlingDiceResultLimit
|
||||
@Deprecated("Renamed", ReplaceWith("dartsCubeAndBowlingDiceResultLimit", "dev.inmo.tgbotapi.types.dartsCubeAndBowlingDiceResultLimit"))
|
||||
val diceResultLimit
|
||||
get() = dartsCubeAndBowlingDiceResultLimit
|
||||
val basketballAndFootballDiceResultLimit = 1 .. 5
|
||||
val slotMachineDiceResultLimit = 1 .. 64
|
||||
|
||||
|
||||
@@ -9,10 +9,5 @@ const val inlineQueryResultDocumentType = "document"
|
||||
interface InlineQueryResultDocumentCommon : InlineQueryResult,
|
||||
TitledInlineQueryResult,
|
||||
DescribedInlineQueryResult,
|
||||
CaptionedOutput,
|
||||
TextedOutput,
|
||||
WithInputMessageContentInlineQueryResult {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
}
|
||||
WithInputMessageContentInlineQueryResult
|
||||
|
||||
@@ -8,10 +8,5 @@ const val inlineQueryResultGifType = "gif"
|
||||
|
||||
interface InlineQueryResultGifCommon : InlineQueryResult,
|
||||
OptionallyTitledInlineQueryResult,
|
||||
CaptionedOutput,
|
||||
TextedOutput,
|
||||
WithInputMessageContentInlineQueryResult {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
}
|
||||
WithInputMessageContentInlineQueryResult
|
||||
|
||||
@@ -8,10 +8,5 @@ const val inlineQueryResultMpeg4GifType = "mpeg4_gif"
|
||||
|
||||
interface InlineQueryResultMpeg4GifCommon : InlineQueryResult,
|
||||
OptionallyTitledInlineQueryResult,
|
||||
CaptionedOutput,
|
||||
TextedOutput,
|
||||
WithInputMessageContentInlineQueryResult {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
}
|
||||
WithInputMessageContentInlineQueryResult
|
||||
|
||||
@@ -9,10 +9,5 @@ const val inlineQueryResultPhotoType = "photo"
|
||||
interface InlineQueryResultPhotoCommon : InlineQueryResult,
|
||||
OptionallyTitledInlineQueryResult,
|
||||
DescribedInlineQueryResult,
|
||||
CaptionedOutput,
|
||||
TextedOutput,
|
||||
WithInputMessageContentInlineQueryResult {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
}
|
||||
WithInputMessageContentInlineQueryResult
|
||||
|
||||
@@ -9,10 +9,5 @@ const val inlineQueryResultVideoType = "video"
|
||||
interface InlineQueryResultVideoCommon : InlineQueryResult,
|
||||
TitledInlineQueryResult,
|
||||
DescribedInlineQueryResult,
|
||||
CaptionedOutput,
|
||||
TextedOutput,
|
||||
WithInputMessageContentInlineQueryResult {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
}
|
||||
WithInputMessageContentInlineQueryResult
|
||||
|
||||
@@ -7,11 +7,6 @@ import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
|
||||
const val inlineQueryResultVoiceType = "voice"
|
||||
|
||||
interface InlineQueryResultVoiceCommon : InlineQueryResult,
|
||||
CaptionedOutput,
|
||||
TextedOutput,
|
||||
WithInputMessageContentInlineQueryResult,
|
||||
TitledInlineQueryResult {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
}
|
||||
TitledInlineQueryResult
|
||||
|
||||
@@ -37,10 +37,7 @@ data class InputTextMessageContent internal constructor(
|
||||
private val rawEntities: List<RawMessageEntity>? = null,
|
||||
@SerialName(disableWebPagePreviewField)
|
||||
override val disableWebPagePreview: Boolean? = null
|
||||
) : CaptionedOutput, TextedOutput, DisableWebPagePreview, InputMessageContent {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
) : TextedOutput, DisableWebPagePreview, InputMessageContent {
|
||||
override val entities: List<TextSource>? by lazy {
|
||||
rawEntities ?.asTextParts(text) ?.justTextSources()
|
||||
}
|
||||
|
||||
@@ -3,9 +3,6 @@ package dev.inmo.tgbotapi.types.InputMedia
|
||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Deprecated("Will be removed due to redundancy for end-side users")
|
||||
fun String.toInputMediaFileAttachmentName() = "attach://$this"
|
||||
|
||||
@Serializable(InputMediaSerializer::class)
|
||||
interface InputMedia {
|
||||
val type: String
|
||||
|
||||
@@ -42,16 +42,12 @@ data class InputMediaAnimation internal constructor(
|
||||
override val height: Int? = null,
|
||||
override val duration: Long? = null,
|
||||
override val thumb: InputFile? = null
|
||||
) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, TextedOutput, CaptionedOutput {
|
||||
) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, TextedOutput {
|
||||
override val type: String = "animation"
|
||||
override val entities: List<TextSource>? by lazy {
|
||||
rawEntities ?.asTextParts(text ?: return@lazy null) ?.justTextSources()
|
||||
}
|
||||
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
|
||||
@SerialName(mediaField)
|
||||
override val media: String
|
||||
init { media = file.fileIdToSend } // crutch until js compiling will be fixed
|
||||
|
||||
@@ -16,10 +16,7 @@ internal fun <T> T.buildArguments(withSerializer: SerializationStrategy<T>) = ar
|
||||
)
|
||||
|
||||
@Serializable(MediaGroupMemberInputMediaSerializer::class)
|
||||
interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput, TextedOutput {
|
||||
@Deprecated("Will be removed in next major release")
|
||||
override val caption: String?
|
||||
get() = text
|
||||
interface MediaGroupMemberInputMedia : InputMedia, TextedOutput {
|
||||
fun serialize(format: StringFormat): String
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,3 @@ data class ChannelMessageImpl<T: MessageContent>(
|
||||
override val senderBot: CommonBot?,
|
||||
override val authorSignature: AuthorSignature?
|
||||
) : ChannelMessage<T>
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("ChannelMessageImpl", "dev.inmo.tgbotapi.types.message.ChannelMessageImpl"))
|
||||
typealias ChannelMessage<T> = ChannelMessageImpl<T>
|
||||
|
||||
@@ -7,9 +7,6 @@ import dev.inmo.tgbotapi.types.chat.abstracts.GroupChat
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.GroupEventMessage
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("CommonGroupEventMessage"))
|
||||
typealias GroupEventMessage = CommonGroupEventMessage<*>
|
||||
|
||||
data class CommonGroupEventMessage<T : GroupEvent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
override val user: User,
|
||||
|
||||
@@ -8,9 +8,6 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.GroupEvent
|
||||
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.SupergroupEvent
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("CommonSupergroupEventMessage"))
|
||||
typealias SupergroupEventMessage = CommonSupergroupEventMessage<*>
|
||||
|
||||
data class CommonSupergroupEventMessage<T : SupergroupEvent>(
|
||||
override val messageId: MessageIdentifier,
|
||||
override val user: User,
|
||||
|
||||
@@ -22,6 +22,3 @@ data class PrivateMessageImpl<T: MessageContent>(
|
||||
override val senderBot: CommonBot?,
|
||||
val paymentInfo: SuccessfulPaymentInfo?
|
||||
) : PrivateMessage<T>
|
||||
|
||||
@Deprecated("Renamed", ReplaceWith("PrivateMessageImpl", "dev.inmo.tgbotapi.types.message.PrivateMessageImpl"))
|
||||
typealias CommonMessageImpl<T> = PrivateMessageImpl<T>
|
||||
|
||||
@@ -17,10 +17,6 @@ data class TextContent(
|
||||
override val text: String,
|
||||
override val textEntities: List<TextPart> = emptyList()
|
||||
) : MessageContent, TextedInput {
|
||||
@Deprecated("Has been renamed", ReplaceWith("textEntities"))
|
||||
val entities: List<TextPart>
|
||||
get() = textEntities
|
||||
|
||||
override fun createResend(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean,
|
||||
@@ -82,5 +78,4 @@ data class TextContent(
|
||||
* Convert its [TextContent.entities] to list of [dev.inmo.tgbotapi.CommonAbstracts.TextSource]
|
||||
* with [dev.inmo.tgbotapi.types.MessageEntity.textsources.RegularTextSource]
|
||||
*/
|
||||
@Deprecated("Useless due to the fact that currently every message contains full list of sources")
|
||||
fun TextContent.fullEntitiesList(): TextSourcesList = text.fullListOfSubSource(entities).map { it.source }
|
||||
internal fun TextContent.fullEntitiesList(): TextSourcesList = text.fullListOfSubSource(textEntities).map { it.source }
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package dev.inmo.tgbotapi.utils
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.ExceptionHandler
|
||||
import dev.inmo.micro_utils.coroutines.safely
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.supervisorScope
|
||||
|
||||
|
||||
@Deprecated("In future will be used typealias from micro_utils", ReplaceWith("ExceptionHandler", "dev.inmo.micro_utils.coroutines.ExceptionHandler"))
|
||||
typealias ExceptionHandler<T> = ExceptionHandler<T>
|
||||
/**
|
||||
* It will run [block] inside of [supervisorScope] to avoid problems with catching of exceptions
|
||||
*
|
||||
* @param [onException] Will be called when happen exception inside of [block]. By default will throw exception - this
|
||||
* exception will be available for catching
|
||||
*/
|
||||
@Deprecated("In future will be used typealias from micro_utils", ReplaceWith("safely", "dev.inmo.micro_utils.coroutines.safely"))
|
||||
suspend inline fun <T> handleSafely(
|
||||
noinline onException: ExceptionHandler<T> = { throw it },
|
||||
noinline block: suspend CoroutineScope.() -> T
|
||||
): T = safely(onException, block)
|
||||
Reference in New Issue
Block a user