mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-12-14 18:25:44 +00:00
Compare commits
9 Commits
v10.0.0
...
9177e01910
| Author | SHA1 | Date | |
|---|---|---|---|
| 9177e01910 | |||
| 417f72af4a | |||
| df6d70b20d | |||
| 0b12df14db | |||
| 1590e1eef2 | |||
| 6896bc0772 | |||
| ce1abb0ae2 | |||
| 76a2cfd1a0 | |||
|
|
edca5494d4 |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,5 +1,15 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 10.1.0
|
||||
|
||||
## 10.0.1
|
||||
|
||||
* `Version`:
|
||||
* `Ktor`: `2.3.7` -> `2.3.8`
|
||||
* `MicroUtils`: `0.20.26` -> `0.20.32`
|
||||
* `Korlibs`: `5.3.0` -> `5.3.1`
|
||||
* `KSLog`: `1.3.1` -> `1.3.2`
|
||||
|
||||
## 10.0.0
|
||||
|
||||
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**
|
||||
|
||||
@@ -118,5 +118,5 @@ suspend fun main() {
|
||||
### More examples
|
||||
|
||||
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
||||
always welcome in our [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and
|
||||
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
|
||||
[chat](https://t.me/InMoTelegramBotAPIChat).
|
||||
|
||||
12
build.gradle
12
build.gradle
@@ -54,13 +54,13 @@ if (new File(projectDir, "secret.gradle").exists()) {
|
||||
githubRelease {
|
||||
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
||||
|
||||
owner "InsanusMokrassar"
|
||||
repo "TelegramBotAPI"
|
||||
owner = "InsanusMokrassar"
|
||||
repo = "TelegramBotAPI"
|
||||
|
||||
tagName "v$library_version"
|
||||
releaseName "$library_version"
|
||||
targetCommitish "$library_version"
|
||||
tagName = "v$library_version"
|
||||
releaseName = "$library_version"
|
||||
targetCommitish = "$library_version"
|
||||
|
||||
body getCurrentVersionChangelog()
|
||||
body = getCurrentVersionChangelog()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=10.0.0
|
||||
library_version=10.1.0
|
||||
|
||||
@@ -6,19 +6,19 @@ kotlin-coroutines = "1.7.3"
|
||||
|
||||
javax-activation = "1.1.1"
|
||||
|
||||
korlibs = "5.3.0"
|
||||
korlibs = "5.3.1"
|
||||
uuid = "0.8.2"
|
||||
ktor = "2.3.7"
|
||||
ktor = "2.3.8"
|
||||
|
||||
ksp = "1.9.22-1.0.16"
|
||||
kotlin-poet = "1.15.3"
|
||||
ksp = "1.9.22-1.0.17"
|
||||
kotlin-poet = "1.16.0"
|
||||
|
||||
microutils = "0.20.26"
|
||||
kslog = "1.3.1"
|
||||
microutils = "0.20.32"
|
||||
kslog = "1.3.2"
|
||||
|
||||
versions = "0.50.0"
|
||||
versions = "0.51.0"
|
||||
|
||||
github-release-plugin = "2.4.1"
|
||||
github-release-plugin = "2.5.2"
|
||||
dokka = "1.9.10"
|
||||
|
||||
[libraries]
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
|
||||
@@ -17,23 +17,41 @@ private val formatter
|
||||
sealed class ChatType {
|
||||
abstract val stringified: String
|
||||
@Serializable(ChatTypeSerializer::class)
|
||||
object PrivateChatType : ChatType() { override val stringified = "private" }
|
||||
object Sender : ChatType() { override val stringified = "sender" }
|
||||
@Serializable(ChatTypeSerializer::class)
|
||||
object GroupChatType : ChatType() { override val stringified = "group" }
|
||||
object Private : ChatType() { override val stringified = "private" }
|
||||
@Serializable(ChatTypeSerializer::class)
|
||||
object SupergroupChatType : ChatType() { override val stringified = "supergroup" }
|
||||
object Group : ChatType() { override val stringified = "group" }
|
||||
@Serializable(ChatTypeSerializer::class)
|
||||
object ChannelChatType : ChatType() { override val stringified = "channel" }
|
||||
object Supergroup : ChatType() { override val stringified = "supergroup" }
|
||||
@Serializable(ChatTypeSerializer::class)
|
||||
class UnknownChatType(override val stringified: String) : 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) {
|
||||
ChatType.PrivateChatType.stringified -> ChatType.PrivateChatType
|
||||
ChatType.GroupChatType.stringified -> ChatType.GroupChatType
|
||||
ChatType.SupergroupChatType.stringified -> ChatType.SupergroupChatType
|
||||
ChatType.ChannelChatType.stringified -> ChatType.ChannelChatType
|
||||
else -> ChatType.UnknownChatType(this)
|
||||
ChatType.Sender.stringified -> ChatType.Sender
|
||||
ChatType.Private.stringified -> ChatType.Private
|
||||
ChatType.Group.stringified -> ChatType.Group
|
||||
ChatType.Supergroup.stringified -> ChatType.Supergroup
|
||||
ChatType.Channel.stringified -> ChatType.Channel
|
||||
else -> ChatType.Unknown(this)
|
||||
}
|
||||
|
||||
@RiskFeature
|
||||
@@ -63,15 +81,16 @@ object ChatSerializer : KSerializer<Chat> {
|
||||
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
||||
|
||||
when (type) {
|
||||
ChatType.PrivateChatType -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.GroupChatType -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
||||
ChatType.SupergroupChatType -> if (isForum) {
|
||||
ChatType.Sender -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.Private -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.Group -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
||||
ChatType.Supergroup -> if (isForum) {
|
||||
formatter.decodeFromJsonElement(ForumChatImpl.serializer(), decodedJson)
|
||||
} else {
|
||||
formatter.decodeFromJsonElement(SupergroupChatImpl.serializer(), decodedJson)
|
||||
}
|
||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.UnknownChatType -> UnknownChatType(
|
||||
ChatType.Channel -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.Unknown -> UnknownChatType(
|
||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||
decodedJson.toString(),
|
||||
decodedJson
|
||||
@@ -101,15 +120,16 @@ object PreviewChatSerializer : KSerializer<PreviewChat> {
|
||||
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
||||
|
||||
return when (type) {
|
||||
ChatType.PrivateChatType -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.GroupChatType -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
||||
ChatType.SupergroupChatType -> if (isForum) {
|
||||
ChatType.Sender -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.Private -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.Group -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson)
|
||||
ChatType.Supergroup -> if (isForum) {
|
||||
formatter.decodeFromJsonElement(ForumChatImpl.serializer(), decodedJson)
|
||||
} else {
|
||||
formatter.decodeFromJsonElement(SupergroupChatImpl.serializer(), decodedJson)
|
||||
}
|
||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.UnknownChatType -> UnknownChatType(
|
||||
ChatType.Channel -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.Unknown -> UnknownChatType(
|
||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||
decodedJson.toString(),
|
||||
decodedJson
|
||||
@@ -143,16 +163,16 @@ sealed class ExtendedChatSerializer : KSerializer<ExtendedChat> {
|
||||
val isForum = decodedJson[isForumField] ?.jsonPrimitive ?.booleanOrNull == true
|
||||
|
||||
return when (type) {
|
||||
// else -> throw IllegalArgumentException("Unknown type of chat")
|
||||
ChatType.PrivateChatType -> formatter.decodeFromJsonElement(ExtendedPrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.GroupChatType -> formatter.decodeFromJsonElement(ExtendedGroupChatImpl.serializer(), decodedJson)
|
||||
ChatType.SupergroupChatType -> if (isForum) {
|
||||
ChatType.Sender -> formatter.decodeFromJsonElement(ExtendedPrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.Private -> formatter.decodeFromJsonElement(ExtendedPrivateChatImpl.serializer(), decodedJson)
|
||||
ChatType.Group -> formatter.decodeFromJsonElement(ExtendedGroupChatImpl.serializer(), decodedJson)
|
||||
ChatType.Supergroup -> if (isForum) {
|
||||
formatter.decodeFromJsonElement(ExtendedForumChatImpl.serializer(), decodedJson)
|
||||
} else {
|
||||
formatter.decodeFromJsonElement(ExtendedSupergroupChatImpl.serializer(), decodedJson)
|
||||
}
|
||||
ChatType.ChannelChatType -> formatter.decodeFromJsonElement(ExtendedChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.UnknownChatType -> UnknownExtendedChat(
|
||||
ChatType.Channel -> formatter.decodeFromJsonElement(ExtendedChannelChatImpl.serializer(), decodedJson)
|
||||
is ChatType.Unknown -> UnknownExtendedChat(
|
||||
formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(),
|
||||
decodedJson.toString(),
|
||||
decodedJson
|
||||
|
||||
Reference in New Issue
Block a user