1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

remove deprecations

This commit is contained in:
InsanusMokrassar 2024-03-16 19:29:10 +06:00
parent d72fb6e3e8
commit b559dbbe66
12 changed files with 8 additions and 119 deletions

View File

@ -2,6 +2,8 @@
## 11.0.0 ## 11.0.0
**THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS**
## 10.1.2 ## 10.1.2
* `Version`: * `Version`:

View File

@ -9,9 +9,3 @@ import dev.inmo.tgbotapi.types.chat.PreviewChat
interface WithPreviewChat { interface WithPreviewChat {
val chat: PreviewChat 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

View File

@ -7,6 +7,3 @@ interface LinkPreviewOptionsContainer {
val disableWebPagePreview: Boolean? val disableWebPagePreview: Boolean?
get() = linkPreviewOptions ?.isDisabled != true get() = linkPreviewOptions ?.isDisabled != true
} }
@Deprecated("Renamed", ReplaceWith("LinkPreviewOptionsContainer", "dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer"))
typealias DisableWebPagePreview = LinkPreviewOptionsContainer

View File

@ -3,17 +3,11 @@ package dev.inmo.tgbotapi.abstracts.types
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.ReplyParameters import dev.inmo.tgbotapi.types.ReplyParameters
@Deprecated("Renamed", ReplaceWith("WithReplyParameters", "dev.inmo.tgbotapi.abstracts.types.WithReplyParameters")) interface WithReplyParameters {
interface ReplyMessageId {
val replyToMessageId: MessageId?
val allowSendingWithoutReply: Boolean?
}
interface WithReplyParameters : ReplyMessageId {
val replyParameters: ReplyParameters? val replyParameters: ReplyParameters?
override val replyToMessageId: MessageId? val replyToMessageId: MessageId?
get() = replyParameters ?.messageId get() = replyParameters ?.messageId
override val allowSendingWithoutReply: Boolean? val allowSendingWithoutReply: Boolean?
get() = replyParameters ?.allowSendingWithoutReply get() = replyParameters ?.allowSendingWithoutReply
} }

View File

@ -3,6 +3,3 @@ package dev.inmo.tgbotapi.requests.edit.abstracts
import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer
interface EditLinkPreviewOptionsContainer : LinkPreviewOptionsContainer interface EditLinkPreviewOptionsContainer : LinkPreviewOptionsContainer
@Deprecated("Renamed", ReplaceWith("EditLinkPreviewOptionsContainer", "dev.inmo.tgbotapi.requests.edit.abstracts.EditLinkPreviewOptionsContainer"))
typealias EditDisableWebPagePreviewMessage = EditLinkPreviewOptionsContainer

View File

@ -87,16 +87,12 @@ fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()
@Serializable(ChatIdentifierSerializer::class) @Serializable(ChatIdentifierSerializer::class)
@JvmInline @JvmInline
value class Username( value class Username(
@Deprecated("Renamed", ReplaceWith("full"))
val username: String
) : ChatIdentifier {
val full: String val full: String
get() = username ) : ChatIdentifier {
val username: String
get() = full
val withoutAt val withoutAt
get() = full.dropWhile { it == '@' } get() = full.dropWhile { it == '@' }
@Deprecated("Renamed", ReplaceWith("withoutAt"))
val usernameWithoutAt
get() = withoutAt
init { init {
if (!full.startsWith("@")) { if (!full.startsWith("@")) {

View File

@ -102,6 +102,3 @@ sealed interface KeyboardButtonRequestUsers {
} }
} }
} }
@Deprecated("Renamed", ReplaceWith("KeyboardButtonRequestUsers", "dev.inmo.tgbotapi.types.buttons.KeyboardButtonRequestUsers"))
typealias KeyboardButtonRequestUser = KeyboardButtonRequestUsers

View File

@ -65,16 +65,6 @@ inline fun requestUsersReplyButton(
requestUser 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] * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot]
*/ */
@ -87,18 +77,6 @@ inline fun requestBotsReplyButton(
KeyboardButtonRequestUsers.Bot(requestId, maxCount) 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] * Creates [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Common]
*/ */

View File

@ -28,21 +28,6 @@ sealed class ChatType {
object Channel : ChatType() { override val stringified = "channel" } object Channel : ChatType() { override val stringified = "channel" }
@Serializable(ChatTypeSerializer::class) @Serializable(ChatTypeSerializer::class)
class Unknown(override val stringified: String) : ChatType() 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 val String.asChatType
get() = when (this) { get() = when (this) {

View File

@ -37,12 +37,3 @@ data class ChatCommonAdministratorRights(
@SerialName(canDeleteStoriesField) @SerialName(canDeleteStoriesField)
override val canDeleteStories: Boolean = false override val canDeleteStories: Boolean = false
) : ChatAdministratorRights ) : ChatAdministratorRights
@Deprecated(
"Renamed to ChatCommonAdministratorRights and will be removed soon",
ReplaceWith(
"ChatCommonAdministratorRights",
"dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights"
)
)
typealias ChatAdministratorRightsImpl = ChatCommonAdministratorRights

View File

@ -13,9 +13,6 @@ object TelegramBotCommandsDefaults {
val defaultNamesArgsSeparatorRegex = Regex(defaultNamesArgsSeparator) 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 * Parse commands and their args. Logic will find command, get all subsequent data as args until new command
*/ */
@ -218,30 +215,3 @@ fun ContentMessage<TextContent>.parseCommandsWithNamedArgs(
argsSeparator: String, argsSeparator: String,
nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex, nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex,
) = parseCommandsWithNamedArgs(argsSeparator = Regex(pattern = argsSeparator), nameArgSeparator = nameArgSeparator) ) = 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<TextSource>.parseCommandsWithParams(
argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex
): MutableMap<String, Array<String>> = 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<TextContent>.parseCommandsWithParams(
argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex
) = parseCommandsWithArgs(argsSeparator)

View File

@ -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] * Creates and put [RequestUserKeyboardButton] with [KeyboardButtonRequestUsers.Bot]
* *