diff --git a/.travis.yml b/.travis.yml index 24609ac63a..4e6ca51348 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,9 @@ os: linux dist: trusty jdk: oraclejdk8 -script: - - ./gradlew build -s - +jobs: + include: + - stage: build + script: ./gradlew build -s -x jvmTest -x jsIrTest -x jsIrBrowserTest -x jsIrNodeTest -x jsLegacyTest -x jsLegacyBrowserTest -x jsLegacyNodeTest + - state: test + script: ./gradlew allTests diff --git a/CHANGELOG.md b/CHANGELOG.md index 082c23aba5..31c5519ab5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # TelegramBotAPI changelog +## 0.28.0 + +**THIS VERSION CONTAINS BREAKING CHANGES** + +***PROJECT PACKAGES WERE CHANGED*** + +* Project `TelegramBotAPI` -> `TelegramBotAPI-core` +* Project `TelegramBotAPI-all` -> `TelegramBotAPI` + +* `Common`: + * Version updates: + * `Kotlin`: `1.3.72` -> `1.4.0` + * `Coroutines`: `1.3.8` -> `1.3.9` + * `Serialization`: `0.20.0` -> `1.0.0-RC` + * `Klock`: `1.11.14` -> `1.12.0` + * `UUID`: `0.1.1` -> `0.2.1` + * `Ktor`: `1.3.2` -> `1.4.0` + * `buildMimeType` function now is cache-oriented getter which will save already got mime types into internal map + * All deprecations from previous versions were removed +* `TelegramBotAPI-core`: + * Typealias `TelegramBot` was added + ## 0.27.0 * `Common`: diff --git a/README.md b/README.md index a38d4e8880..869ec46ab4 100644 --- a/README.md +++ b/README.md @@ -3,21 +3,21 @@ | Common info | [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://travis-ci.com/InsanusMokrassar/TelegramBotAPI.svg?branch=master)](https://travis-ci.com/InsanusMokrassar/TelegramBotAPI) [Small survey](https://forms.gle/tnjuExdSKEr32ygKA)| | -------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | Useful links | [![Chat in Telegram](badges/chat.svg)](https://t.me/InMoTelegramBotAPI) [![KDocs](badges/kdocs.svg)](https://tgbotapi.inmo.dev/docs/index.html) [Examples](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/), [Mini tutorial](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) | -| TelegramBotAPI status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI) | +| TelegramBotAPI Core status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-core/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI) | | TelegramBotAPI Extensions status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-api/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-api/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-api) | | TelegramBotAPI Util Extensions status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-utils) | -| TelegramBotAPI All status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-all/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-all/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-all/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-all) | +| TelegramBotAPI All status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-all) | It is a complex of libraries for working with `TelegramBotAPI` in type-safe and strict way as much as it possible. In the list of this complex currently next projects: -* [TelegramBotAPI](TelegramBotAPI/README.md) - core of library. In fact it is independent library and can be used alone +* [TelegramBotAPI-core](TelegramBotAPI-core/README.md) - core of library. In fact it is independent library and can be used alone without any additional library * [TelegramBotAPI Extensions](TelegramBotAPI-extensions-api/README.md) - contains extensions (mostly for `RequestsExecutor`), which allows to use the core library in more pleasant way * [TelegramBotAPI Util Extensions](TelegramBotAPI-extensions-utils/README.md) - contains extensions for more comfortable work with commands, updates and other different things -* [TelegramBotAPI All](TelegramBotAPI-all/README.md) - concentration of all previously mentioned libraries +* [TelegramBotAPI](TelegramBotAPI/README.md) - concentration of all previously mentioned libraries Most part of some specific solves or unuseful moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api). @@ -27,7 +27,7 @@ moments are describing by official [Telegram Bot API](https://core.telegram.org/ In case if you are want to use this library inside of browser, you will need additional settings (thanks for help to [Alexander Nozik](https://research.jetbrains.org/researchers/altavir)):
-Gradle build script help +Gradle build script help (for versions before 0.28.0) ```groovy dependencies { @@ -67,14 +67,14 @@ kotlin { ![Libraries hierarchy](resources/TelegramBotAPI-libraries-hierarchy.svg) -In most cases, the most simple way will be to implement [TelegramBotAPI All](TelegramBotAPI-all/README.md) - it contains +In most cases, the most simple way will be to implement [TelegramBotAPI](TelegramBotAPI/README.md) - it contains all necessary tools for comfort usage of this library. If you want to exclude some libraries, you can implement just [TelegramBotAPI API Extensions](TelegramBotAPI-extensions-api/README.md), [TelegramBotAPI Util Extensions](TelegramBotAPI-extensions-utils/README.md) or even -[TelegramBotAPI](TelegramBotAPI/README.md). +[TelegramBotAPI-core](TelegramBotAPI-core/README.md). If you want to dive deeper in the core of library or develop something for it - welcome to learn more from -[TelegramBotAPI](TelegramBotAPI/README.md) and our [Telegram Chat](https://teleg.one/InMoTelegramBotAPIChat). +[TelegramBotAPI-core](TelegramBotAPI-core/README.md) and our [Telegram Chat](https://teleg.one/InMoTelegramBotAPIChat). Anyway, all libraries are very typical inside of them. Examples: diff --git a/TelegramBotAPI-all/README.md b/TelegramBotAPI-all/README.md deleted file mode 100644 index 4fc918fb4e..0000000000 --- a/TelegramBotAPI-all/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# TelegramBotAPI-all - -Concentration of all TelegramBotAPI libraries: - -* [TelegramBotAPI](../TelegramBotAPI/README.md) -* [TelegramBotAPI Extensions](../TelegramBotAPI-extensions-api/README.md) -* [TelegramBotAPI Util Extensions](../TelegramBotAPI-extensions-utils/README.md) - -## Implementation - -```groovy -dependencies { - // ... - implementation "com.github.insanusmokrassar:TelegramBotAPI-all:tgBotAPIVersion" -} -``` diff --git a/TelegramBotAPI-all/build.gradle b/TelegramBotAPI-all/build.gradle deleted file mode 100644 index 939d13307f..0000000000 --- a/TelegramBotAPI-all/build.gradle +++ /dev/null @@ -1,52 +0,0 @@ -buildscript { - repositories { - mavenLocal() - jcenter() - mavenCentral() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" - classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version" - } -} - -plugins { - id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" - id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" -} - -project.version = "$library_version" -project.group = "$library_group" - -apply from: "publish.gradle" - -repositories { - mavenLocal() - jcenter() - mavenCentral() - maven { url "https://kotlin.bintray.com/kotlinx" } -} - -kotlin { - jvm() - js() - - sourceSets { - commonMain { - dependencies { - implementation kotlin('stdlib') - if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") { - api "${project.group}:TelegramBotAPI:$library_version" - api "${project.group}:TelegramBotAPI-extensions-api:$library_version" - api "${project.group}:TelegramBotAPI-extensions-utils:$library_version" - } else { - api project(":TelegramBotAPI") - api project(":TelegramBotAPI-extensions-api") - api project(":TelegramBotAPI-extensions-utils") - } - } - } - } -} diff --git a/TelegramBotAPI-all/mpp_publish_template.json b/TelegramBotAPI-all/mpp_publish_template.json deleted file mode 100644 index 363a274ae2..0000000000 --- a/TelegramBotAPI-all/mpp_publish_template.json +++ /dev/null @@ -1 +0,0 @@ -{"bintrayConfig":{"repo":"StandardRepository","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI"},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API All","description":"This project just include all subproject of TelegramBotAPI","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-all","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"} \ No newline at end of file diff --git a/TelegramBotAPI-core/README.md b/TelegramBotAPI-core/README.md new file mode 100644 index 0000000000..9fc57a46c2 --- /dev/null +++ b/TelegramBotAPI-core/README.md @@ -0,0 +1,151 @@ +# TelegramBotAPI-core + +[![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-core/images/download.svg) ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core/_latestVersion) +[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI) + +## What is it? + +Library for Object-Oriented and type-safe work with Telegram Bot API. Most part of some specific solves or unuseful +moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api). + +## Compatibility + +This version compatible with [4th of June 2020 update of TelegramBotAPI (version 4.9)](https://core.telegram.org/bots/api#june-4-2020). +There is only one exception of implemented functionality - Telegram Passport API, which was presented in +[August 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api-changelog#august-27-2018) update. It will be implemented +as soon as possible. + +## How to implement library? + +Common ways to implement this library are presented here. In some cases it will require additional steps +like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable +`telegrambotapi.version`, which must be set up by developer. Available versions are presented on +[bintray](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core), next version is last published: + +[![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-core/images/download.svg) ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core/_latestVersion) + +Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing +of signed artifacts in Bintray). You can: + +* Use earlier version (available version you can find +[here](https://mvnrepository.com/artifact/com.github.insanusmokrassar/TelegramBotAPI) (before 0.28.0) or [here](https://mvnrepository.com/artifact/com.github.insanusmokrassar/TelegramBotAPI-core)) +* Add `jCenter` repository in build config + +### Maven + +Dependency config presented here: + +```xml + + com.github.insanusmokrassar + TelegramBotAPI-core + ${telegrambotapi.version} + +``` + +### Gradle + +To use last versions you will need to add one line in repositories block of your `build.gradle`: + +`jcenter()` or `mavenCentral()` + +And add next line to your dependencies block: + +```groovy +implementation "com.github.insanusmokrassar:TelegramBotAPI-core:$telegrambotapi_version" +``` + +or for old gradle: + +```groovy +compile "com.github.insanusmokrassar:TelegramBotAPI-core:$telegrambotapi_version" +``` + +## How to work with library? + +For now, this library have no some API god-object. Instead of this, this library has several +important objects: + +* [RequestsExecutor](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt) +* [Requests](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests) +* [Types](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types) + +### Types + +Types declare different objects representation. For example, `Chat` for now represented as +interface and has several realisations: + +* `PrivateChat` +* `GroupChat` +* `SupergroupChat` +* `ChannelChat` + +Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat), +here it was separated for more obvious difference between chats types and their possible content. + +The same principle work with a lot of others things in this Telegram bot API. + +### Requests + +Requests usually are very simple objects, but some of them are using their own +build factories. For example, the next code show, how to get information about bot: + +```kotlin +val requestsExecutor: RequestsExecutor = ... +requestsExecutor.execute(GetMe()) +``` + +Also there is an alternative syntax for requests (like `requestsExecutor.getMe()` in project +[TelegramBotAPI-extensions-api](../TelegramBotAPI-extensions-api/README.md)) + +The result type of [GetMe (and getMe extension)](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt) +request is +[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt). + +### RequestsExecutor + +It is base object which can be used to execute requests in API. For now by default included Ktor +realisation of `RequestsExecutor`, but it is possible, that in future it will be extracted in separated +project. How to create `RequestsExecutor`: + +```kotlin +val requestsExecutor = KtorRequestsExecutor( + TelegramAPIUrlsKeeper(TOKEN) +) +``` + +Here: + +* `KtorRequestsExecutor` - default realisation with [ktor](https://ktor.io) +* `TelegramAPIUrlsKeeper` - special keeper, which you can save and use for getting files full urls (`resolveFileURL` +extension inside of `PathedFile.kt`) +* `TOKEN` is just a token of bot which was retrieved according to +[instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot). + +By default, for JVM there is implemented `CIO` client engine, but there is not server engine. Both can be changed like +here: + +```groovy +dependencies { + // ... + implementation "io.ktor:ktor-server-cio:$ktor_version" // for implementing of server engine + implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine + // ... +} +``` + +You can avoid using of `server` dependency in case if you will not use `Webhook`s. In this case, +dependencies list will be simplify: + +```groovy +dependencies { + // ... + implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine + // ... +} +``` + +Here was used `okhttp` realisation of client, but there are several others engines for Ktor. More information +available on ktor.io site for [client](https://ktor.io/clients/http-client/engines.html) and [server](https://ktor.io/quickstart/artifacts.html) +engines. + diff --git a/TelegramBotAPI-core/build.gradle b/TelegramBotAPI-core/build.gradle new file mode 100644 index 0000000000..19420bf448 --- /dev/null +++ b/TelegramBotAPI-core/build.gradle @@ -0,0 +1,91 @@ +buildscript { + repositories { + mavenLocal() + jcenter() + mavenCentral() + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" + classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version" + } +} + +plugins { + id "org.jetbrains.kotlin.multiplatform" + id "org.jetbrains.kotlin.plugin.serialization" +} + +project.version = "$library_version" +project.group = "$library_group" + +apply from: "publish.gradle" + +repositories { + mavenLocal() + jcenter() + mavenCentral() + maven { url "https://kotlin.bintray.com/kotlinx" } +} + +kotlin { + jvm() + js(BOTH) { + browser() + nodejs() + } + + sourceSets { + commonMain { + dependencies { + implementation kotlin('stdlib') + api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" + api "org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlin_serialisation_runtime_version" + api "org.jetbrains.kotlinx:kotlinx-serialization-properties:$kotlin_serialisation_runtime_version" + + api "com.soywiz.korlibs.klock:klock:$klock_version" + api "com.benasher44:uuid:$uuid_version" + + api "io.ktor:ktor-client-core:$ktor_version" + } + } + commonTest { + dependencies { + implementation kotlin('test-common') + implementation kotlin('test-annotations-common') + } + } + + jvmMain { + dependencies { + api "io.ktor:ktor-server:$ktor_version" + api "io.ktor:ktor-server-host-common:$ktor_version" + + api "io.ktor:ktor-client-cio:$ktor_version" + + api "javax.activation:activation:$javax_activation_version" + } + } + jvmTest { + dependencies { + implementation kotlin('test-junit') + } + } + + jsTest { + dependencies { + implementation kotlin('test-junit') + implementation kotlin('test-js') + } + } + } + + targets.all { + compilations.all { + kotlinOptions { + freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlin.RequiresOptIn"] + } + } + } +} diff --git a/TelegramBotAPI-all/maven.publish.gradle b/TelegramBotAPI-core/maven.publish.gradle similarity index 90% rename from TelegramBotAPI-all/maven.publish.gradle rename to TelegramBotAPI-core/maven.publish.gradle index 173e11888f..864ee68673 100644 --- a/TelegramBotAPI-all/maven.publish.gradle +++ b/TelegramBotAPI-core/maven.publish.gradle @@ -21,9 +21,9 @@ publishing { artifact javadocsJar pom { - description = "This project just include all subproject of TelegramBotAPI" - name = "Telegram Bot API All" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-all" + description = "Library for Object-Oriented and type-safe work with Telegram Bot API" + name = "Telegram Bot API Core" + url = "https://insanusmokrassar.github.io/TelegramBotAPI" scm { developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" diff --git a/TelegramBotAPI-core/mpp_publish_template.kpsb b/TelegramBotAPI-core/mpp_publish_template.kpsb new file mode 100644 index 0000000000..6eb0c9ab45 --- /dev/null +++ b/TelegramBotAPI-core/mpp_publish_template.kpsb @@ -0,0 +1 @@ +{"bintrayConfig":{"repo":"StandardRepository","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI"},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"} \ No newline at end of file diff --git a/TelegramBotAPI-all/publish.gradle b/TelegramBotAPI-core/publish.gradle similarity index 100% rename from TelegramBotAPI-all/publish.gradle rename to TelegramBotAPI-core/publish.gradle diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Captioned.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Captioned.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Captioned.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Captioned.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonContactData.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonContactData.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonContactData.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonContactData.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonVenueData.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonVenueData.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonVenueData.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/CommonVenueData.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Explained.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Explained.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Explained.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Explained.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Livable.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Livable.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Livable.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Livable.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Locationed.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Locationed.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Locationed.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Locationed.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/MimeTyped.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/MimeTyped.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/MimeTyped.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/MimeTyped.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Performerable.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Performerable.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Performerable.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Performerable.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/TextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/TextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/TextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/TextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Titled.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Titled.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Titled.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/Titled.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ChatRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ChatRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ChatRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ChatRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableNotification.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableNotification.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableNotification.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableNotification.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableWebPagePreview.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableWebPagePreview.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableWebPagePreview.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/DisableWebPagePreview.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/InlineMessageAction.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/InlineMessageAction.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/InlineMessageAction.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/InlineMessageAction.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/MessageAction.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/MessageAction.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/MessageAction.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/MessageAction.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMarkup.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMarkup.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMarkup.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMarkup.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMessageId.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMessageId.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMessageId.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/ReplyMessageId.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/UntilDate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/UntilDate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/UntilDate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/CommonAbstracts/types/UntilDate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/BaseRequestsExecutor.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/BaseRequestsExecutor.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/BaseRequestsExecutor.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/BaseRequestsExecutor.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorCallFactory.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorCallFactory.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorCallFactory.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorCallFactory.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt similarity index 91% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt index b9714d11b3..28bfff56d4 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/KtorRequestsExecutor.kt @@ -44,8 +44,8 @@ class KtorRequestsExecutor( return handleSafely( { e -> throw if (e is ClientRequestException) { - val content = e.response.readText() - val responseObject = jsonFormatter.parse(Response.serializer(), content) + val content = e.response ?.readText() ?: throw e + val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content) newRequestException( responseObject, content, @@ -71,10 +71,10 @@ class KtorRequestsExecutor( val response = statement?.execute() ?: throw IllegalArgumentException("Can't execute request: $request") val content = response.receive() - val responseObject = jsonFormatter.parse(Response.serializer(), content) + val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content) (responseObject.result?.let { - jsonFormatter.fromJson(request.resultDeserializer, it) + jsonFormatter.decodeFromJsonElement(request.resultDeserializer, it) } ?: responseObject.parameters?.let { val error = it.error if (error is RetryAfterError) { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/AbstractRequestCallFactory.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/AbstractRequestCallFactory.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/AbstractRequestCallFactory.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/AbstractRequestCallFactory.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/MultipartRequestCallFactory.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/MultipartRequestCallFactory.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/MultipartRequestCallFactory.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/MultipartRequestCallFactory.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/SimpleRequestCallFactory.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/SimpleRequestCallFactory.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/SimpleRequestCallFactory.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/Ktor/base/SimpleRequestCallFactory.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt similarity index 95% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt index 90fafa2e4c..2eba982739 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt @@ -19,4 +19,6 @@ interface RequestsExecutor : Closeable { * @throws Exception */ suspend fun execute(request: Request): T -} \ No newline at end of file +} + +typealias TelegramBot = RequestsExecutor diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/exceptions/RequestException.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/ProxySettings.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/ProxySettings.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/ProxySettings.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/ProxySettings.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/CommonLimiter.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/CommonLimiter.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/CommonLimiter.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/CommonLimiter.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/EmptyLimiter.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/EmptyLimiter.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/EmptyLimiter.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/EmptyLimiter.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/PowLimiter.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/PowLimiter.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/PowLimiter.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/PowLimiter.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/RequestLimiter.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/RequestLimiter.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/RequestLimiter.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/settings/limiters/RequestLimiter.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/DeleteMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/ForwardMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetUpdates.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/StopPoll.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt similarity index 82% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt index 262623227d..3227b9d0fe 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFile.kt @@ -2,6 +2,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializable(InputFileSerializer::class) sealed class InputFile { @@ -21,7 +24,7 @@ fun String.toInputFile() = FileId(this) @Serializer(InputFile::class) internal object InputFileSerializer : KSerializer { - override val descriptor: SerialDescriptor = PrimitiveDescriptor(FileId::class.toString(), PrimitiveKind.STRING) + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(FileId::class.toString(), PrimitiveKind.STRING) override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId) override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString()) } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/MultipartRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/MultipartRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/MultipartRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/MultipartRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/Request.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/SimpleRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/AnswerInlineQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerPreCheckoutQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/AnswerShippingQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerPreCheckoutQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/answers/payments/abstracts/AnswerShippingQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMe.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMe.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMe.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMe.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMyCommands.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMyCommands.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMyCommands.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/GetMyCommands.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/SetMyCommands.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/SetMyCommands.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/SetMyCommands.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/bot/SetMyCommands.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/ExportChatInviteLink.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/LeaveChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/abstracts/ChatMemberRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/abstracts/ChatMemberRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/abstracts/ChatMemberRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/abstracts/ChatMemberRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatAdministrators.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/get/GetChatMembersCount.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/GetChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/KickChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/PromoteChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/RestrictChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/SetChatAdministratorCustomTitle.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/members/UnbanChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/DeleteChatPhoto.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/PinChatMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatDescription.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPermissions.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatPhoto.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/SetChatTitle.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/modify/UnpinChatMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/DeleteChatStickerSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/chat/stickers/SetChatStickerSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/common/CommonMultipartFileRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/common/CommonMultipartFileRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/common/CommonMultipartFileRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/common/CommonMultipartFileRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditChatMessageLiveLocation.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/EditInlineMessageLiveLocation.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopChatMessageLiveLocation.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/LiveLocation/StopInlineMessageLiveLocation.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditChatMessageReplyMarkup.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/ReplyMarkup/EditInlineMessageReplyMarkup.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditChatMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditChatMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditChatMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditChatMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditDisableWebPagePreviewMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditDisableWebPagePreviewMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditDisableWebPagePreviewMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditDisableWebPagePreviewMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditInlineMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditLocationMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditLocationMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditLocationMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditLocationMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditMediaMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditMediaMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditMediaMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditMediaMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditReplyMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditReplyMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditReplyMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditReplyMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/abstracts/EditTextChatMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditChatMessageCaption.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/caption/EditInlineMessageCaption.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditChatMessageMedia.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/media/EditInlineMessageMedia.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditChatMessageText.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/edit/text/EditInlineMessageText.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/GetGameHighScoresByInlineMessageId.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByChatId.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/SetGameScoreByInlineMessageId.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/GetGameHighScores.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/games/abstracts/SetGameScore.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetStickerSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/get/GetUserProfilePhotos.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendAction.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendContact.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendDice.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendDice.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendDice.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendDice.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendLocation.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/SendVenue.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/DuratedSendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/DuratedSendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/DuratedSendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/DuratedSendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/PositionedSendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/PositionedSendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/PositionedSendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/PositionedSendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ReplyingMarkupSendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ReplyingMarkupSendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ReplyingMarkupSendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ReplyingMarkupSendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendChatMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendChatMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendChatMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendChatMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SizedSendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SizedSendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SizedSendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/SizedSendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TextableSendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TextableSendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TextableSendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TextableSendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ThumbedSendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ThumbedSendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ThumbedSendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/ThumbedSendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TitledSendMessageRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TitledSendMessageRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TitledSendMessageRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/abstracts/TitledSendMessageRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/games/SendGame.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAnimation.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendAudio.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendDocument.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt similarity index 89% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt index c28dab19ea..878cc01a6f 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendMediaGroup.kt @@ -12,11 +12,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.utils.throwRangeError import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls import kotlinx.serialization.* import kotlinx.serialization.builtins.ListSerializer -import kotlinx.serialization.json.jsonArray - -@Deprecated("Replaced and renamed", ReplaceWith("mediaCountInMediaGroup", "com.github.insanusmokrassar.TelegramBotAPI.types.mediaCountInMediaGroup")) -val membersCountInMediaGroup - get() = mediaCountInMediaGroup +import kotlinx.serialization.json.buildJsonArray fun SendMediaGroup( chatId: ChatIdentifier, @@ -71,9 +67,9 @@ data class SendMediaGroupData internal constructor( ) : DataRequest>, SendMessageRequest> { @SerialName(mediaField) private val convertedMedia: String - get() = jsonArray { + get() = buildJsonArray { media.forEach { - +it.toJsonWithoutNulls(MediaGroupMemberInputMediaSerializer) + add(it.toJsonWithoutNulls(MediaGroupMemberInputMediaSerializer)) } }.toString() diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendPhoto.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendSticker.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideo.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVideoNote.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/SendVoice.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/DataRequest.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/Files.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/Files.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/Files.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/Files.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/MultipartRequestImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/MultipartRequestImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/MultipartRequestImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/media/base/MultipartRequestImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/payments/SendInvoice.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt similarity index 97% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt index 662d1c69e4..c0d02096e3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/send/polls/SendPoll.kt @@ -212,15 +212,11 @@ data class SendQuizPoll( override val replyToMessageId: MessageIdentifier? = null, @SerialName(replyMarkupField) override val replyMarkup: KeyboardMarkup? = null -) : SendPoll(), CaptionedOutput, ExplainedOutput { +) : SendPoll(), ExplainedOutput { override val type: String = quizPollType override val requestSerializer: SerializationStrategy<*> get() = serializer() - @Deprecated("Will be removed in near updates", ReplaceWith("explanation")) - override val caption: String? - get() = explanation - @SerialName(openPeriodField) override val openPeriod: LongSeconds? = (closeInfo as? ApproximateScheduledCloseInfo) ?.openDuration ?.millisecondsLong ?.div(1000) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddAnimatedStickerToSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddAnimatedStickerToSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddAnimatedStickerToSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddAnimatedStickerToSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStaticStickerToSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStaticStickerToSet.kt similarity index 73% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStaticStickerToSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStaticStickerToSet.kt index 769cd69e55..6deb5916f8 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStaticStickerToSet.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/AddStaticStickerToSet.kt @@ -24,24 +24,6 @@ fun AddStaticStickerToSet( } } -@Deprecated( - "Renamed", - ReplaceWith("AddStaticStickerToSet", "com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.AddStaticStickerToSet") -) -fun AddStickerToSet( - userId: UserId, - stickerSetName: String, - sticker: InputFile, - emojis: String, - maskPosition: MaskPosition? = null -) = AddStaticStickerToSet(userId, stickerSetName, sticker, emojis, maskPosition) - -@Deprecated( - "Renamed", - ReplaceWith("AddStaticStickerToSet", "com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.AddStaticStickerToSet") -) -typealias AddStickerToSet = AddStaticStickerToSet - @Serializable data class AddStaticStickerToSet internal constructor( @SerialName(userIdField) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewAnimatedStickerSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewAnimatedStickerSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewAnimatedStickerSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewAnimatedStickerSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStaticStickerSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStaticStickerSet.kt similarity index 90% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStaticStickerSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStaticStickerSet.kt index 2fda4511cc..06801854ea 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStaticStickerSet.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/CreateNewStaticStickerSet.kt @@ -34,12 +34,6 @@ fun CreateNewStickerSet( maskPosition: MaskPosition? = null ): Request = CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition) -@Deprecated( - "Renamed", - ReplaceWith("CreateNewStaticStickerSet", "com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.CreateNewStaticStickerSet") -) -typealias CreateNewStickerSet = CreateNewStaticStickerSet - @Serializable data class CreateNewStaticStickerSet internal constructor( @SerialName(userIdField) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/DeleteStickerFromSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerPositionInSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerSetThumb.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerSetThumb.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerSetThumb.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/SetStickerSetThumb.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/UploadStickerFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StandardStickerSetAction.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StandardStickerSetAction.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StandardStickerSetAction.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StandardStickerSetAction.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/stickers/abstracts/StickerSetAction.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/DeleteWebhook.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/GetWebhookInfo.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/webhook/SetWebhook.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt similarity index 84% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt index 3ac9d3470d..5f280450de 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotCommand.kt @@ -4,7 +4,10 @@ import com.github.insanusmokrassar.TelegramBotAPI.utils.throwRangeError import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable -val BotCommandNameRegex = Regex("^[a-z_0-9]{${botCommandLengthLimit.first},${botCommandLengthLimit.last}}$") +// Made as lazy for correct work in K/JS +val BotCommandNameRegex by lazy { + Regex("^[a-z_0-9]{${botCommandLengthLimit.first},${botCommandLengthLimit.last}}$") +} @Serializable data class BotCommand( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/CallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/CallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/CallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/CallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/DataCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/DataCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/DataCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/DataCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/GameShortNameCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/GameShortNameCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/GameShortNameCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/GameShortNameCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdDataCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/InlineMessageIdGameShortNameCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageDataCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageDataCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageDataCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageDataCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/MessageGameShortNameCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/RawCallbackQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/RawCallbackQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/RawCallbackQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/CallbackQuery/RawCallbackQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt similarity index 88% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt index 603eb5e838..f65163691c 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifier.kt @@ -1,7 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import kotlinx.serialization.* -import kotlinx.serialization.json.JsonPrimitiveSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.* @Serializable(ChatIdentifierSerializer::class) sealed class ChatIdentifier @@ -40,7 +42,7 @@ fun String.toUsername(): Username = Username(this) @Serializer(ChatIdentifier::class) internal object ChatIdentifierSerializer : KSerializer { override fun deserialize(decoder: Decoder): ChatIdentifier { - val id = JsonPrimitiveSerializer.deserialize(decoder) + val id = JsonPrimitive.serializer().deserialize(decoder) return id.longOrNull ?.let { ChatId(it) } ?: id.content.let { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMemberImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMemberImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMemberImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/AdministratorChatMemberImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/CreatorChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/KickedChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/KickedChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/KickedChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/KickedChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/LeftChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/LeftChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/LeftChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/LeftChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/MemberChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/MemberChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/MemberChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/MemberChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RawChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RestrictedChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RestrictedChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RestrictedChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/RestrictedChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/AdministratorChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/AdministratorChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/AdministratorChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/AdministratorChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/BannedChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/BannedChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/BannedChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/BannedChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt similarity index 85% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt index 93c60cbf9b..6c385e4454 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatMember/abstracts/ChatMember.kt @@ -3,6 +3,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.RawChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.User import kotlinx.serialization.* +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder interface ChatMember { val user: User @@ -20,5 +23,5 @@ internal object ChatMemberDeserializationStrategy : DeserializationStrategy { - override val descriptor: SerialDescriptor = SerialDescriptor(InlineQueryResult::class.toString(), PolymorphicKind.OPEN) + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor(InlineQueryResult::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: InlineQueryResult) { when(value) { is InlineQueryResultArticle -> InlineQueryResultArticle.serializer().serialize(encoder, value) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputContactMessageContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputContactMessageContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputContactMessageContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputContactMessageContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputLocationMessageContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputLocationMessageContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputLocationMessageContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputLocationMessageContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputTextMessageContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputVenueMessageContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputVenueMessageContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputVenueMessageContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContent/InputVenueMessageContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt similarity index 80% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt index eefeae7248..3505235113 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/InputMessageContentSerializer.kt @@ -3,10 +3,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InputMessageContent.* import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializer(InputMessageContent::class) internal object InputMessageContentSerializer : KSerializer { - override val descriptor: SerialDescriptor = SerialDescriptor(InputMessageContent::class.toString(), PolymorphicKind.OPEN) + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor(InputMessageContent::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: InputMessageContent) { when (value) { is InputContactMessageContent -> InputContactMessageContent.serializer().serialize(encoder, value) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/ChosenInlineResult.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/ChosenInlineResult.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/ChosenInlineResult.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/ChosenInlineResult.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InlineQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InlineQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InlineQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InlineQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InputMessageContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InputMessageContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InputMessageContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/abstracts/InputMessageContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/BaseInlineQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/BaseInlineQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/BaseInlineQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/BaseInlineQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/LocationInlineQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/LocationInlineQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/LocationInlineQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/LocationInlineQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/RawInlineQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/RawInlineQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/RawInlineQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InlineQueries/query/RawInlineQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/DuratedInputMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/DuratedInputMedia.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/DuratedInputMedia.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/DuratedInputMedia.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMedia.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMedia.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMedia.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAnimation.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAnimation.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAnimation.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAnimation.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAudio.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAudio.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAudio.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaAudio.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaDocument.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaDocument.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaDocument.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaDocument.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt similarity index 86% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt index f45e903b94..4fd94035e9 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaPhoto.kt @@ -6,6 +6,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField import kotlinx.serialization.* +import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.JsonObject internal const val photoInputMediaType = "photo" @@ -18,7 +20,7 @@ data class InputMediaPhoto( ) : InputMedia, MediaGroupMemberInputMedia { override val type: String = photoInputMediaType - override fun serialize(format: StringFormat): String = format.stringify(serializer(), this) + override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this) @SerialName(mediaField) val media: String = when (file) { @@ -27,7 +29,7 @@ data class InputMediaPhoto( } @Transient - override val arguments: Map = Properties.storeNullable(serializer(), this) + override val arguments: JsonElement = buildArguments(serializer()) } fun PhotoSize.toInputMediaPhoto( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt similarity index 77% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt index 9da0db77fe..c61c13b8b0 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaSerializer.kt @@ -1,10 +1,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializer(InputMedia::class) internal object InputMediaSerializer : KSerializer { - override val descriptor: SerialDescriptor = SerialDescriptor(InputMedia::class.toString(), PolymorphicKind.OPEN) + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor(InputMedia::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: InputMedia) { when (value) { is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, value) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt similarity index 88% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt index 7b12d56613..7158dc3597 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/InputMediaVideo.kt @@ -5,6 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField import kotlinx.serialization.* +import kotlinx.serialization.json.JsonElement internal const val videoInputMediaType = "video" @@ -21,14 +22,15 @@ data class InputMediaVideo( ) : InputMedia, SizedInputMedia, DuratedInputMedia, ThumbedInputMedia, MediaGroupMemberInputMedia { override val type: String = videoInputMediaType - override fun serialize(format: StringFormat): String = format.stringify(serializer(), this) + override fun serialize(format: StringFormat): String = format.encodeToString(serializer(), this) + + + @Transient + override val arguments: JsonElement = buildArguments(serializer()) @SerialName(mediaField) val media: String = when (file) { is FileId -> file.fileId is MultipartFile -> file.fileId.toInputMediaFileAttachmentName() } - - @Transient - override val arguments: Map = Properties.storeNullable(serializer(), this) } diff --git a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMedia.kt new file mode 100644 index 0000000000..c4b6802fa7 --- /dev/null +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMedia.kt @@ -0,0 +1,21 @@ +package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia + +import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedOutput +import kotlinx.serialization.* +import kotlinx.serialization.json.* + +internal val argumentsFormatter by lazy { + Json { + encodeDefaults = true + } +} +internal fun T.buildArguments(withSerializer: SerializationStrategy) = argumentsFormatter.encodeToJsonElement( + withSerializer, + this +) + +@Serializable(MediaGroupMemberInputMediaSerializer::class) +interface MediaGroupMemberInputMedia : InputMedia, CaptionedOutput { + fun serialize(format: StringFormat): String + val arguments: JsonElement +} diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt similarity index 55% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt index 2796b3d222..cd9a86c68d 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/MediaGroupMemberInputMediaSerializer.kt @@ -3,11 +3,15 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia import com.github.insanusmokrassar.TelegramBotAPI.types.typeField import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.json.JsonObjectSerializer +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.* @Serializer(MediaGroupMemberInputMedia::class) internal object MediaGroupMemberInputMediaSerializer : KSerializer { - override val descriptor: SerialDescriptor = SerialDescriptor(MediaGroupMemberInputMedia::class.toString(), PolymorphicKind.OPEN) + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor(MediaGroupMemberInputMedia::class.toString(), PolymorphicKind.OPEN) override fun serialize(encoder: Encoder, value: MediaGroupMemberInputMedia) { when (value) { is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, value) @@ -16,11 +20,11 @@ internal object MediaGroupMemberInputMediaSerializer : KSerializer nonstrictJsonFormat.fromJson(InputMediaPhoto.serializer(), json) - videoInputMediaType -> nonstrictJsonFormat.fromJson(InputMediaVideo.serializer(), json) + return when (json[typeField] ?.jsonPrimitive ?.contentOrNull) { + photoInputMediaType -> nonstrictJsonFormat.decodeFromJsonElement(InputMediaPhoto.serializer(), json) + videoInputMediaType -> nonstrictJsonFormat.decodeFromJsonElement(InputMediaVideo.serializer(), json) else -> error("Illegal type of incoming MediaGroupMemberInputMedia") } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/SizedInputMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/SizedInputMedia.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/SizedInputMedia.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/SizedInputMedia.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/ThumbedInputMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/ThumbedInputMedia.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/ThumbedInputMedia.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/ThumbedInputMedia.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/TitledInputMedia.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/TitledInputMedia.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/TitledInputMedia.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/InputMedia/TitledInputMedia.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Location.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Location.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Location.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Location.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/LoginURL.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/LoginURL.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/LoginURL.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/LoginURL.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/RawMessageEntity.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BoldTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BoldTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BoldTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BoldTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BotCommandTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BotCommandTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BotCommandTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/BotCommandTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CashTagTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CashTagTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CashTagTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CashTagTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CodeTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CodeTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CodeTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/CodeTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/EMailTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/EMailTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/EMailTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/EMailTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/HashTagTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/HashTagTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/HashTagTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/HashTagTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/ItalicTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/ItalicTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/ItalicTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/ItalicTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/MentionTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/MentionTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/MentionTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/MentionTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PhoneNumberTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PhoneNumberTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PhoneNumberTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PhoneNumberTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PreTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PreTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PreTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/PreTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/RegularTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/RegularTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/RegularTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/RegularTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/StrikethroughTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/StrikethroughTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/StrikethroughTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/StrikethroughTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextLinkTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextLinkTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextLinkTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextLinkTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextMentionTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextMentionTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextMentionTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/TextMentionTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/URLTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/URLTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/URLTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/URLTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/UnderlineTextSource.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/UnderlineTextSource.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/UnderlineTextSource.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/textsources/UnderlineTextSource.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt similarity index 94% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt index 9e53d9b5d7..46d66003c5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseMode/ParseMode.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode import kotlinx.serialization.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder internal const val parseModeField = "parse_mode" diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/RequestError.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/RequestError.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/RequestError.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/RequestError.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Response.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Response.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Response.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/Response.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ResponseParametersRaw.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ResponseParametersRaw.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ResponseParametersRaw.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ResponseParametersRaw.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt similarity index 90% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt index f4ac135f99..381e08da1d 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDate.kt @@ -2,6 +2,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.soywiz.klock.DateTime import kotlinx.serialization.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializable(TelegramDateSerializer::class) data class TelegramDate( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UpdateTypes.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UpdateTypes.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UpdateTypes.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UpdateTypes.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt similarity index 82% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt index 9a8574e2dc..c885173630 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt @@ -5,7 +5,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.ExtendedPr import com.github.insanusmokrassar.TelegramBotAPI.utils.PreviewFeature import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.json.JsonObjectSerializer +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.* @Serializable(UserSerializer::class) sealed class User : PrivateChat @@ -69,24 +71,24 @@ data class ExtendedBot( @Serializer(User::class) internal object UserSerializer : KSerializer { override fun deserialize(decoder: Decoder): User { - val asJson = JsonObjectSerializer.deserialize(decoder) + val asJson = JsonObject.serializer().deserialize(decoder) return when { - asJson.getPrimitiveOrNull(isBotField) ?.booleanOrNull != true -> nonstrictJsonFormat.fromJson( + asJson[isBotField] ?.jsonPrimitive ?.booleanOrNull != true -> nonstrictJsonFormat.decodeFromJsonElement( CommonUser.serializer(), asJson ) else -> { - if ((asJson.get(canJoinGroupsField) - ?: asJson.get(canReadAllGroupMessagesField) - ?: asJson.get(supportInlineQueriesField)) != null + if ((asJson[canJoinGroupsField] + ?: asJson[canReadAllGroupMessagesField] + ?: asJson[supportInlineQueriesField]) != null ) { - nonstrictJsonFormat.fromJson( + nonstrictJsonFormat.decodeFromJsonElement( ExtendedBot.serializer(), asJson ) } else { - nonstrictJsonFormat.fromJson( + nonstrictJsonFormat.decodeFromJsonElement( CommonBot.serializer(), asJson ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserProfilePhotos.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/WebhookInfo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/WebhookInfo.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/WebhookInfo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/WebhookInfo.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt similarity index 97% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt index cce421d77b..da51cab99a 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/actions/BotAction.kt @@ -1,6 +1,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.actions import kotlinx.serialization.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder /** * Use BotAction objects realisations to notify user about bot actions diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/Common.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/Common.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/Common.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/Common.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ForceReply.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ForceReply.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ForceReply.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ForceReply.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButton.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt similarity index 83% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt index c6e08ada73..f45f542aca 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardButtons/InlineKeyboardButtonSerializer.kt @@ -3,11 +3,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardB import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* -import kotlinx.serialization.json.JsonElementSerializer -import kotlinx.serialization.json.JsonObject +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.* internal object InlineKeyboardButtonSerializer : KSerializer { - override val descriptor: SerialDescriptor = SerialDescriptor( + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor( "com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardButtons.InlineKeyboardButton", PolymorphicKind.SEALED ) @@ -26,10 +29,10 @@ internal object InlineKeyboardButtonSerializer : KSerializer SwitchInlineQueryCurrentChatInlineKeyboardButton.serializer().serialize(encoder, value) is URLInlineKeyboardButton -> URLInlineKeyboardButton.serializer().serialize(encoder, value) is CallbackGameInlineKeyboardButton -> CallbackGameInlineKeyboardButton.serializer().serialize(encoder, value) - is UnknownInlineKeyboardButton -> JsonElementSerializer.serialize(encoder, value.rawData) + is UnknownInlineKeyboardButton -> JsonElement.serializer().serialize(encoder, value.rawData) } } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/InlineKeyboardMarkup.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt similarity index 70% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt index f913c0d07a..6343c50ab5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButton.kt @@ -3,6 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.* @Serializable(KeyboardButtonSerializer::class) @@ -47,26 +49,26 @@ data class RequestPollKeyboardButton( @Serializer(KeyboardButton::class) internal object KeyboardButtonSerializer : KSerializer { override fun deserialize(decoder: Decoder): KeyboardButton { - val asJson = JsonElementSerializer.deserialize(decoder) + val asJson = JsonElement.serializer().deserialize(decoder) return when { asJson is JsonPrimitive -> SimpleKeyboardButton(asJson.content) - asJson is JsonObject && asJson.getPrimitiveOrNull(requestContactField) != null -> RequestContactKeyboardButton( - asJson.getPrimitive(textField).content + asJson is JsonObject && asJson[requestContactField] != null -> RequestContactKeyboardButton( + asJson[textField]!!.jsonPrimitive.content ) - asJson is JsonObject && asJson.getPrimitiveOrNull(requestLocationField) != null -> RequestLocationKeyboardButton( - asJson.getPrimitive(textField).content + asJson is JsonObject && asJson[requestLocationField] != null -> RequestLocationKeyboardButton( + asJson[textField]!!.jsonPrimitive.content ) - asJson is JsonObject && asJson.getObjectOrNull(requestPollField) != null -> RequestPollKeyboardButton( - asJson.getPrimitive(textField).content, - nonstrictJsonFormat.fromJson( + asJson is JsonObject && asJson[requestPollField] != null -> RequestPollKeyboardButton( + asJson[textField]!!.jsonPrimitive.content, + nonstrictJsonFormat.decodeFromJsonElement( KeyboardButtonPollType.serializer(), - asJson.getObject(requestPollField) + asJson[requestPollField] ?.jsonObject ?: buildJsonObject { } ) ) else -> UnknownKeyboardButton( when (asJson) { - is JsonObject -> asJson.getPrimitive(textField).content + is JsonObject -> asJson[textField]!!.jsonPrimitive.content is JsonArray -> "" is JsonPrimitive -> asJson.content }, @@ -81,7 +83,7 @@ internal object KeyboardButtonSerializer : KSerializer { is RequestLocationKeyboardButton -> RequestLocationKeyboardButton.serializer().serialize(encoder, value) is RequestPollKeyboardButton -> RequestPollKeyboardButton.serializer().serialize(encoder, value) is SimpleKeyboardButton -> encoder.encodeString(value.text) - is UnknownKeyboardButton -> JsonElementSerializer.serialize(encoder, nonstrictJsonFormat.parseJson(value.raw)) + is UnknownKeyboardButton -> JsonElement.serializer().serialize(encoder, nonstrictJsonFormat.parseToJsonElement(value.raw)) } } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt similarity index 84% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt index aef28823a3..218f1d4c76 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/KeyboardButtonPollType.kt @@ -2,6 +2,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.buttons import com.github.insanusmokrassar.TelegramBotAPI.types.* import kotlinx.serialization.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.* @Serializable(KeyboardButtonPollTypeSerializer::class) @@ -25,11 +27,11 @@ object QuizKeyboardButtonPollType : KeyboardButtonPollType() { @Serializer(KeyboardButtonPollType::class) internal object KeyboardButtonPollTypeSerializer : KSerializer { override fun deserialize(decoder: Decoder): KeyboardButtonPollType { - val asJson = JsonElementSerializer.deserialize(decoder) + val asJson = JsonElement.serializer().deserialize(decoder) val type = when (asJson) { is JsonPrimitive -> asJson.content - else -> asJson.jsonObject.getPrimitive(typeField).content + else -> asJson.jsonObject[typeField] ?.jsonPrimitive ?.content ?: "absent" } return when (type) { @@ -43,7 +45,7 @@ internal object KeyboardButtonPollTypeSerializer : KSerializer { - override val descriptor: SerialDescriptor = SerialDescriptor( + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor( KeyboardMarkup::class.toString(), PolymorphicKind.OPEN ) diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardMarkup.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardMarkup.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardMarkup.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardMarkup.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardRemove.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardRemove.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardRemove.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/buttons/ReplyKeyboardRemove.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChannelChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatPermissions.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatPermissions.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatPermissions.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatPermissions.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt similarity index 53% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt index 927a59966a..8630079737 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/ChatSerializers.kt @@ -8,25 +8,30 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.extended.* import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* import kotlinx.serialization.builtins.serializer -import kotlinx.serialization.json.JsonObjectSerializer +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.* -private val formatter = nonstrictJsonFormat +private val formatter + get() = nonstrictJsonFormat internal object PreviewChatSerializer : KSerializer { - override val descriptor: SerialDescriptor = SerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) override fun deserialize(decoder: Decoder): Chat { - val decodedJson = JsonObjectSerializer.deserialize(decoder) + val decodedJson = JsonObject.serializer().deserialize(decoder) - val type = decodedJson.getPrimitive(typeField).content + val type = decodedJson[typeField] ?.jsonPrimitive ?.content ?: error("Field $typeField must be presented, but absent in $decodedJson") return when (type) { - "private" -> formatter.fromJson(PrivateChatImpl.serializer(), decodedJson) - "group" -> formatter.fromJson(GroupChatImpl.serializer(), decodedJson) - "supergroup" -> formatter.fromJson(SupergroupChatImpl.serializer(), decodedJson) - "channel" -> formatter.fromJson(ChannelChatImpl.serializer(), decodedJson) + "private" -> formatter.decodeFromJsonElement(PrivateChatImpl.serializer(), decodedJson) + "group" -> formatter.decodeFromJsonElement(GroupChatImpl.serializer(), decodedJson) + "supergroup" -> formatter.decodeFromJsonElement(SupergroupChatImpl.serializer(), decodedJson) + "channel" -> formatter.decodeFromJsonElement(ChannelChatImpl.serializer(), decodedJson) else -> UnknownChatType( - formatter.fromJson(Long.serializer(), decodedJson.getPrimitive(chatIdField)).toChatId(), + formatter.decodeFromJsonElement(Long.serializer(), decodedJson[chatIdField] ?: JsonPrimitive(-1)).toChatId(), decodedJson.toString() ) } @@ -44,18 +49,19 @@ internal object PreviewChatSerializer : KSerializer { } internal object ExtendedChatSerializer : KSerializer { - override val descriptor: SerialDescriptor = SerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor("PreviewChatSerializer", PolymorphicKind.OPEN) override fun deserialize(decoder: Decoder): ExtendedChat { - val decodedJson = JsonObjectSerializer.deserialize(decoder) + val decodedJson = JsonObject.serializer().deserialize(decoder) - val type = decodedJson.getPrimitive(typeField).content + val type = decodedJson[typeField] ?.jsonPrimitive ?.content ?: error("Field $typeField must be presented, but absent in $decodedJson") return when (type) { - "private" -> formatter.fromJson(ExtendedPrivateChatImpl.serializer(), decodedJson) - "group" -> formatter.fromJson(ExtendedGroupChatImpl.serializer(), decodedJson) - "supergroup" -> formatter.fromJson(ExtendedSupergroupChatImpl.serializer(), decodedJson) - "channel" -> formatter.fromJson(ExtendedChannelChatImpl.serializer(), decodedJson) + "private" -> formatter.decodeFromJsonElement(ExtendedPrivateChatImpl.serializer(), decodedJson) + "group" -> formatter.decodeFromJsonElement(ExtendedGroupChatImpl.serializer(), decodedJson) + "supergroup" -> formatter.decodeFromJsonElement(ExtendedSupergroupChatImpl.serializer(), decodedJson) + "channel" -> formatter.decodeFromJsonElement(ExtendedChannelChatImpl.serializer(), decodedJson) else -> throw IllegalArgumentException("Unknown type of chat") } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/GroupChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/GroupChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/GroupChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/GroupChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/PrivateChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/SupergroupChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/ChannelChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/ChannelChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/ChannelChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/ChannelChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/Chat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/Chat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/Chat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/Chat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/GroupChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/GroupChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/GroupChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/GroupChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PrivateChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PrivateChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PrivateChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PrivateChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PublicChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PublicChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PublicChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/PublicChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SuperPublicChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SuperPublicChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SuperPublicChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SuperPublicChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SupergroupChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SupergroupChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SupergroupChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/SupergroupChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/UsernameChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/UsernameChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/UsernameChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/UsernameChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChannelChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChannelChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChannelChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChannelChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedGroupChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedGroupChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedGroupChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedGroupChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPrivateChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPrivateChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPrivateChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPrivateChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPublicChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPublicChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPublicChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedPublicChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedSupergroupChat.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedSupergroupChat.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedSupergroupChat.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/abstracts/extended/ExtendedSupergroupChat.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedChannelChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedChannelChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedChannelChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedChannelChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedGroupChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedGroupChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedGroupChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedGroupChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedPrivateChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedPrivateChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedPrivateChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedPrivateChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedSupergroupChatImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedSupergroupChatImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedSupergroupChatImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/chat/extended/ExtendedSupergroupChatImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/Dice.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/Dice.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/Dice.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/Dice.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt similarity index 85% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt index 0c51776d74..9524bb2d4e 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/dice/DiceAnimationType.kt @@ -1,6 +1,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.dice import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializable(DiceAnimationTypeSerializer::class) sealed class DiceAnimationType { @@ -22,12 +25,10 @@ object BasketballDiceAnimationType : DiceAnimationType() { data class CustomDiceAnimationType( override val emoji: String ) : DiceAnimationType() -@Deprecated("Renamed", ReplaceWith("CustomDiceAnimationType")) -typealias UnknownDiceAnimationType = CustomDiceAnimationType @Serializer(DiceAnimationType::class) internal object DiceAnimationTypeSerializer : KSerializer { - override val descriptor: SerialDescriptor = PrimitiveDescriptor("DiceAnimationType", PrimitiveKind.STRING) + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("DiceAnimationType", PrimitiveKind.STRING) override fun deserialize(decoder: Decoder): DiceAnimationType { return when (val type = decoder.decodeString()) { CubeDiceAnimationType.emoji -> CubeDiceAnimationType diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AnimationFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/AudioFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/DocumentFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/File.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PathedFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt similarity index 95% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt index a79862a075..58022354c2 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/PhotoSize.kt @@ -9,7 +9,7 @@ import kotlinx.serialization.builtins.ListSerializer typealias Photo = List -fun Photo.biggest(): PhotoSize? = maxBy { +fun Photo.biggest(): PhotoSize? = maxByOrNull { it.resolution } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/Sticker.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VideoNoteFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/VoiceFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/CustomNamedMediaFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/CustomNamedMediaFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/CustomNamedMediaFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/CustomNamedMediaFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/MimedMediaFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/MimedMediaFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/MimedMediaFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/MimedMediaFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/PlayableMediaFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/PlayableMediaFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/PlayableMediaFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/PlayableMediaFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/SizedMediaFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/SizedMediaFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/SizedMediaFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/SizedMediaFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TelegramMediaFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/ThumbedMediaFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/ThumbedMediaFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/ThumbedMediaFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/ThumbedMediaFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TitledMediaFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TitledMediaFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TitledMediaFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/files/abstracts/TitledMediaFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/CallbackGame.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/CallbackGame.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/CallbackGame.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/CallbackGame.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/Game.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/Game.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/Game.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/Game.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/GameHighScore.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/GameHighScore.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/GameHighScore.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/GameHighScore.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/RawGame.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/RawGame.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/RawGame.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/games/RawGame.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelEventMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelEventMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelEventMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelEventMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMediaGroupMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChannelMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/ChannelChatCreated.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/ChannelChatCreated.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/ChannelChatCreated.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/ChannelChatCreated.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/DeleteChatPhoto.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/DeleteChatPhoto.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/DeleteChatPhoto.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/DeleteChatPhoto.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/GroupChatCreated.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/GroupChatCreated.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/GroupChatCreated.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/GroupChatCreated.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/LeftChatMember.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/LeftChatMember.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/LeftChatMember.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/LeftChatMember.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatMembers.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatMembers.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatMembers.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatMembers.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatPhoto.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatPhoto.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatPhoto.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatPhoto.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatTitle.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatTitle.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatTitle.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/NewChatTitle.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/PinnedMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/PinnedMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/PinnedMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/PinnedMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/SupergroupChatCreated.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/SupergroupChatCreated.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/SupergroupChatCreated.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/SupergroupChatCreated.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChannelEvent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChannelEvent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChannelEvent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChannelEvent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChatEvent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChatEvent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChatEvent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/ChatEvent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/CommonEvent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/CommonEvent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/CommonEvent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/CommonEvent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/GroupEvent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/GroupEvent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/GroupEvent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/GroupEvent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/SupergroupEvent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/SupergroupEvent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/SupergroupEvent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ChatEvents/abstracts/SupergroupEvent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMediaGroupMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMessageImpl.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMessageImpl.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMessageImpl.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/CommonMessageImpl.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/ForwardInfo.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/GroupEventMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/GroupEventMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/GroupEventMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/GroupEventMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/RawMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/SupergroupEventMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/SupergroupEventMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/SupergroupEventMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/SupergroupEventMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ChatEventMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ChatEventMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ChatEventMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ChatEventMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/CommonMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/CommonMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/CommonMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/CommonMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ContentMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ContentMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ContentMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/ContentMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/FromUserMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/FromUserMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/FromUserMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/FromUserMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/MediaGroupMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/MediaGroupMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/MediaGroupMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/MediaGroupMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt similarity index 81% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt index cd9d2d4408..b9eb3b04e3 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/Message.kt @@ -5,6 +5,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage import com.soywiz.klock.DateTime import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder interface Message { val messageId: MessageIdentifier @@ -20,9 +23,10 @@ data class UnknownMessageType( ) : Message internal class TelegramBotAPIMessageDeserializationStrategyClass : DeserializationStrategy { - override val descriptor: SerialDescriptor = SerialDescriptor("TelegramBotAPIMessageSerializer", PolymorphicKind.OPEN) + @InternalSerializationApi + override val descriptor: SerialDescriptor = buildSerialDescriptor("TelegramBotAPIMessageSerializer", PolymorphicKind.OPEN) - override fun patch(decoder: Decoder, old: T): T = throw UpdateNotSupportedException("TelegramBotAPIMessageSerializer") + override fun patch(decoder: Decoder, old: T): T = error("TelegramBotAPIMessageSerializer") @Suppress("UNCHECKED_CAST") override fun deserialize(decoder: Decoder): T { @@ -34,6 +38,7 @@ internal object TelegramBotAPIMessageDeserializationStrategy internal class TelegramBotAPIMessageDeserializeOnlySerializerClass : KSerializer { private val deserializer = TelegramBotAPIMessageDeserializationStrategyClass() + @InternalSerializationApi override val descriptor: SerialDescriptor get() = deserializer.descriptor diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyEditedMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyEditedMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyEditedMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyEditedMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyForwardedMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyMarkedUp.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyMarkedUp.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyMarkedUp.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyMarkedUp.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyPaymentMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyPaymentMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyPaymentMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyPaymentMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyReplyMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyReplyMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyReplyMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblyReplyMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblySentViaBot.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblySentViaBot.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblySentViaBot.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/abstracts/PossiblySentViaBot.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/ContactContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/ContactContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/ContactContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/ContactContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/DiceContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/DiceContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/DiceContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/DiceContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/GameContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/GameContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/GameContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/GameContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/LocationContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/LocationContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/LocationContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/LocationContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/PollContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/PollContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/PollContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/PollContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/TextContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/VenueContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/VenueContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/VenueContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/VenueContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaCollectionContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MediaGroupContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MessageContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MessageContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MessageContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/MessageContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/PossiblySentViaBotCommonMessage.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/PossiblySentViaBotCommonMessage.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/PossiblySentViaBotCommonMessage.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/PossiblySentViaBotCommonMessage.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/abstracts/ResendableContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AnimationContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/AudioContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/DocumentContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/PhotoContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/StickerContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VideoNoteContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/content/media/VoiceContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceContent.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceContent.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceContent.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/InvoiceContent.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/SuccessfulPaymentInfo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/SuccessfulPaymentInfo.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/SuccessfulPaymentInfo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/SuccessfulPaymentInfo.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/abstracts/PaymentInfo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/abstracts/PaymentInfo.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/abstracts/PaymentInfo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/message/payments/abstracts/PaymentInfo.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Invoice.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Invoice.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Invoice.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Invoice.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/LabeledPrice.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/LabeledPrice.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/LabeledPrice.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/LabeledPrice.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/OrderInfo.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/OrderInfo.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/OrderInfo.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/OrderInfo.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/PreCheckoutQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/PreCheckoutQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/PreCheckoutQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/PreCheckoutQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingAddress.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingAddress.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingAddress.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingAddress.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingOption.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingQuery.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingQuery.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingQuery.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/ShippingQuery.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/SuccessfulPayment.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/SuccessfulPayment.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/SuccessfulPayment.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/SuccessfulPayment.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Amounted.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Amounted.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Amounted.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Amounted.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Currencied.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Currencied.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Currencied.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Currencied.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Priced.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Priced.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Priced.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/abstracts/Priced.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt similarity index 88% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt index 8b1f45bd55..318b97030d 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/Poll.kt @@ -7,8 +7,10 @@ import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import com.soywiz.klock.DateTime import com.soywiz.klock.TimeSpan import kotlinx.serialization.* -import kotlinx.serialization.json.JsonObject -import kotlinx.serialization.json.JsonObjectSerializer +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder +import kotlinx.serialization.json.* sealed class ScheduledCloseInfo { abstract val closeDateTime: DateTime @@ -101,11 +103,10 @@ data class UnknownPollType internal constructor( val raw: JsonObject ) : Poll() { @Transient - override val scheduledCloseInfo: ScheduledCloseInfo? = raw.getPrimitiveOrNull( - closeDateField - ) ?.longOrNull ?.asExactScheduledCloseInfo ?: raw.getPrimitiveOrNull( - openPeriodField - ) ?.longOrNull ?.asApproximateScheduledCloseInfo + override val scheduledCloseInfo: ScheduledCloseInfo? = (raw[closeDateField] ?: raw[openPeriodField]) + ?.jsonPrimitive + ?.longOrNull + ?.asApproximateScheduledCloseInfo } @Serializable(PollSerializer::class) @@ -135,14 +136,7 @@ data class QuizPoll( override val isClosed: Boolean = false, override val isAnonymous: Boolean = false, override val scheduledCloseInfo: ScheduledCloseInfo? = null -) : Poll(), CaptionedInput, ExplainedInput { - @Deprecated("Will be removed in near updates", ReplaceWith("explanation")) - override val caption: String? - get() = explanation - @Deprecated("Will be removed in near updates", ReplaceWith("explanationEntities")) - override val captionEntities: List - get() = explanationEntities -} +) : Poll(), ExplainedInput @Serializer(Poll::class) internal object PollSerializer : KSerializer { @@ -150,8 +144,8 @@ internal object PollSerializer : KSerializer { get() = RawPoll.serializer().descriptor override fun deserialize(decoder: Decoder): Poll { - val asJson = JsonObjectSerializer.deserialize(decoder) - val rawPoll = nonstrictJsonFormat.fromJson(RawPoll.serializer(), asJson) + val asJson = JsonObject.serializer().deserialize(decoder) + val rawPoll = nonstrictJsonFormat.decodeFromJsonElement(RawPoll.serializer(), asJson) return when (rawPoll.type) { quizPollType -> QuizPoll( @@ -218,7 +212,7 @@ internal object PollSerializer : KSerializer { closeDate = (closeInfo as? ExactScheduledCloseInfo) ?.closeDateTime ?.unixMillisLong ?.div(1000L) ) is UnknownPollType -> { - JsonObjectSerializer.serialize(encoder, value.raw) + JsonObject.serializer().serialize(encoder, value.raw) return } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollAnswer.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt similarity index 87% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt index c85eb47306..3f9119997d 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/polls/PollOption.kt @@ -3,6 +3,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.polls import com.github.insanusmokrassar.TelegramBotAPI.types.textField import com.github.insanusmokrassar.TelegramBotAPI.types.votesCountField import kotlinx.serialization.* +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder @Serializable(PollOptionSerializer::class) sealed class PollOption { diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/MaskPosition.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/MaskPosition.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/MaskPosition.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/MaskPosition.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/StickerSet.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/StickerSet.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/StickerSet.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/stickers/StickerSet.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/CallbackQueryUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/CallbackQueryUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/CallbackQueryUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/CallbackQueryUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChannelPostUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChosenInlineResultUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChosenInlineResultUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChosenInlineResultUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ChosenInlineResultUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditChannelPostUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditChannelPostUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditChannelPostUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditChannelPostUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditMessageUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditMessageUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditMessageUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/EditMessageUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/InlineQueryUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/InlineQueryUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/InlineQueryUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/InlineQueryUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/ChannelPostMediaGroupUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/ChannelPostMediaGroupUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/ChannelPostMediaGroupUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/ChannelPostMediaGroupUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditChannelPostMediaGroupUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditChannelPostMediaGroupUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditChannelPostMediaGroupUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditChannelPostMediaGroupUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditMessageMediaGroupUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditMessageMediaGroupUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditMessageMediaGroupUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/EditMessageMediaGroupUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MediaGroupUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MediaGroupUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MediaGroupUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MediaGroupUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MessageMediaGroupUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MessageMediaGroupUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MessageMediaGroupUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MediaGroupUpdates/MessageMediaGroupUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/MessageUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollAnswerUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PollUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PreCheckoutQueryUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PreCheckoutQueryUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PreCheckoutQueryUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/PreCheckoutQueryUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt similarity index 98% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt index b5e7f8f395..d6f7ada961 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/RawUpdate.kt @@ -14,6 +14,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update import com.github.insanusmokrassar.TelegramBotAPI.types.updateIdField import kotlinx.serialization.* import kotlinx.serialization.json.JsonElement +import kotlinx.serialization.json.jsonObject @Serializable internal data class RawUpdate constructor( diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ShippingQueryUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ShippingQueryUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ShippingQueryUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/ShippingQueryUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseEditMessageUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseEditMessageUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseEditMessageUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseEditMessageUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseMessageUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseMessageUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseMessageUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseMessageUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseSentMessageUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseSentMessageUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseSentMessageUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/BaseSentMessageUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt similarity index 74% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt index 24be238958..d8059c667b 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/update/abstracts/Update.kt @@ -4,8 +4,10 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.update.RawUpdate import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat import kotlinx.serialization.* +import kotlinx.serialization.descriptors.SerialDescriptor +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.json.JsonElement -import kotlinx.serialization.json.JsonElementSerializer interface Update { val updateId: UpdateIdentifier @@ -17,11 +19,9 @@ data class UnknownUpdate( override val data: String, val rawJson: JsonElement ) : Update -@Deprecated("Renamed", ReplaceWith("UnknownUpdate")) -typealias UnknownUpdateType = UnknownUpdate internal object UpdateSerializerWithoutSerialization : KSerializer { - override val descriptor: SerialDescriptor = JsonElementSerializer.descriptor + override val descriptor: SerialDescriptor = JsonElement.serializer().descriptor override fun deserialize(decoder: Decoder): Update = UpdateDeserializationStrategy.deserialize(decoder) @@ -36,17 +36,17 @@ internal object UpdateSerializerWithoutSerialization : KSerializer { * @see kotlinx.serialization.json.Json.parse */ object UpdateDeserializationStrategy : DeserializationStrategy { - override val descriptor: SerialDescriptor = JsonElementSerializer.descriptor - - override fun patch(decoder: Decoder, old: Update): Update = throw UpdateNotSupportedException("Update") + override val descriptor: SerialDescriptor = JsonElement.serializer().descriptor override fun deserialize(decoder: Decoder): Update { - val asJson = JsonElementSerializer.deserialize(decoder) - return nonstrictJsonFormat.fromJson( + val asJson = JsonElement.serializer().deserialize(decoder) + return nonstrictJsonFormat.decodeFromJsonElement( RawUpdate.serializer(), asJson ).asUpdate( asJson ) } + + override fun patch(decoder: Decoder, old: Update): Update = error("Unsupported operation") } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/venue/Venue.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/FlowsUpdatesFilter.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Annotations.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BaseMessageUpdateToMediaGroupUpdate.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BaseMessageUpdateToMediaGroupUpdate.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BaseMessageUpdateToMediaGroupUpdate.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BaseMessageUpdateToMediaGroupUpdate.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BuiltinMimeTypes.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BuiltinMimeTypes.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BuiltinMimeTypes.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/BuiltinMimeTypes.kt diff --git a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/CaptionAndTextSourcesToText.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/CaptionAndTextSourcesToText.kt new file mode 100644 index 0000000000..ca75e16968 --- /dev/null +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/CaptionAndTextSourcesToText.kt @@ -0,0 +1,109 @@ +package com.github.insanusmokrassar.TelegramBotAPI.utils + +import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.* +import com.github.insanusmokrassar.TelegramBotAPI.types.* +import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.* +import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent +import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.fullEntitiesList + +internal fun createFormattedText( + entities: FullTextSourcesList, + partLength: Int = textLength.last, + mode: ParseMode = MarkdownParseMode +): List { + val texts = mutableListOf() + val textBuilder = StringBuilder(partLength) + for (entity in entities) { + val string = when (mode) { + is MarkdownParseMode -> entity.asMarkdownSource + is MarkdownV2ParseMode -> entity.asMarkdownV2Source + is HTMLParseMode -> entity.asHtmlSource + } + if (textBuilder.length + string.length > partLength) { + if (textBuilder.isNotEmpty()) { + texts.add(textBuilder.toString()) + textBuilder.clear() + } + val chunked = string.chunked(partLength) + val last = chunked.last() + textBuilder.append(last) + val listToAdd = if (chunked.size > 1) { + chunked.subList(0, chunked.size - 1) + } else { + emptyList() + } + listToAdd.forEach { + texts.add(it) + } + } else { + textBuilder.append(string) + } + } + if (textBuilder.isNotEmpty()) { + texts.add(textBuilder.toString()) + textBuilder.clear() + } + return texts +} + + +internal fun createMarkdownText( + entities: FullTextSourcesList, + partLength: Int = textLength.last +): List = createFormattedText(entities, partLength, MarkdownParseMode) + +internal fun FullTextSourcesList.toMarkdownTexts(): List = createMarkdownText( + this, + textLength.last +) +internal fun TextContent.toMarkdownTexts(): List = fullEntitiesList().toMarkdownTexts() + +internal fun FullTextSourcesList.toMarkdownExplanations(): List = createMarkdownText( + this, + explanationLimit.last +) +internal fun ExplainedInput.toMarkdownExplanations(): List = fullEntitiesList().toMarkdownTexts() + + +internal fun createMarkdownV2Text( + entities: FullTextSourcesList, + partLength: Int = textLength.last +): List = createFormattedText(entities, partLength, MarkdownV2ParseMode) + +internal fun FullTextSourcesList.toMarkdownV2Captions(): List = createMarkdownV2Text( + this, + captionLength.last +) +internal fun CaptionedInput.toMarkdownV2Captions(): List = fullEntitiesList().toMarkdownV2Captions() + +internal fun FullTextSourcesList.toMarkdownV2Texts(): List = createMarkdownV2Text( + this, + textLength.last +) +internal fun TextContent.toMarkdownV2Texts(): List = fullEntitiesList().toMarkdownV2Texts() + +internal fun FullTextSourcesList.toMarkdownV2Explanations(): List = createMarkdownV2Text( + this, + explanationLimit.last +) +internal fun ExplainedInput.toMarkdownV2Explanations(): List = fullEntitiesList().toMarkdownV2Texts() + + +internal fun createHtmlText( + entities: FullTextSourcesList, + partLength: Int = textLength.last +): List = createFormattedText(entities, partLength, HTMLParseMode) + +internal fun FullTextSourcesList.toHtmlCaptions(): List = createHtmlText( + this, + captionLength.last +) +internal fun CaptionedInput.toHtmlCaptions(): List = fullEntitiesList().toHtmlCaptions() + +internal fun FullTextSourcesList.toHtmlTexts(): List = createHtmlText( + this, + textLength.last +) +internal fun TextContent.toHtmlTexts(): List = fullEntitiesList().toHtmlTexts() + + diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/HandleSafely.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt similarity index 66% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt index 1c26099558..01c3d0f8b5 100644 --- a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/JSON.kt @@ -3,40 +3,42 @@ package com.github.insanusmokrassar.TelegramBotAPI.utils import kotlinx.serialization.SerializationStrategy import kotlinx.serialization.json.* -@Suppress("EXPERIMENTAL_API_USAGE") internal val nonstrictJsonFormat = Json { isLenient = true ignoreUnknownKeys = true - serializeSpecialFloatingPointValues = true + allowSpecialFloatingPointValues = true useArrayPolymorphism = true } fun T.toJsonWithoutNulls(serializer: SerializationStrategy): JsonObject = toJson(serializer).withoutNulls() -fun T.toJson(serializer: SerializationStrategy): JsonObject = nonstrictJsonFormat.toJson( +fun T.toJson(serializer: SerializationStrategy): JsonObject = nonstrictJsonFormat.encodeToJsonElement( serializer, this ).jsonObject fun JsonArray.withoutNulls(): JsonArray { - return jsonArray { + return buildJsonArray { forEach { when (it) { - is JsonObject -> +it.withoutNulls() - is JsonArray -> +it.withoutNulls() - is JsonPrimitive -> +it + is JsonObject -> add(it.withoutNulls()) + is JsonArray -> add(it.withoutNulls()) + is JsonPrimitive -> add(it) } } } } fun JsonObject.withoutNulls(): JsonObject { - return json { + return buildJsonObject { forEach { (k, v) -> when (v) { - is JsonObject -> k to v.withoutNulls() - is JsonArray -> k to v.withoutNulls() - !is JsonNull -> k to v + is JsonObject -> put(k, v.withoutNulls()) + is JsonArray -> put(k, v.withoutNulls()) + !is JsonNull -> put(k, v) + JsonNull -> { + // do nothing + } } } } diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Map.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Map.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Map.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Map.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Matrix.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Matrix.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Matrix.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/Matrix.kt diff --git a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeType.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeType.kt new file mode 100644 index 0000000000..cf99d80639 --- /dev/null +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeType.kt @@ -0,0 +1,36 @@ +package com.github.insanusmokrassar.TelegramBotAPI.utils + +import kotlinx.serialization.* +import kotlinx.serialization.descriptors.* +import kotlinx.serialization.encoding.Decoder +import kotlinx.serialization.encoding.Encoder + +@Serializable(MimeTypeSerializer::class) +expect class MimeType { + val raw: String +} + +private val mimesCache = mutableMapOf() + +fun String.asMimeType() = buildMimeType(this) + +internal expect fun createMimeType(raw: String): MimeType +fun buildMimeType(raw: String): MimeType = mimesCache.getOrPut(raw) { + createMimeType(raw) +} + +@Serializer(MimeType::class) +internal object MimeTypeSerializer : KSerializer { + override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("mimeType", PrimitiveKind.STRING) + + override fun deserialize(decoder: Decoder): MimeType { + val mimeType = decoder.decodeString() + return mimesCache.getOrPut(mimeType) { + createMimeType(mimeType) + } + } + + override fun serialize(encoder: Encoder, value: MimeType) { + encoder.encodeString(value.raw) + } +} diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MultilevelTextSourceFormatting.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MultilevelTextSourceFormatting.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MultilevelTextSourceFormatting.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MultilevelTextSourceFormatting.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFileExtension.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFileExtension.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFileExtension.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFileExtension.kt diff --git a/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFormatting.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFormatting.kt new file mode 100644 index 0000000000..1431381d95 --- /dev/null +++ b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFormatting.kt @@ -0,0 +1,150 @@ +package com.github.insanusmokrassar.TelegramBotAPI.utils + +import com.github.insanusmokrassar.TelegramBotAPI.types.* +import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.* +import com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.* + +const val markdownBoldControl = "*" +const val markdownItalicControl = "_" +const val markdownCodeControl = "`" +const val markdownPreControl = "```" + +const val markdownV2ItalicUnderlineDelimiter = "\u0013" +const val markdownV2StrikethroughControl = "~" +const val markdownV2UnderlineControl = "__" +const val markdownV2UnderlineEndControl = "$markdownV2UnderlineControl$markdownV2ItalicUnderlineDelimiter" +const val markdownV2ItalicEndControl = "$markdownItalicControl$markdownV2ItalicUnderlineDelimiter" + +const val htmlBoldControl = "b" +const val htmlItalicControl = "i" +const val htmlCodeControl = "code" +const val htmlPreControl = "pre" +const val htmlUnderlineControl = "u" +const val htmlStrikethroughControl = "s" + +private fun String.markdownDefault( + openControlSymbol: String, + closeControlSymbol: String = openControlSymbol +) = "$openControlSymbol${toMarkdown()}$closeControlSymbol" +private fun String.markdownV2Default( + openControlSymbol: String, + closeControlSymbol: String = openControlSymbol, + escapeFun: String.() -> String = String::escapeMarkdownV2Common +) = "$openControlSymbol${escapeFun()}$closeControlSymbol" +private fun String.htmlDefault( + openControlSymbol: String, + closeControlSymbol: String = openControlSymbol +) = "<$openControlSymbol>${toHtml()}" + + +internal fun String.linkMarkdown(link: String): String = "[${toMarkdown()}](${link.toMarkdown()})" +internal fun String.linkMarkdownV2(link: String): String = "[${escapeMarkdownV2Common()}](${link.escapeMarkdownV2Link()})" +internal fun String.linkHTML(link: String): String = "${toHtml()}" + +internal fun String.boldMarkdown(): String = markdownDefault(markdownBoldControl) + +internal fun String.italicMarkdown(): String = markdownDefault(markdownItalicControl) + +/** + * Crutch for support of strikethrough in default markdown. Simply add modifier, but it will not look like correct + */ + +internal fun String.strikethroughMarkdown(): String = map { it + "\u0336" }.joinToString("") +internal fun String.strikethroughMarkdownV2(): String = markdownV2Default(markdownV2StrikethroughControl) + + +/** + * Crutch for support of underline in default markdown. Simply add modifier, but it will not look like correct + */ + +internal fun String.underlineMarkdown(): String = map { it + "\u0347" }.joinToString("") +internal fun String.underlineMarkdownV2(): String = markdownV2Default(markdownV2UnderlineControl, markdownV2UnderlineEndControl) +internal fun String.underlineHTML(): String = htmlDefault(htmlUnderlineControl) + +internal fun String.codeMarkdown(): String = markdownDefault(markdownCodeControl) +internal fun String.codeMarkdownV2(): String = markdownV2Default(markdownCodeControl, escapeFun = String::escapeMarkdownV2PreAndCode) +internal fun String.codeHTML(): String = htmlDefault(htmlCodeControl) + +internal fun String.preMarkdown(language: String? = null): String = markdownDefault( + "$markdownPreControl${language ?: ""}\n", + "\n$markdownPreControl" +) +internal fun String.preMarkdownV2(language: String? = null): String = markdownV2Default( + "$markdownPreControl${language ?: ""}\n", + "\n$markdownPreControl", + String::escapeMarkdownV2PreAndCode +) +internal fun String.preHTML(language: String? = null): String = htmlDefault( + language ?.let { + "$htmlPreControl><$htmlCodeControl class=\"language-$language\"" + } ?: htmlPreControl, + language ?.let { + "$htmlCodeControl> String): String = if (startsWith("@")) { + adapt() +} else { + "@${adapt()}" +} + +private inline fun String.hashTag(adapt: String.() -> String): String = if (startsWith("#")) { + adapt() +} else { + "#${adapt()}" +} + +internal fun String.textMentionMarkdown(userId: UserId): String = linkMarkdown(userId.link) +internal fun String.textMentionMarkdownV2(userId: UserId): String = linkMarkdownV2(userId.link) + +internal fun String.mentionMarkdown(): String = mention(String::toMarkdown) + +internal fun String.hashTagMarkdown(): String = hashTag(String::toMarkdown) +internal fun String.hashTagHTML(): String = hashTag(String::toHtml) + +internal fun String.phoneMarkdown(): String = toMarkdown() + +internal fun String.command(adapt: String.() -> String): String = if (startsWith("/")) { + adapt() +} else { + "/${adapt()}" +} + +internal fun String.commandMarkdown(): String = command(String::toMarkdown) +internal fun String.commandMarkdownV2(): String = command(String::escapeMarkdownV2Common) +internal fun String.commandHTML(): String = command(String::toHtml) + +internal fun String.regularMarkdown(): String = toMarkdown() +internal fun String.regularMarkdownV2(): String = escapeMarkdownV2Common() +internal fun String.regularHtml(): String = toHtml() + +internal fun String.cashTagMarkdown(): String = toMarkdown() + +internal infix fun String.code(parseMode: ParseMode): String = when (parseMode) { + is HTML -> codeHTML() + is Markdown -> codeMarkdown() + is MarkdownV2 -> codeMarkdownV2() +} + +internal infix fun Pair.link(parseMode: ParseMode): String = when (parseMode) { + is HTML -> first.linkHTML(second) + is Markdown -> first.linkMarkdown(second) + is MarkdownV2 -> first.linkMarkdownV2(second) +} + + +internal infix fun String.command(parseMode: ParseMode): String = when (parseMode) { + is HTML -> commandHTML() + is Markdown -> commandMarkdown() + is MarkdownV2 -> commandMarkdownV2() +} + + +internal infix fun String.underline(parseMode: ParseMode): String = when (parseMode) { + is HTML -> underlineHTML() + is Markdown -> underlineMarkdown() + is MarkdownV2 -> underlineMarkdownV2() +} diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/TelegramAPIUrlsKeeper.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/TelegramAPIUrlsKeeper.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/TelegramAPIUrlsKeeper.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/TelegramAPIUrlsKeeper.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/ThrowErrorWithRange.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/ThrowErrorWithRange.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/ThrowErrorWithRange.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/ThrowErrorWithRange.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/ReceiveChannel.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/ReceiveChannel.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/ReceiveChannel.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/ReceiveChannel.kt diff --git a/TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/String.kt b/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/String.kt similarity index 100% rename from TelegramBotAPI/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/String.kt rename to TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/String.kt diff --git a/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt new file mode 100644 index 0000000000..c027bfd689 --- /dev/null +++ b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/TestsJsonFormat.kt @@ -0,0 +1,5 @@ +package com.github.insanusmokrassar.TelegramBotAPI + +import kotlinx.serialization.json.Json + +val TestsJsonFormat = Json {} diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt similarity index 86% rename from TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt rename to TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt index 4c1cf4d8f3..94b7b2994b 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt +++ b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/BotActionTests.kt @@ -2,12 +2,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.github.insanusmokrassar.TelegramBotAPI.types.actions.* -import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable import kotlin.test.Test import kotlin.test.assertEquals -@ImplicitReflectionSerializer class BotActionTests { @Serializable data class Example( @@ -33,10 +31,10 @@ class BotActionTests { } private fun checkBotActionSerializeDeserialize(example: Example) { - val stringified = TestsJsonFormat.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.encodeToString(Example.serializer(), example) assertEquals("{\"botAction\":\"${example.botAction.actionName}\"}", stringified) - val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.decodeFromString(Example.serializer(), stringified) assertEquals(example, deserialized) @@ -44,7 +42,7 @@ class BotActionTests { } @Test - fun `BotAction correctly serialized and deserialized`() { + fun `BotAction_correctly_serialized_and_deserialized`() { fun BotAction.example() = Example(this) listOf( TypingAction.example(), diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt similarity index 65% rename from TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt rename to TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt index 02005ee51c..07eddca7dd 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt +++ b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ChatIdentifierTests.kt @@ -1,43 +1,38 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat -import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable import kotlin.test.* -@ImplicitReflectionSerializer private const val chatIdentifierChatId: Identifier = 123L -@ImplicitReflectionSerializer private const val chatIdentifierLink = "tg://user?id=$chatIdentifierChatId" -@ImplicitReflectionSerializer private const val testUsername = "@Example" -@ImplicitReflectionSerializer class ChatIdentifierTests { @Test - fun `Cast from Int to ChatId is working correctly`() { + fun `Cast_from_Int_to_ChatId_is_working_correctly`() { val chatId = chatIdentifierChatId.toInt().toChatId() assertEquals(chatIdentifierChatId, chatId.chatId) } @Test - fun `Cast from Byte to ChatId is working correctly`() { + fun `Cast_from_Byte_to_ChatId_is_working_correctly`() { val chatId = chatIdentifierChatId.toByte().toChatId() assertEquals(chatIdentifierChatId, chatId.chatId) } @Test - fun `Cast from Identifier to ChatId is working correctly`() { + fun `Cast_from_Identifier_to_ChatId_is_working_correctly`() { val chatId = chatIdentifierChatId.toChatId() assertEquals(chatIdentifierChatId, chatId.chatId) } @Test - fun `Creating link from ChatId is correct`() { + fun `Creating_link_from_ChatId_is_correct`() { val chatId = chatIdentifierChatId.toChatId() assertEquals(chatIdentifierLink, chatId.link) } @Test - fun `Cast from String to Username is working correctly`() { + fun `Cast_from_String_to_Username_is_working_correctly`() { assertEquals(testUsername, testUsername.toUsername().username) assertFails("Username creating must fail when trying to create from string which is not starting from @ symbol") { @@ -47,32 +42,32 @@ class ChatIdentifierTests { @Test - fun `Deserializing from String must work correctly`() { + fun `Deserializing_from_String_must_work_correctly`() { @Serializable data class Example( val identifier: ChatIdentifier ) Example(chatIdentifierChatId.toChatId()).let { withChatId -> - val stringified = TestsJsonFormat.stringify(Example.serializer(), withChatId) + val stringified = TestsJsonFormat.encodeToString(Example.serializer(), withChatId) assertEquals(stringified, "{\"identifier\":$chatIdentifierChatId}") - val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.decodeFromString(Example.serializer(), stringified) assertEquals(withChatId, deserialized) } Example(testUsername.toUsername()).let { withUsername -> - val stringified = TestsJsonFormat.stringify(Example.serializer(), withUsername) + val stringified = TestsJsonFormat.encodeToString(Example.serializer(), withUsername) assertEquals(stringified, "{\"identifier\":\"$testUsername\"}") - val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.decodeFromString(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } // Replace @ by empty string, because from time to time we can retrieve from Telegram system // username without starting @ symbol Example(testUsername.toUsername()).let { withUsername -> - val stringified = TestsJsonFormat.stringify(Example.serializer(), withUsername).replace("@", "") + val stringified = TestsJsonFormat.encodeToString(Example.serializer(), withUsername).replace("@", "") assertEquals("{\"identifier\":\"${testUsername.replace("@", "")}\"}", stringified) - val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.decodeFromString(Example.serializer(), stringified) assertEquals(withUsername, deserialized) } } diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt similarity index 100% rename from TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt rename to TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/MessageEntity/TextPartsCreatingTests.kt diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt similarity index 56% rename from TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt rename to TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt index 6bacbc57e8..8ba0cc4542 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt +++ b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/ParseModeTests.kt @@ -2,12 +2,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.* -import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable import kotlin.test.Test import kotlin.test.assertEquals -@ImplicitReflectionSerializer class ParseModeTests { @Serializable data class Example( @@ -15,24 +13,24 @@ class ParseModeTests { ) @Test - fun `Markdown parse mode correctly serializing and deserializing`() { + fun `Markdown_parse_mode_correctly_serializing_and_deserializing`() { val example = Example(Markdown) - val stringified = TestsJsonFormat.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.encodeToString(Example.serializer(), example) assertEquals("{\"mode\":\"Markdown\"}", stringified) - val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.decodeFromString(Example.serializer(), stringified) assertEquals(example, deserialized) } @Test - fun `HTML parse mode correctly serializing and deserializing`() { + fun `HTML_parse_mode_correctly_serializing_and_deserializing`() { val example = Example(HTML) - val stringified = TestsJsonFormat.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.encodeToString(Example.serializer(), example) assertEquals("{\"mode\":\"HTML\"}", stringified) - val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.decodeFromString(Example.serializer(), stringified) assertEquals(example, deserialized) } } diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt similarity index 70% rename from TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt rename to TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt index faf94bf560..028f56b1cb 100644 --- a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt +++ b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/TelegramDateTests.kt @@ -2,7 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.types import com.github.insanusmokrassar.TelegramBotAPI.TestsJsonFormat import com.soywiz.klock.DateTime -import kotlinx.serialization.ImplicitReflectionSerializer import kotlinx.serialization.Serializable import kotlin.test.Test import kotlin.test.assertEquals @@ -11,20 +10,19 @@ private val dateTimeUnix = DateTime.nowUnixLong() private val dateTimeMillis = dateTimeUnix * 1000 private val dateTime = DateTime(dateTimeMillis) -@ImplicitReflectionSerializer class TelegramDateTests { @Serializable data class Example( val dateTime: TelegramDate ) @Test - fun `Serializtion of TelegramDate is working correctly`() { + fun `Serializtion_of_TelegramDate_is_working_correctly`() { val example = Example(TelegramDate(dateTimeUnix)) - val stringified = TestsJsonFormat.stringify(Example.serializer(), example) + val stringified = TestsJsonFormat.encodeToString(Example.serializer(), example) assertEquals("{\"dateTime\":$dateTimeUnix}", stringified) - val deserialized = TestsJsonFormat.parse(Example.serializer(), stringified) + val deserialized = TestsJsonFormat.decodeFromString(Example.serializer(), stringified) assertEquals(example, deserialized) assertEquals(dateTime, deserialized.dateTime.asDate) diff --git a/TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFormattingTests.kt b/TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFormattingTests.kt similarity index 100% rename from TelegramBotAPI/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFormattingTests.kt rename to TelegramBotAPI-core/src/commonTest/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StringFormattingTests.kt diff --git a/TelegramBotAPI-core/src/jsMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeTypeActual.kt b/TelegramBotAPI-core/src/jsMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeTypeActual.kt new file mode 100644 index 0000000000..ec54773fda --- /dev/null +++ b/TelegramBotAPI-core/src/jsMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeTypeActual.kt @@ -0,0 +1,17 @@ +package com.github.insanusmokrassar.TelegramBotAPI.utils + +import kotlinx.serialization.* +import org.w3c.dom.get +import kotlinx.browser.window + +@Serializable(MimeTypeSerializer::class) +actual class MimeType( + actual val raw: String +) { + @Transient + val jsMimeType = window.navigator.mimeTypes[raw] + + override fun toString(): String = raw +} + +actual fun createMimeType(raw: String) = MimeType(raw) diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt similarity index 100% rename from TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt rename to TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/abstracts/InputFileFromJavaFile.kt diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserLocale.kt b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserLocale.kt similarity index 100% rename from TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserLocale.kt rename to TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/UserLocale.kt diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Currencied.kt b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Currencied.kt similarity index 100% rename from TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Currencied.kt rename to TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/payments/Currencied.kt diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/webhook/WebhookPrivateKeyConfig.kt b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/webhook/WebhookPrivateKeyConfig.kt similarity index 100% rename from TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/webhook/WebhookPrivateKeyConfig.kt rename to TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/webhook/WebhookPrivateKeyConfig.kt diff --git a/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeTypeActual.kt b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeTypeActual.kt new file mode 100644 index 0000000000..f96206db52 --- /dev/null +++ b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/MimeTypeActual.kt @@ -0,0 +1,10 @@ +package com.github.insanusmokrassar.TelegramBotAPI.utils + +import kotlinx.serialization.* + +@Serializable(MimeTypeSerializer::class) +actual class MimeType( + actual val raw: String +) : javax.activation.MimeType(raw) + +actual fun createMimeType(raw: String): MimeType = MimeType(raw) diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt similarity index 100% rename from TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt rename to TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/StorageFile.kt diff --git a/TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/AsReference.kt b/TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/AsReference.kt similarity index 100% rename from TelegramBotAPI/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/AsReference.kt rename to TelegramBotAPI-core/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/utils/extensions/AsReference.kt diff --git a/TelegramBotAPI-extensions-api/README.md b/TelegramBotAPI-extensions-api/README.md index d49094f4d5..fbc2e5f0e3 100644 --- a/TelegramBotAPI-extensions-api/README.md +++ b/TelegramBotAPI-extensions-api/README.md @@ -5,13 +5,13 @@ ## What is it? -It is wrapper library for [TelegramBotAPI](../TelegramBotAPI/README.md). Here you can find extensions for +It is wrapper library for [TelegramBotAPI-core](../TelegramBotAPI-core/README.md). Here you can find extensions for `RequestsExecutor`, which are more look like Telegram Bot API requests and in the same time have more obvious signatures to help understand some restrictions in Telegram system. ## Compatibility -This library always compatible with original `TelegramBotAPI` library version +This library always compatible with original `TelegramBotAPI-core` library version ## How to implement library? @@ -71,8 +71,8 @@ val bot = telegramBot("IT IS YOUR TOKEN") { In all examples supposed that you have created bot. -| TelegramBotAPI | TelegramBotAPI-extensions-api | -|----------------|-------------------------------| +| TelegramBotAPI-core | TelegramBotAPI-extensions-api | +|---------------------|-------------------------------| | bot.execute(GetMe) | bot.getMe() | | bot.execute(SendTextMessage(someChatId, text)) | bot.sendTextMessage(chat, text) | diff --git a/TelegramBotAPI-extensions-api/build.gradle b/TelegramBotAPI-extensions-api/build.gradle index 217310d289..c6b432b627 100644 --- a/TelegramBotAPI-extensions-api/build.gradle +++ b/TelegramBotAPI-extensions-api/build.gradle @@ -13,8 +13,8 @@ buildscript { } plugins { - id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" - id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" + id "org.jetbrains.kotlin.multiplatform" + id "org.jetbrains.kotlin.plugin.serialization" } project.version = "$library_version" @@ -31,16 +31,19 @@ repositories { kotlin { jvm() - js() + js(BOTH) { + browser() + nodejs() + } sourceSets { commonMain { dependencies { implementation kotlin('stdlib') if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") { - api "${project.group}:TelegramBotAPI:$library_version" + api "${project.group}:TelegramBotAPI-core:$library_version" } else { - api project(":TelegramBotAPI") + api project(":TelegramBotAPI-core") } } } diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/BotBuilder.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/BotBuilder.kt index c6af136a44..adc0c53648 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/BotBuilder.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/BotBuilder.kt @@ -13,9 +13,7 @@ import io.ktor.client.engine.* */ data class BotBuilder internal constructor( var proxy: ProxyConfig? = null, - @Deprecated("ktorClientEngineFactory parameter will be used preferable. In future this parameter will be removed") - var ktorClientEngine: HttpClientEngine? = null, - var ktorClientEngineFactory: HttpClientEngineFactory? = null, + var ktorClientEngineFactory: HttpClientEngineFactory? = null, var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null ) { internal fun createHttpClient(): HttpClient = ktorClientEngineFactory ?.let { @@ -26,13 +24,6 @@ data class BotBuilder internal constructor( ) { ktorClientConfig ?.let { it() } } - } ?: ktorClientEngine ?.let { engine -> - HttpClient(engine) { - ktorClientConfig ?.let { it() } - engine { - this@engine.proxy = this@BotBuilder.proxy ?: this@engine.proxy - } - } } ?: HttpClient { ktorClientConfig ?.let { it() } engine { diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/GetMe.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/GetMe.kt deleted file mode 100644 index 889d07a6b0..0000000000 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/GetMe.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.extensions.api - -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.getMe - -@Deprecated( - "Replaced", - ReplaceWith("getMe", "com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.GetMeKt.getMe") -) -suspend fun RequestsExecutor.getMe() = getMe() \ No newline at end of file diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/InternalUtils/UpdatesUtils.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/InternalUtils/UpdatesUtils.kt index a48d6695ee..9dbb93e3c2 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/InternalUtils/UpdatesUtils.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/InternalUtils/UpdatesUtils.kt @@ -16,7 +16,7 @@ internal fun Update.lastUpdateIdentifier(): UpdateIdentifier { } internal fun List.lastUpdateIdentifier(): UpdateIdentifier? { - return maxBy { it.updateId } ?.lastUpdateIdentifier() + return maxByOrNull { it.updateId } ?.lastUpdateIdentifier() } internal fun List.convertWithMediaGroupUpdates(): List { diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/JsonUtils.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/JsonUtils.kt index a88439d920..0a4153f2c1 100644 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/JsonUtils.kt +++ b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/JsonUtils.kt @@ -6,6 +6,6 @@ import kotlinx.serialization.json.Json internal val nonstrictJsonFormat = Json { isLenient = true ignoreUnknownKeys = true - serializeSpecialFloatingPointValues = true + allowSpecialFloatingPointValues = true useArrayPolymorphism = true } diff --git a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt b/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt deleted file mode 100644 index a27034cf96..0000000000 --- a/TelegramBotAPI-extensions-api/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/api/updates/UpdatesPolling.kt +++ /dev/null @@ -1,182 +0,0 @@ -package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.updates - -import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor -import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.RequestException -import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.convertWithMediaGroupUpdates -import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.lastUpdateIdentifier -import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.getUpdates -import com.github.insanusmokrassar.TelegramBotAPI.types.* -import com.github.insanusmokrassar.TelegramBotAPI.types.update.* -import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.* -import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update -import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.* -import com.github.insanusmokrassar.TelegramBotAPI.utils.* -import kotlinx.coroutines.* - -@Deprecated("Replaced and renamed in TelegramBotAPI-extensions-utils") -fun RequestsExecutor.startGettingOfUpdates( - timeoutSeconds: Seconds = 30, - scope: CoroutineScope = CoroutineScope(Dispatchers.Default), - exceptionsHandler: (ExceptionHandler)? = null, - allowedUpdates: List? = null, - updatesReceiver: UpdateReceiver -): Job = scope.launch { - var lastUpdateIdentifier: UpdateIdentifier? = null - - while (isActive) { - handleSafely( - { e -> - exceptionsHandler ?.invoke(e) - if (e is RequestException) { - delay(1000L) - } - } - ) { - val updates = getUpdates( - offset = lastUpdateIdentifier?.plus(1), - timeout = timeoutSeconds, - allowed_updates = allowedUpdates - ).let { originalUpdates -> - val converted = originalUpdates.convertWithMediaGroupUpdates() - /** - * Dirty hack for cases when the media group was retrieved not fully: - * - * We are throw out the last media group and will reretrieve it again in the next get updates - * and it will guarantee that it is full - */ - if (originalUpdates.size == getUpdatesLimit.last && converted.last() is SentMediaGroupUpdate) { - converted - converted.last() - } else { - converted - } - } - - handleSafely { - for (update in updates) { - updatesReceiver(update) - - lastUpdateIdentifier = update.lastUpdateIdentifier() - } - } - } - } -} - -/** - * This method will create a new one [FlowsUpdatesFilter]. This method could be unsafe due to the fact that it will start - * getting updates IMMEDIATELY. That means that your bot will be able to skip some of them until you will call - * [kotlinx.coroutines.flow.Flow.collect] on one of [FlowsUpdatesFilter] flows. To avoid it, you can pass - * [flowUpdatesPreset] lambda - it will be called BEFORE starting updates getting - */ -@FlowPreview -@PreviewFeature -@Suppress("unused") -@Deprecated("Replaced and renamed in TelegramBotAPI-extensions-utils") -fun RequestsExecutor.startGettingFlowsUpdates( - timeoutSeconds: Seconds = 30, - scope: CoroutineScope = CoroutineScope(Dispatchers.Default), - exceptionsHandler: (suspend (Exception) -> Unit)? = null, - flowsUpdatesFilterUpdatesKeeperCount: Int = 100, - flowUpdatesPreset: FlowsUpdatesFilter.() -> Unit = {} -): FlowsUpdatesFilter = FlowsUpdatesFilter(flowsUpdatesFilterUpdatesKeeperCount).apply { - flowUpdatesPreset() - startGettingOfUpdates(timeoutSeconds, scope, exceptionsHandler, allowedUpdates, asUpdateReceiver) -} - -@Deprecated("Replaced and renamed in TelegramBotAPI-extensions-utils") -fun RequestsExecutor.startGettingOfUpdates( - updatesFilter: UpdatesFilter, - timeoutSeconds: Seconds = 30, - exceptionsHandler: (suspend (Exception) -> Unit)? = null, - scope: CoroutineScope = CoroutineScope(Dispatchers.Default) -): Job = startGettingOfUpdates( - timeoutSeconds, - scope, - exceptionsHandler, - updatesFilter.allowedUpdates, - updatesFilter.asUpdateReceiver -) - -@Deprecated("Replaced and renamed in TelegramBotAPI-extensions-utils") -fun RequestsExecutor.startGettingOfUpdates( - messageCallback: UpdateReceiver? = null, - messageMediaGroupCallback: UpdateReceiver? = null, - editedMessageCallback: UpdateReceiver? = null, - editedMessageMediaGroupCallback: UpdateReceiver? = null, - channelPostCallback: UpdateReceiver? = null, - channelPostMediaGroupCallback: UpdateReceiver? = null, - editedChannelPostCallback: UpdateReceiver? = null, - editedChannelPostMediaGroupCallback: UpdateReceiver? = null, - chosenInlineResultCallback: UpdateReceiver? = null, - inlineQueryCallback: UpdateReceiver? = null, - callbackQueryCallback: UpdateReceiver? = null, - shippingQueryCallback: UpdateReceiver? = null, - preCheckoutQueryCallback: UpdateReceiver? = null, - pollCallback: UpdateReceiver? = null, - pollAnswerCallback: UpdateReceiver? = null, - timeoutSeconds: Seconds = 30, - exceptionsHandler: (suspend (Exception) -> Unit)? = null, - scope: CoroutineScope = GlobalScope -): Job { - return startGettingOfUpdates( - SimpleUpdatesFilter( - messageCallback, - messageMediaGroupCallback, - editedMessageCallback, - editedMessageMediaGroupCallback, - channelPostCallback, - channelPostMediaGroupCallback, - editedChannelPostCallback, - editedChannelPostMediaGroupCallback, - chosenInlineResultCallback, - inlineQueryCallback, - callbackQueryCallback, - shippingQueryCallback, - preCheckoutQueryCallback, - pollCallback, - pollAnswerCallback - ), - timeoutSeconds, - exceptionsHandler, - scope - ) -} - -@Suppress("unused") -@Deprecated("Replaced and renamed in TelegramBotAPI-extensions-utils") -fun RequestsExecutor.startGettingOfUpdates( - messageCallback: UpdateReceiver? = null, - mediaGroupCallback: UpdateReceiver? = null, - editedMessageCallback: UpdateReceiver? = null, - channelPostCallback: UpdateReceiver? = null, - editedChannelPostCallback: UpdateReceiver? = null, - chosenInlineResultCallback: UpdateReceiver? = null, - inlineQueryCallback: UpdateReceiver? = null, - callbackQueryCallback: UpdateReceiver? = null, - shippingQueryCallback: UpdateReceiver? = null, - preCheckoutQueryCallback: UpdateReceiver? = null, - pollCallback: UpdateReceiver? = null, - pollAnswerCallback: UpdateReceiver? = null, - timeoutSeconds: Seconds = 30, - exceptionsHandler: (suspend (Exception) -> Unit)? = null, - scope: CoroutineScope = CoroutineScope(Dispatchers.Default) -): Job = startGettingOfUpdates( - messageCallback = messageCallback, - messageMediaGroupCallback = mediaGroupCallback, - editedMessageCallback = editedMessageCallback, - editedMessageMediaGroupCallback = mediaGroupCallback, - channelPostCallback = channelPostCallback, - channelPostMediaGroupCallback = mediaGroupCallback, - editedChannelPostCallback = editedChannelPostCallback, - editedChannelPostMediaGroupCallback = mediaGroupCallback, - chosenInlineResultCallback = chosenInlineResultCallback, - inlineQueryCallback = inlineQueryCallback, - callbackQueryCallback = callbackQueryCallback, - shippingQueryCallback = shippingQueryCallback, - preCheckoutQueryCallback = preCheckoutQueryCallback, - pollCallback = pollCallback, - pollAnswerCallback = pollAnswerCallback, - timeoutSeconds = timeoutSeconds, - exceptionsHandler = exceptionsHandler, - scope = scope -) diff --git a/TelegramBotAPI-extensions-utils/README.md b/TelegramBotAPI-extensions-utils/README.md index 6db9f5228c..a818642356 100644 --- a/TelegramBotAPI-extensions-utils/README.md +++ b/TelegramBotAPI-extensions-utils/README.md @@ -1,5 +1,6 @@ # TelegramBotAPI Util Extensions + - [TelegramBotAPI Util Extensions](#telegrambotapi-util-extensions) * [What is it?](#what-is-it) * [How to implement library?](#how-to-implement-library) @@ -23,7 +24,7 @@ ## What is it? -It is wrapper library for [TelegramBotAPI](../TelegramBotAPI/README.md). Currently, this library contains some usefull filters for commands, updates types and different others. +It is wrapper library for [TelegramBotAPI-core](../TelegramBotAPI-core/README.md). Currently, this library contains some usefull filters for commands, updates types and different others. ## How to implement library? @@ -93,7 +94,7 @@ updates retrieving: * Webhooks * Long Polling -Both of them you could use in your project using [TelegramBotAPI](../TelegramBotAPI/README.md), but here there are +Both of them you could use in your project using [TelegramBotAPI-core](../TelegramBotAPI-core/README.md), but here there are several useful extensions for both of them. Anyway, in both of ways it will be useful to know that it is possible to create `UpdateReceiver` object using function diff --git a/TelegramBotAPI-extensions-utils/build.gradle b/TelegramBotAPI-extensions-utils/build.gradle index 217310d289..c6b432b627 100644 --- a/TelegramBotAPI-extensions-utils/build.gradle +++ b/TelegramBotAPI-extensions-utils/build.gradle @@ -13,8 +13,8 @@ buildscript { } plugins { - id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" - id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" + id "org.jetbrains.kotlin.multiplatform" + id "org.jetbrains.kotlin.plugin.serialization" } project.version = "$library_version" @@ -31,16 +31,19 @@ repositories { kotlin { jvm() - js() + js(BOTH) { + browser() + nodejs() + } sourceSets { commonMain { dependencies { implementation kotlin('stdlib') if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") { - api "${project.group}:TelegramBotAPI:$library_version" + api "${project.group}:TelegramBotAPI-core:$library_version" } else { - api project(":TelegramBotAPI") + api project(":TelegramBotAPI-core") } } } diff --git a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/JsonFormat.kt b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/JsonFormat.kt index 63977802c2..86b3f21720 100644 --- a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/JsonFormat.kt +++ b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/JsonFormat.kt @@ -6,6 +6,6 @@ import kotlinx.serialization.json.Json internal val nonstrictJsonFormat = Json { isLenient = true ignoreUnknownKeys = true - serializeSpecialFloatingPointValues = true + allowSpecialFloatingPointValues = true useArrayPolymorphism = true } diff --git a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/formatting/LinksFormatting.kt b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/formatting/LinksFormatting.kt index 3959d7a9b2..8e72db2b47 100644 --- a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/formatting/LinksFormatting.kt +++ b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/formatting/LinksFormatting.kt @@ -5,7 +5,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.* import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PrivateChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.UsernameChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat -import com.github.insanusmokrassar.TelegramBotAPI.utils.link private const val internalLinkBeginning = "https://t.me" diff --git a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/shortcuts/FlowsUpdatesFilter.kt b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/shortcuts/FlowsUpdatesFilter.kt index ff7a3705f1..5896b59a2e 100644 --- a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/shortcuts/FlowsUpdatesFilter.kt +++ b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/shortcuts/FlowsUpdatesFilter.kt @@ -18,6 +18,7 @@ import kotlinx.coroutines.flow.* inline fun filterForContentMessage(): suspend (ContentMessage<*>) -> ContentMessage? = { if (it.content is T) { + @Suppress("UNCHECKED_CAST") it as ContentMessage } else { null @@ -32,6 +33,7 @@ inline fun Flow.filterMedi ): Flow>> = map { it.data.mapNotNull { message -> if (message.content is T) { + @Suppress("UNCHECKED_CAST") message as CommonMessage } else { null @@ -83,7 +85,10 @@ fun FlowsUpdatesFilter.sentMessagesWithMediaGroups( ): Flow> = merge( sentMessages(scopeToIncludeChannels), mediaGroupMessages(scopeToIncludeChannels).flatMap { - it.mapNotNull { it as? ContentMessage } + it.mapNotNull { + @Suppress("UNCHECKED_CAST") + it as? ContentMessage + } } ) diff --git a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdateDeserialization.kt b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdateDeserialization.kt index 017a61400d..b8c889e624 100644 --- a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdateDeserialization.kt +++ b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdateDeserialization.kt @@ -8,11 +8,11 @@ import kotlinx.serialization.json.JsonElement /** * @return Deserialize [source] as [com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update] */ -fun Json.toTelegramUpdate(source: String) = parse(UpdateDeserializationStrategy, source) +fun Json.toTelegramUpdate(source: String) = decodeFromString(UpdateDeserializationStrategy, source) /** * @return Deserialize [source] as [com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update] */ -fun Json.toTelegramUpdate(source: JsonElement) = fromJson(UpdateDeserializationStrategy, source) +fun Json.toTelegramUpdate(source: JsonElement) = decodeFromJsonElement(UpdateDeserializationStrategy, source) /** * @return Deserialize [this] as [com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update]. In fact, diff --git a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt index 1812a94ec1..247e63d2e3 100644 --- a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt +++ b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesChatFilters.kt @@ -15,16 +15,6 @@ fun Flow.filterBaseMessageUpdatesByChatId(chatId: Cha * [Flow.filter] incoming [BaseMessageUpdate]s by their [ChatId] using [Chat.id] of [chat] */ fun Flow.filterBaseMessageUpdatesByChat(chat: Chat): Flow = filterBaseMessageUpdatesByChatId(chat.id) -/** - * [Flow.filter] incoming [BaseMessageUpdate]s by their [ChatId] - */ -@Deprecated("Renamed", ReplaceWith("filterBaseMessageUpdatesByChatId")) -fun Flow.filterBaseMessageUpdates(chatId: ChatId): Flow = filterBaseMessageUpdatesByChatId(chatId) -/** - * [Flow.filter] incoming [BaseMessageUpdate]s by their [ChatId] using [Chat.id] of [chat] - */ -@Deprecated("Renamed", ReplaceWith("filterBaseMessageUpdatesByChat")) -fun Flow.filterBaseMessageUpdates(chat: Chat): Flow = filterBaseMessageUpdatesByChatId(chat.id) /** @@ -35,13 +25,3 @@ fun Flow.filterSentMediaGroupUpdatesByChatId(chatI * [Flow.filter] incoming [SentMediaGroupUpdate]s by their [ChatId] using [Chat.id] of [chat] */ fun Flow.filterSentMediaGroupUpdatesByChat(chat: Chat): Flow = filterSentMediaGroupUpdatesByChatId(chat.id) -/** - * [Flow.filter] incoming [SentMediaGroupUpdate]s by their [ChatId] - */ -@Deprecated("Renamed", ReplaceWith("filterSentMediaGroupUpdatesByChatId")) -fun Flow.filterSentMediaGroupUpdates(chatId: ChatId): Flow = filterSentMediaGroupUpdatesByChatId(chatId) -/** - * [Flow.filter] incoming [SentMediaGroupUpdate]s by their [ChatId] using [Chat.id] of [chat] - */ -@Deprecated("Renamed", ReplaceWith("filterSentMediaGroupUpdatesByChat")) -fun Flow.filterSentMediaGroupUpdates(chat: Chat): Flow = filterSentMediaGroupUpdatesByChatId(chat.id) diff --git a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesUtils.kt b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesUtils.kt index 6aa7bc6ba9..b72f398530 100644 --- a/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesUtils.kt +++ b/TelegramBotAPI-extensions-utils/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/UpdatesUtils.kt @@ -24,7 +24,7 @@ fun Update.lastUpdateIdentifier(): UpdateIdentifier { * @see [Update.lastUpdateIdentifier] */ fun List.lastUpdateIdentifier(): UpdateIdentifier? { - return maxBy { it.updateId } ?.lastUpdateIdentifier() + return maxByOrNull { it.updateId } ?.lastUpdateIdentifier() } /** diff --git a/TelegramBotAPI-extensions-utils/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/retrieving/Webhook.kt b/TelegramBotAPI-extensions-utils/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/retrieving/Webhook.kt index 45343c69f3..6aaa5cb381 100644 --- a/TelegramBotAPI-extensions-utils/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/retrieving/Webhook.kt +++ b/TelegramBotAPI-extensions-utils/src/jvmMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/extensions/utils/updates/retrieving/Webhook.kt @@ -45,8 +45,8 @@ fun Route.includeWebhookHandlingInRoute( exceptionsHandler ?: {} ) { val asJson = - nonstrictJsonFormat.parseJson(call.receiveText()) - val update = nonstrictJsonFormat.fromJson( + nonstrictJsonFormat.parseToJsonElement(call.receiveText()) + val update = nonstrictJsonFormat.decodeFromJsonElement( UpdateDeserializationStrategy, asJson ) diff --git a/TelegramBotAPI.minder b/TelegramBotAPI.minder index 5e81644451..464b9c0203 100644 --- a/TelegramBotAPI.minder +++ b/TelegramBotAPI.minder @@ -1,5 +1,5 @@ - +