1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-22 08:37:12 +00:00

Merge pull request #754 from InsanusMokrassar/8.0.0

8.0.0
This commit is contained in:
InsanusMokrassar 2023-05-31 01:34:34 +06:00 committed by GitHub
commit 009991fa88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 57 additions and 169 deletions

View File

@ -1,5 +1,21 @@
# TelegramBotAPI changelog
## 8.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
**ALL PROJECT DEPRECATIONS HAVE BEEN REMOVED**
**IN THIS UPDATE KORLIBS HAVE BEEN UPDATED TO VERSION `4.0.2`. SINCE THAT VERSION A LOT OF PACKAGES HAVE BEEN RENAMED.
MIGRATIONS USED IN THIS LIB:**
* `com.soywiz.klock` -> `korlibs.time`
* `com.soywiz.krypto` -> `korlibs.crypto`
* `Versions`:
* `Korlibs`: `3.4.0` -> `4.0.3`
* `MicroUtils`: `0.18.4` -> `0.19.1`
## 7.1.3
* `Versions`:

View File

@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true
library_group=dev.inmo
library_version=7.1.3
library_version=8.0.0

View File

@ -6,14 +6,14 @@ kotlin-coroutines = "1.6.4"
javax-activation = "1.1.1"
korlibs = "3.4.0"
korlibs = "4.0.3"
uuid = "0.7.0"
ktor = "2.3.0"
ksp = "1.8.21-1.0.11"
kotlin-poet = "1.13.2"
kotlin-poet = "1.14.2"
microutils = "0.18.4"
microutils = "0.19.1"
github-release-plugin = "2.4.1"
dokka = "1.8.10"

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.api
import com.soywiz.klock.DateTime
import com.soywiz.klock.TimeSpan
import korlibs.time.DateTime
import korlibs.time.TimeSpan
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink
import dev.inmo.tgbotapi.types.ChatIdentifier

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink
import dev.inmo.tgbotapi.types.ChatIdentifier

View File

@ -15,14 +15,3 @@ suspend fun TelegramBot.editMessageMedia(
media: TelegramMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
@Deprecated("Renamed", ReplaceWith("this.editMessageMedia(inlineMessageId, media, replyMarkup)", "dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia"))
suspend fun TelegramBot.editMessageCaption(
inlineMessageId: InlineMessageIdentifier,
media: TelegramMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))

View File

@ -72,76 +72,3 @@ suspend fun TelegramBot.setStickerSetThumbnail(
) = setStickerSetThumbnail(
user.id, stickerSet.name, thumbnail
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
userId: UserId,
thumbSetName: String,
thumb: FileId
) = execute(
SetStickerSetThumbnail(userId, thumbSetName, thumb)
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
userId: UserId,
thumbSetName: String,
thumb: MultipartFile
) = execute(
SetStickerSetThumbnail(userId, thumbSetName, thumb)
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
user: CommonUser,
thumbSetName: String,
thumb: FileId
) = setStickerSetThumb(
user.id, thumbSetName, thumb
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
user: CommonUser,
thumbSetName: String,
thumb: MultipartFile
) = setStickerSetThumb(
user.id, thumbSetName, thumb
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
userId: UserId,
thumbSet: StickerSet,
thumb: FileId
) = setStickerSetThumb(
userId, thumbSet.name, thumb
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
userId: UserId,
thumbSet: StickerSet,
thumb: MultipartFile
) = setStickerSetThumb(
userId, thumbSet.name, thumb
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
user: CommonUser,
thumbSet: StickerSet,
thumb: FileId
) = setStickerSetThumb(
user.id, thumbSet.name, thumb
)
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
suspend fun TelegramBot.setStickerSetThumb(
user: CommonUser,
thumbSet: StickerSet,
thumb: MultipartFile
) = setStickerSetThumb(
user.id, thumbSet.name, thumb
)

View File

