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

Merge pull request #686 from InsanusMokrassar/4.1.3

4.1.3
This commit is contained in:
InsanusMokrassar 2022-11-28 16:35:58 +06:00 committed by GitHub
commit 7bab96a9cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 27 additions and 12 deletions

View File

@ -16,7 +16,12 @@ jobs:
mv gradle.properties.tmp gradle.properties
- name: Build
run: ./gradlew build
- name: Publish
- name: Publish to Gitea
continue-on-error: true
run: ./gradlew publishAllPublicationsToGiteaRepository
env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
- name: Publish to GithubPackages
continue-on-error: true
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
env:

View File

@ -1,5 +1,14 @@
# TelegramBotAPI changelog
## 4.1.3
* `Versions`:
* `MicroUtils`: `0.14.2` -> `0.14.4`
* `Core`:
* `ContentMessage`, `CommonMessage`, `PossiblyMediaGroupMessage` and `PossiblySentViaBotCommonMessage` got `out`
variance
* `UserId` now is `ChatId` instead of `IdChatIdentififer`
## 4.1.2
* `Versions`:

View File

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

View File

@ -13,7 +13,7 @@ ktor = "2.1.3"
ksp = "1.7.21-1.0.8"
kotlin-poet = "1.12.0"
microutils = "0.14.2"
microutils = "0.14.4"
github-release-plugin = "2.4.1"
dokka = "1.7.20"

View File

@ -69,9 +69,9 @@ val UserId.userLink: String
val User.link: String
get() = id.userLink
typealias UserId = IdChatIdentifier
typealias UserId = ChatId
fun Identifier.toChatId(): IdChatIdentifier = ChatId(this)
fun Identifier.toChatId(): ChatId = ChatId(this)
fun Int.toChatId(): IdChatIdentifier = toLong().toChatId()
fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()

View File

@ -52,7 +52,7 @@ data class ExtendedGroupChatImpl(
@Serializable
data class ExtendedPrivateChatImpl(
@SerialName(idField)
override val id: IdChatIdentifier,
override val id: UserId,
@SerialName(photoField)
override val chatPhoto: ChatPhoto? = null,
@SerialName(usernameField)

View File

@ -18,7 +18,7 @@ data class GroupChatImpl(
@Serializable
data class PrivateChatImpl(
@SerialName(idField)
override val id: IdChatIdentifier,
override val id: UserId,
@SerialName(usernameField)
override val username: Username? = null,
@SerialName(firstNameField)

View File

@ -42,6 +42,7 @@ sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile {
get() = false
}
@OptIn(RiskFeature::class)
object StickerSerializer : KSerializer<Sticker> {
override val descriptor: SerialDescriptor = StickerSurrogate.serializer().descriptor

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.message.content.MessageContent
sealed interface CommonMessage<T: MessageContent> : Message,
sealed interface CommonMessage<out T: MessageContent> : Message,
PossiblyForwardedMessage,
PossiblyEditedMessage,
PossiblyReplyMessage,

View File

@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface ContentMessage<T: MessageContent>: Message {
interface ContentMessage<out T: MessageContent>: Message {
val hasProtectedContent: Boolean
val content: T

View File

@ -3,6 +3,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
import dev.inmo.tgbotapi.types.message.content.MessageContent
interface PossiblyMediaGroupMessage<T : MessageContent> : ContentMessage<T> {
interface PossiblyMediaGroupMessage<out T : MessageContent> : ContentMessage<T> {
val mediaGroupId: MediaGroupIdentifier?
}

View File

@ -2,4 +2,4 @@ package dev.inmo.tgbotapi.types.message.abstracts
import dev.inmo.tgbotapi.types.message.content.MessageContent
sealed interface PossiblySentViaBotCommonMessage<T: MessageContent> : CommonMessage<T>, PossiblySentViaBot
sealed interface PossiblySentViaBotCommonMessage<out T: MessageContent> : CommonMessage<T>, PossiblySentViaBot

View File

@ -200,7 +200,7 @@ infix fun String.mention(parseMode: ParseMode): String = when (parseMode) {
is MarkdownV2 -> mentionMarkdownV2()
}
infix fun Pair<String, IdChatIdentifier>.mention(parseMode: ParseMode): String = when (parseMode) {
infix fun Pair<String, UserId>.mention(parseMode: ParseMode): String = when (parseMode) {
is HTML -> first.textMentionHTML(second)
is Markdown -> first.textMentionMarkdown(second)
is MarkdownV2 -> first.textMentionMarkdownV2(second)