From b559dbbe66745009c072cc12db950d7cbb588ae0 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 16 Mar 2024 19:29:10 +0600 Subject: [PATCH] remove deprecations --- CHANGELOG.md | 2 ++ .../dev/inmo/tgbotapi/abstracts/WithChat.kt | 6 ---- .../types/LinkPreviewOptionsContainer.kt | 3 -- .../abstracts/types/WithReplyParameters.kt | 12 ++------ .../EditLinkPreviewOptionsContainer.kt | 3 -- .../dev/inmo/tgbotapi/types/ChatIdentifier.kt | 10 ++----- .../buttons/KeyboardButtonRequestUsers.kt | 3 -- .../reply/ReplyKeyboardButtonsShortcuts.kt | 22 -------------- .../tgbotapi/types/chat/ChatSerializers.kt | 15 ---------- .../member/ChatCommonAdministratorRights.kt | 9 ------ .../utils/extensions/BotCommandsArgsParser.kt | 30 ------------------- .../types/buttons/ReplyKeyboardBuilder.kt | 12 -------- 12 files changed, 8 insertions(+), 119 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 46a57600f4..43759e6792 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## 11.0.0 +**THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS** + ## 10.1.2 * `Version`: diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithChat.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithChat.kt index 6cd966d0f5..79c1257a6e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithChat.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/WithChat.kt @@ -9,9 +9,3 @@ import dev.inmo.tgbotapi.types.chat.PreviewChat interface WithPreviewChat { val chat: PreviewChat } - -/** - * All inheritors of this interface have [chat] field and related to this [chat] - */ -@Deprecated("Renamed", ReplaceWith("WithPreviewChat", "dev.inmo.tgbotapi.abstracts.WithPreviewChat")) -typealias WithChat = WithPreviewChat diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/LinkPreviewOptionsContainer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/LinkPreviewOptionsContainer.kt index c6c8144b5d..c07734653e 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/LinkPreviewOptionsContainer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/LinkPreviewOptionsContainer.kt @@ -7,6 +7,3 @@ interface LinkPreviewOptionsContainer { val disableWebPagePreview: Boolean? get() = linkPreviewOptions ?.isDisabled != true } - -@Deprecated("Renamed", ReplaceWith("LinkPreviewOptionsContainer", "dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer")) -typealias DisableWebPagePreview = LinkPreviewOptionsContainer diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/WithReplyParameters.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/WithReplyParameters.kt index a51b6e54db..5986bbda74 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/WithReplyParameters.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/abstracts/types/WithReplyParameters.kt @@ -3,17 +3,11 @@ package dev.inmo.tgbotapi.abstracts.types import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.ReplyParameters -@Deprecated("Renamed", ReplaceWith("WithReplyParameters", "dev.inmo.tgbotapi.abstracts.types.WithReplyParameters")) -interface ReplyMessageId { - val replyToMessageId: MessageId? - val allowSendingWithoutReply: Boolean? -} - -interface WithReplyParameters : ReplyMessageId { +interface WithReplyParameters { val replyParameters: ReplyParameters? - override val replyToMessageId: MessageId? + val replyToMessageId: MessageId? get() = replyParameters ?.messageId - override val allowSendingWithoutReply: Boolean? + val allowSendingWithoutReply: Boolean? get() = replyParameters ?.allowSendingWithoutReply } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/abstracts/EditLinkPreviewOptionsContainer.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/abstracts/EditLinkPreviewOptionsContainer.kt index b7c56eeca4..d85fbb17fa 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/abstracts/EditLinkPreviewOptionsContainer.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/edit/abstracts/EditLinkPreviewOptionsContainer.kt @@ -3,6 +3,3 @@ package dev.inmo.tgbotapi.requests.edit.abstracts import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer interface EditLinkPreviewOptionsContainer : LinkPreviewOptionsContainer - -@Deprecated("Renamed", ReplaceWith("EditLinkPreviewOptionsContainer", "dev.inmo.tgbotapi.requests.edit.abstracts.EditLinkPreviewOptionsContainer")) -typealias EditDisableWebPagePreviewMessage = EditLinkPreviewOptionsContainer \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt index e065b7ba2e..75e5d34b5a 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/ChatIdentifier.kt @@ -87,16 +87,12 @@ fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId() @Serializable(ChatIdentifierSerializer::class) @JvmInline value class Username( - @Deprecated("Renamed", ReplaceWith("full")) - val username: String -) : ChatIdentifier { val full: String - get() = username +) : ChatIdentifier { + val username: String + get() = full val withoutAt get() = full.dropWhile { it == '@' } - @Deprecated("Renamed", ReplaceWith("withoutAt")) - val usernameWithoutAt - get() = withoutAt init { if (!full.startsWith("@")) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt index 6d5cd42911..310a8c6324 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/KeyboardButtonRequestUsers.kt @@ -102,6 +102,3 @@ sealed interface KeyboardButtonRequestUsers { } } } - -@Deprecated("Renamed", ReplaceWith("KeyboardButtonRequestUsers", "dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers")) -typealias KeyboardButtonRequestUser = KeyboardButtonRequestUsers diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt index ad759efec4..fe4db81a12 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/buttons/reply/ReplyKeyboardButtonsShortcuts.kt @@ -65,16 +65,6 @@ inline fun requestUsersReplyButton( requestUser ) - -/** - * Creates [RequestUserKeyboardButton] - */ -@Deprecated("Renamed", ReplaceWith("requestUsersReplyButton(text, requestUser)", "dev.inmo.tgbotapi.types.buttons.reply.requestUsersReplyButton")) -inline fun requestUserReplyButton( - text: String, - requestUser: KeyboardButtonRequestUsers -) = requestUsersReplyButton(text, requestUser) - /** * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot] */ @@ -87,18 +77,6 @@ inline fun requestBotsReplyButton( KeyboardButtonRequestUsers.Bot(requestId, maxCount) ) -/** - * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot] - */ -@Deprecated("Renamed", ReplaceWith("requestBotsReplyButton(text, requestId)", "dev.inmo.tgbotapi.types.buttons.reply.requestBotsReplyButton")) -inline fun requestBotReplyButton( - text: String, - requestId: RequestId, -) = requestBotsReplyButton( - text, - requestId, -) - /** * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Common] */ diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt index b84775fc8c..7a3cd4ad63 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/ChatSerializers.kt @@ -28,21 +28,6 @@ sealed class ChatType { object Channel : ChatType() { override val stringified = "channel" } @Serializable(ChatTypeSerializer::class) class Unknown(override val stringified: String) : ChatType() - - companion object { - @Deprecated("Renamed", ReplaceWith("Private", "dev.inmo.tgbotapi.types.chat.ChatType.Private")) - val PrivateChatType = Private - @Deprecated("Renamed", ReplaceWith("Group", "dev.inmo.tgbotapi.types.chat.ChatType.Group")) - val GroupChatType = Group - @Deprecated("Renamed", ReplaceWith("Supergroup", "dev.inmo.tgbotapi.types.chat.ChatType.Supergroup")) - val SupergroupChatType = Supergroup - @Deprecated("Renamed", ReplaceWith("Channel", "dev.inmo.tgbotapi.types.chat.ChatType.Channel")) - val ChannelChatType = Channel - @Deprecated("Renamed", ReplaceWith("Unknown", "dev.inmo.tgbotapi.types.chat.ChatType.Unknown")) - val UnknownChatType = Unknown - @Deprecated("Renamed", ReplaceWith("Unknown(stringified)", "dev.inmo.tgbotapi.types.chat.ChatType.Unknown")) - fun UnknownChatType(stringified: String) = Unknown(stringified) - } } val String.asChatType get() = when (this) { diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights.kt index d606660421..f5db0bcab4 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/chat/member/ChatCommonAdministratorRights.kt @@ -37,12 +37,3 @@ data class ChatCommonAdministratorRights( @SerialName(canDeleteStoriesField) override val canDeleteStories: Boolean = false ) : ChatAdministratorRights - -@Deprecated( - "Renamed to ChatCommonAdministratorRights and will be removed soon", - ReplaceWith( - "ChatCommonAdministratorRights", - "dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights" - ) -) -typealias ChatAdministratorRightsImpl = ChatCommonAdministratorRights diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/BotCommandsArgsParser.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/BotCommandsArgsParser.kt index d46bc0d8b0..09059786e2 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/BotCommandsArgsParser.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/extensions/BotCommandsArgsParser.kt @@ -13,9 +13,6 @@ object TelegramBotCommandsDefaults { val defaultNamesArgsSeparatorRegex = Regex(defaultNamesArgsSeparator) } -@Deprecated(message = "Replaced", replaceWith = ReplaceWith("TelegramBotCommandsDefaults.defaultArgsSeparatorRegex", "dev.inmo.tgbotapi.extensions.utils.extensions.TelegramBotCommandsDefaults")) -val defaultArgsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex - /** * Parse commands and their args. Logic will find command, get all subsequent data as args until new command */ @@ -218,30 +215,3 @@ fun ContentMessage.parseCommandsWithNamedArgs( argsSeparator: String, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, ) = parseCommandsWithNamedArgs(argsSeparator = Regex(pattern = argsSeparator), nameArgSeparator = nameArgSeparator) - - -// Deprecations - -/** - * Parse commands and their args. Logic will find command, get all subsequent data as args until new command - */ -@Deprecated("Renamed", ReplaceWith("parseCommandsWithArgs(argsSeparator)", "dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithArgs")) -fun List.parseCommandsWithParams( - argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex -): MutableMap> = parseCommandsWithArgs(argsSeparator) - -/** - * Parse commands and their args. Logic will find command, get all subsequent data as args until new command - */ -@Deprecated("Renamed", ReplaceWith("parseCommandsWithArgs(argsSeparator)", "dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithArgs")) -fun TextedWithTextSources.parseCommandsWithParams( - argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex -) = parseCommandsWithArgs(argsSeparator) - -/** - * Parse commands and their args. Logic will find command, get all subsequent data as args until new command - */ -@Deprecated("Renamed", ReplaceWith("parseCommandsWithArgs(argsSeparator)", "dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithArgs")) -fun ContentMessage.parseCommandsWithParams( - argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex -) = parseCommandsWithArgs(argsSeparator) diff --git a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt index 0468a17939..bd17d904e5 100644 --- a/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt +++ b/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/types/buttons/ReplyKeyboardBuilder.kt @@ -149,18 +149,6 @@ inline fun ReplyKeyboardRowBuilder.requestUsersButton( ) ) -/** - * Creates and put [RequestUserKeyboardButton] - * - * @see replyKeyboard - * @see ReplyKeyboardBuilder.row - */ -@Deprecated("Renamed", ReplaceWith("requestUsersButton(text, requestUser)", "dev.inmo.tgbotapi.extensions.utils.types.buttons")) -inline fun ReplyKeyboardRowBuilder.requestUserButton( - text: String, - requestUser: KeyboardButtonRequestUsers -) = requestUsersButton(text, requestUser) - /** * Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot] *