@ -5,5 +5,3 @@ import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
interface WithReplyMarkup {
val replyMarkup: KeyboardMarkup?
}
@Deprecated("Renamed", ReplaceWith("WithReplyMarkup", "dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup"))
typealias ReplyMarkup = WithReplyMarkup

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.bot.exceptions
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.Response
import dev.inmo.tgbotapi.types.RetryAfterError
import io.ktor.utils.io.errors.IOException

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.bot.settings.limiters
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.MilliSeconds
import kotlinx.coroutines.*
import kotlinx.coroutines.sync.Semaphore
@ -8,7 +8,7 @@ import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import kotlin.math.roundToLong
private fun now(): Long = DateTime.nowUnixLong()
private fun now(): Long = DateTime.nowUnixMillisLong()
@Serializable
class CommonLimiter(

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.requests.chat.abstracts
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.*
import kotlinx.serialization.DeserializationStrategy

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.requests.chat.invite_links
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.chat.abstracts.*
import dev.inmo.tgbotapi.types.*

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.requests.chat.invite_links
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.requests.chat.abstracts.*
import dev.inmo.tgbotapi.types.*

View File

@ -2,8 +2,4 @@ package dev.inmo.tgbotapi.requests.send.abstracts
interface ThumbedSendMessageRequest<T: Any>: SendMessageRequest<T> {
val thumbnail: String?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnail"))
val thumb: String?
get() = thumbnail
}

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.requests.send.polls
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.abstracts.TextedOutput
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest

View File

@ -77,9 +77,6 @@ val UserId.userLink: String
get() = chatId.userLink
val User.userLink: String
get() = id.userLink
@Deprecated("Deprecated due to the conflicts in name", ReplaceWith("this.userLink", "dev.inmo.tgbotapi.types.userLink"))
val User.link: String
get() = userLink
typealias UserId = ChatId

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.abstracts.WithUser
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.utils.RiskFeature

View File

@ -375,17 +375,9 @@ const val stickerFileIdField = "sticker_file_id"
const val gameShortNameField = "game_short_name"
const val thumbnailUrlField = "thumbnail_url"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailUrlField", "dev.inmo.tgbotapi.types.thumbnailUrlField"))
const val thumbUrlField = "thumb_url"
const val thumbnailMimeTypeField = "thumbnail_mime_type"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailMimeTypeField", "dev.inmo.tgbotapi.types.thumbnailMimeTypeField"))
const val thumbMimeTypeField = "thumb_mime_type"
const val thumbnailWidthField = "thumbnail_width"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailWidthField", "dev.inmo.tgbotapi.types.thumbnailWidthField"))
const val thumbWidthField = "thumb_width"
const val thumbnailHeightField = "thumbnail_height"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailHeightField", "dev.inmo.tgbotapi.types.thumbnailHeightField"))
const val thumbHeightField = "thumb_height"
const val inputMessageContentField = "input_message_content"
const val hideUrlField = "hide_url"
@ -440,8 +432,6 @@ const val idField = "id"
const val pollIdField = "poll_id"
const val textField = "text"
const val thumbnailField = "thumbnail"
@Deprecated("Renamed (in telegram bot api)", ReplaceWith("thumbnailField", "dev.inmo.tgbotapi.types.thumbnailField"))
const val thumbField = "thumb"
const val emojiField = "emoji"
const val emojisField = "emojis"
const val titleField = "title"

View File

@ -2,11 +2,5 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
interface ThumbSizedInlineQueryResult : InlineQueryResult, ThumbedInlineQueryResult {
val thumbnailWidth: Int?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailWidth"))
val thumbWidth: Int?
get() = thumbnailWidth
val thumbnailHeight: Int?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailHeight"))
val thumbHeight: Int?
get() = thumbnailHeight
}

View File

@ -4,14 +4,8 @@ import dev.inmo.tgbotapi.utils.MimeType
interface ThumbedInlineQueryResult : InlineQueryResult {
val thumbnailUrl: String?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailUrl"))
val thumbUrl: String?
get() = thumbnailUrl
}
interface ThumbedWithMimeTypeInlineQueryResult : ThumbedInlineQueryResult {
val thumbnailMimeType: MimeType?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailMimeType"))
val thumbMimeType: MimeType?
get() = thumbnailMimeType
}

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
sealed class RequestError
@ -10,7 +10,7 @@ data class RetryAfterError(
) : RequestError() {
val canContinue = (seconds * 1000L) + startCountingMillis
val leftToRetry: Long
get() = canContinue - DateTime.nowUnixLong()
get() = canContinue - DateTime.nowUnixMillisLong()
}
data class MigrateChatId(

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import kotlinx.serialization.*
@Serializable

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.utils.RiskFeature
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer

View File

@ -14,12 +14,6 @@ const val UPDATE_POLL_ANSWER = "poll_answer"
const val UPDATE_MY_CHAT_MEMBER = "my_chat_member"
const val UPDATE_CHAT_MEMBER = "chat_member"
const val UPDATE_CHAT_JOIN_REQUEST = "chat_join_request"
@Deprecated("Renamed", ReplaceWith("UPDATE_MY_CHAT_MEMBER", "dev.inmo.tgbotapi.types.UPDATE_MY_CHAT_MEMBER"))
const val MY_CHAT_MEMBER = UPDATE_MY_CHAT_MEMBER
@Deprecated("Renamed", ReplaceWith("UPDATE_CHAT_MEMBER", "dev.inmo.tgbotapi.types.UPDATE_CHAT_MEMBER"))
const val CHAT_MEMBER = UPDATE_CHAT_MEMBER
@Deprecated("Renamed", ReplaceWith("UPDATE_CHAT_JOIN_REQUEST", "dev.inmo.tgbotapi.types.UPDATE_CHAT_JOIN_REQUEST"))
const val CHAT_JOIN_REQUEST = UPDATE_CHAT_JOIN_REQUEST
val ALL_UPDATES_LIST = listOf(
UPDATE_MESSAGE,

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.chat
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.abstracts.FromUser
import dev.inmo.tgbotapi.types.*
import kotlinx.serialization.SerialName

View File

@ -2,8 +2,4 @@ package dev.inmo.tgbotapi.types.files
sealed interface ThumbedMediaFile : TelegramMediaFile {
val thumbnail: PhotoSize?
@Deprecated("Renamed (in telegram bot api)", ReplaceWith("thumbnail"))
val thumb: PhotoSize?
get() = thumbnail
}

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.ChannelChat

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.ChannelChat
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.ChannelEvent

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.types.message.ChatEvents.voice
import com.soywiz.klock.TimeSpan
import com.soywiz.klock.seconds
import korlibs.time.TimeSpan
import korlibs.time.seconds
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.durationField
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.VideoChatEvent

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.chat.GroupChat

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.chat.SupergroupChat

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.*

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.chat.Chat

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.*

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.chat.PrivateChat
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.PrivateEvent

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.types.message.abstracts
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.abstracts.WithChat
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import dev.inmo.tgbotapi.types.MessageId

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.types.message.abstracts
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
interface PossiblyEditedMessage : Message {
val editDate: DateTime?
}
}

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.types.polls
import com.soywiz.klock.DateTime
import com.soywiz.klock.TimeSpan
import korlibs.time.DateTime
import korlibs.time.TimeSpan
import dev.inmo.tgbotapi.abstracts.TextedInput
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import dev.inmo.tgbotapi.types.*

View File

@ -32,9 +32,6 @@ sealed interface StickerSet {
val isVideo: Boolean
get() = false
val thumbnail: PhotoSize?
@Deprecated("Renamed in telegram bot api")
val thumb: PhotoSize?
get() = thumbnail
object Serializer : KSerializer<StickerSet> {
override val descriptor: SerialDescriptor = JsonElement.serializer().descriptor

View File

@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.utils
import com.soywiz.krypto.*
import korlibs.crypto.*
import io.ktor.http.decodeURLQueryComponent
import io.ktor.utils.io.core.toByteArray

View File

@ -1,12 +1,12 @@
package dev.inmo.tgbotapi.types
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.tgbotapi.TestsJsonFormat
import kotlinx.serialization.Serializable
import kotlin.test.Test
import kotlin.test.assertEquals
private val dateTimeUnix = DateTime.nowUnixLong()
private val dateTimeUnix = DateTime.nowUnixMillisLong()
private val dateTimeMillis = dateTimeUnix * 1000
private val dateTime = DateTime(dateTimeMillis)

View File

@ -1,7 +1,7 @@
package dev.inmo.tgbotapi.extensions.utils.shortcuts
import com.soywiz.klock.DateTime
import com.soywiz.klock.TimeSpan
import korlibs.time.DateTime
import korlibs.time.TimeSpan
import dev.inmo.tgbotapi.types.LongSeconds
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.polls.ApproximateScheduledCloseInfo