mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-17 12:30:20 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| de761c7cf2 | |||
| d3bff680c3 | |||
| a0c10d9a9a | |||
| e2901cb9f9 | |||
| 3c60d074ba | |||
| f10cfdc5f1 | |||
| 270f9a60c1 | |||
| 2b49a75a42 | |||
| 9f7a348000 | |||
| 8cec74aa6a | |||
| d1914c8045 | |||
| baeb4848cf | |||
| dbadcb3f5a | |||
| 13dd73dd63 | |||
| ceba86abcb | |||
| f6a0b1a19d | |||
| 4ed6e5c7b2 | |||
| 7f43dc0815 |
7
.github/workflows/packages_publishing.yml
vendored
7
.github/workflows/packages_publishing.yml
vendored
@@ -16,7 +16,12 @@ jobs:
|
|||||||
mv gradle.properties.tmp gradle.properties
|
mv gradle.properties.tmp gradle.properties
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew 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
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
||||||
env:
|
env:
|
||||||
|
|||||||
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,5 +1,22 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 4.1.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.7.21` -> `1.7.22`
|
||||||
|
* `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`:
|
||||||
|
* `MicroUtils`: `0.14.1` -> `0.14.2`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Fixes in `CallbackQuery` waiters
|
||||||
|
|
||||||
## 4.1.1
|
## 4.1.1
|
||||||
|
|
||||||
* `Core`:
|
* `Core`:
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=4.1.1
|
library_version=4.1.3
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "1.7.21"
|
kotlin = "1.7.22"
|
||||||
kotlin-serialization = "1.4.1"
|
kotlin-serialization = "1.4.1"
|
||||||
kotlin-coroutines = "1.6.4"
|
kotlin-coroutines = "1.6.4"
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ ktor = "2.1.3"
|
|||||||
ksp = "1.7.21-1.0.8"
|
ksp = "1.7.21-1.0.8"
|
||||||
kotlin-poet = "1.12.0"
|
kotlin-poet = "1.12.0"
|
||||||
|
|
||||||
microutils = "0.14.1"
|
microutils = "0.14.4"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
github-release-plugin = "2.4.1"
|
||||||
dokka = "1.7.20"
|
dokka = "1.7.20"
|
||||||
|
|||||||
@@ -42,20 +42,40 @@ publishing {
|
|||||||
maven {
|
maven {
|
||||||
name = "GithubPackages"
|
name = "GithubPackages"
|
||||||
url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI")
|
url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI")
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
|
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
|
||||||
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
|
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
|
||||||
|
maven {
|
||||||
|
name = "Gitea"
|
||||||
|
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
||||||
|
|
||||||
|
credentials(HttpHeaderCredentials) {
|
||||||
|
name = "Authorization"
|
||||||
|
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
||||||
|
}
|
||||||
|
|
||||||
|
authentication {
|
||||||
|
header(HttpHeaderAuthentication)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||||
maven {
|
maven {
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -20,7 +20,7 @@ suspend inline fun <reified O> BehaviourContext.waitCallbackQueries(
|
|||||||
initRequest,
|
initRequest,
|
||||||
errorFactory
|
errorFactory
|
||||||
) {
|
) {
|
||||||
(it.callbackQueryUpdateOrNull() ?.data as O).let(::listOfNotNull)
|
(it.callbackQueryUpdateOrNull() ?.data as? O).let(::listOfNotNull)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ val UserId.userLink: String
|
|||||||
val User.link: String
|
val User.link: String
|
||||||
get() = id.userLink
|
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 Int.toChatId(): IdChatIdentifier = toLong().toChatId()
|
||||||
fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()
|
fun Byte.toChatId(): IdChatIdentifier = toLong().toChatId()
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ data class ExtendedGroupChatImpl(
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class ExtendedPrivateChatImpl(
|
data class ExtendedPrivateChatImpl(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: IdChatIdentifier,
|
override val id: UserId,
|
||||||
@SerialName(photoField)
|
@SerialName(photoField)
|
||||||
override val chatPhoto: ChatPhoto? = null,
|
override val chatPhoto: ChatPhoto? = null,
|
||||||
@SerialName(usernameField)
|
@SerialName(usernameField)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ data class GroupChatImpl(
|
|||||||
@Serializable
|
@Serializable
|
||||||
data class PrivateChatImpl(
|
data class PrivateChatImpl(
|
||||||
@SerialName(idField)
|
@SerialName(idField)
|
||||||
override val id: IdChatIdentifier,
|
override val id: UserId,
|
||||||
@SerialName(usernameField)
|
@SerialName(usernameField)
|
||||||
override val username: Username? = null,
|
override val username: Username? = null,
|
||||||
@SerialName(firstNameField)
|
@SerialName(firstNameField)
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ sealed interface Sticker : TelegramMediaFile, SizedMediaFile, ThumbedMediaFile {
|
|||||||
get() = false
|
get() = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(RiskFeature::class)
|
||||||
object StickerSerializer : KSerializer<Sticker> {
|
object StickerSerializer : KSerializer<Sticker> {
|
||||||
override val descriptor: SerialDescriptor = StickerSurrogate.serializer().descriptor
|
override val descriptor: SerialDescriptor = StickerSurrogate.serializer().descriptor
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
|
|
||||||
sealed interface CommonMessage<T: MessageContent> : Message,
|
sealed interface CommonMessage<out T: MessageContent> : Message,
|
||||||
PossiblyForwardedMessage,
|
PossiblyForwardedMessage,
|
||||||
PossiblyEditedMessage,
|
PossiblyEditedMessage,
|
||||||
PossiblyReplyMessage,
|
PossiblyReplyMessage,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
|
|
||||||
interface ContentMessage<T: MessageContent>: Message {
|
interface ContentMessage<out T: MessageContent>: Message {
|
||||||
val hasProtectedContent: Boolean
|
val hasProtectedContent: Boolean
|
||||||
val content: T
|
val content: T
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
|||||||
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
|
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
|
||||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
|
|
||||||
interface PossiblyMediaGroupMessage<T : MessageContent> : ContentMessage<T> {
|
interface PossiblyMediaGroupMessage<out T : MessageContent> : ContentMessage<T> {
|
||||||
val mediaGroupId: MediaGroupIdentifier?
|
val mediaGroupId: MediaGroupIdentifier?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,4 @@ package dev.inmo.tgbotapi.types.message.abstracts
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
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
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ infix fun String.mention(parseMode: ParseMode): String = when (parseMode) {
|
|||||||
is MarkdownV2 -> mentionMarkdownV2()
|
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 HTML -> first.textMentionHTML(second)
|
||||||
is Markdown -> first.textMentionMarkdown(second)
|
is Markdown -> first.textMentionMarkdown(second)
|
||||||
is MarkdownV2 -> first.textMentionMarkdownV2(second)
|
is MarkdownV2 -> first.textMentionMarkdownV2(second)
|
||||||
|
|||||||
Reference in New Issue
Block a user