diff --git a/CHANGELOG.md b/CHANGELOG.md index f4fc57e948..42df2a81ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # TelegramBotAPI changelog +## 0.38.9 + +* `Core`: + * New function `MessageContent.Companion#serializationModule` + * Now it is possible to create `TelegramBot` (`RequestsExecutor`) with several bots under the hood and opportunity + for bots requests load balancing or fault-fix via sending of the requests via another bot +* `API`: + * Add replies which will use another message as a source for reply (`copyMessage`) + ## 0.38.8 * `Common`: diff --git a/gradle.properties b/gradle.properties index 1eb82a8614..5e9a295f20 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,6 +20,6 @@ javax_activation_version=1.1.1 dokka_version=1.6.10 library_group=dev.inmo -library_version=0.38.8 +library_version=0.38.9 github_release_plugin_version=2.2.12 diff --git a/tgbotapi/publish.gradle b/publish.gradle similarity index 95% rename from tgbotapi/publish.gradle rename to publish.gradle index 4adb64e4e7..c16b067b1f 100644 --- a/tgbotapi/publish.gradle +++ b/publish.gradle @@ -9,8 +9,8 @@ publishing { artifact javadocsJar pom { - description = "This project just include all subproject of TelegramBotAPI" - name = "Telegram Bot API" + description = "${project.description}" + name = "${project.name}" url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI" scm { diff --git a/publish.kpsb b/publish.kpsb new file mode 100644 index 0000000000..83bf30f34a --- /dev/null +++ b/publish.kpsb @@ -0,0 +1 @@ +{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file diff --git a/tgbotapi.api/build.gradle b/tgbotapi.api/build.gradle index 32ab4c3861..f6d1e00bcf 100644 --- a/tgbotapi.api/build.gradle +++ b/tgbotapi.api/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "API extensions with \"Telegram Bot API\"-like extensions for TelegramBot and RequestsExecutor" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.api/publish.gradle b/tgbotapi.api/publish.gradle deleted file mode 100644 index 7d5c9b3c64..0000000000 --- a/tgbotapi.api/publish.gradle +++ /dev/null @@ -1,79 +0,0 @@ -apply plugin: 'maven-publish' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference" - name = "Telegram Bot API Extensions for API" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -if (project.hasProperty("signing.gnupg.keyName")) { - apply plugin: 'signing' - - signing { - useGpgCmd() - - sign publishing.publications - } - - task signAll { - tasks.withType(Sign).forEach { - dependsOn(it) - } - } -} diff --git a/tgbotapi.api/publish.kpsb b/tgbotapi.api/publish.kpsb deleted file mode 100644 index 0327fe799d..0000000000 --- a/tgbotapi.api/publish.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-api","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt index f3134891dc..1779e7c648 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt @@ -14,6 +14,7 @@ import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList import dev.inmo.tgbotapi.types.ParseMode.ParseMode import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup +import dev.inmo.tgbotapi.types.chat.abstracts.Chat import dev.inmo.tgbotapi.types.dice.DiceAnimationType import dev.inmo.tgbotapi.types.files.* import dev.inmo.tgbotapi.types.files.sticker.Sticker @@ -864,3 +865,38 @@ suspend inline fun TelegramBot.reply( allowSendingWithoutReply: Boolean? = null, replyMarkup: KeyboardMarkup? = null ) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.reply( + to: Message, + fromChatId: ChatIdentifier, + messageId: MessageIdentifier, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = copyMessage(fromChatId, to.chat.id, messageId, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.reply( + to: Message, + fromChat: Chat, + messageId: MessageIdentifier, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = reply(to, fromChat.id, messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) + +suspend inline fun TelegramBot.reply( + to: Message, + copy: Message, + text: String? = null, + parseMode: ParseMode? = null, + disableNotification: Boolean = false, + protectContent: Boolean = false, + allowSendingWithoutReply: Boolean? = null, + replyMarkup: KeyboardMarkup? = null +) = reply(to, copy.chat.id, copy.messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup) diff --git a/tgbotapi.behaviour_builder.fsm/build.gradle b/tgbotapi.behaviour_builder.fsm/build.gradle index f2c13d81aa..1a2d2cc76d 100644 --- a/tgbotapi.behaviour_builder.fsm/build.gradle +++ b/tgbotapi.behaviour_builder.fsm/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "Behaviour Builder extension with built-in FSM" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.behaviour_builder.fsm/publish.gradle b/tgbotapi.behaviour_builder.fsm/publish.gradle deleted file mode 100644 index f4ee4a926b..0000000000 --- a/tgbotapi.behaviour_builder.fsm/publish.gradle +++ /dev/null @@ -1,79 +0,0 @@ -apply plugin: 'maven-publish' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "FSM extension for dev.inmo:tgbotapi.extensions.behaviour_builder.fsm" - name = "Telegram Bot Behaviour Builder FSM Extensions" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.behaviour_builder" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -if (project.hasProperty("signing.gnupg.keyName")) { - apply plugin: 'signing' - - signing { - useGpgCmd() - - sign publishing.publications - } - - task signAll { - tasks.withType(Sign).forEach { - dependsOn(it) - } - } -} diff --git a/tgbotapi.behaviour_builder.fsm/publish.kpsb b/tgbotapi.behaviour_builder.fsm/publish.kpsb deleted file mode 100644 index 10238359f7..0000000000 --- a/tgbotapi.behaviour_builder.fsm/publish.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot Behaviour Builder FSM Extensions","description":"FSM extension for dev.inmo:tgbotapi.extensions.behaviour_builder.fsm","url":"https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.behaviour_builder","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file diff --git a/tgbotapi.behaviour_builder/build.gradle b/tgbotapi.behaviour_builder/build.gradle index 488052502a..68224e8bc7 100644 --- a/tgbotapi.behaviour_builder/build.gradle +++ b/tgbotapi.behaviour_builder/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "Behaviour Builder DSL" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.behaviour_builder/mpp_publish_template.kpsb b/tgbotapi.behaviour_builder/mpp_publish_template.kpsb deleted file mode 100644 index 21548e829f..0000000000 --- a/tgbotapi.behaviour_builder/mpp_publish_template.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 Steps Extensions","description":"This extensions project contains tools for simple interaction with chats","url":"https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.steps","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} \ No newline at end of file diff --git a/tgbotapi.behaviour_builder/publish.gradle b/tgbotapi.behaviour_builder/publish.gradle deleted file mode 100644 index 160347436c..0000000000 --- a/tgbotapi.behaviour_builder/publish.gradle +++ /dev/null @@ -1,79 +0,0 @@ -apply plugin: 'maven-publish' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "This extensions project contains tools for simple interaction with chats" - name = "Telegram Bot API Steps Extensions" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.steps" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -if (project.hasProperty("signing.gnupg.keyName")) { - apply plugin: 'signing' - - signing { - useGpgCmd() - - sign publishing.publications - } - - task signAll { - tasks.withType(Sign).forEach { - dependsOn(it) - } - } -} diff --git a/tgbotapi.behaviour_builder/publish.kpsb b/tgbotapi.behaviour_builder/publish.kpsb deleted file mode 100644 index ded4dcd6d6..0000000000 --- a/tgbotapi.behaviour_builder/publish.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 Steps Extensions","description":"This extensions project contains tools for simple interaction with chats","url":"https://insanusmokrassar.github.io/TelegramBotAPI/tgbotapi.extensions.steps","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file diff --git a/tgbotapi.core/build.gradle b/tgbotapi.core/build.gradle index 20105eb576..eee2044694 100644 --- a/tgbotapi.core/build.gradle +++ b/tgbotapi.core/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "Core part of tgbotapi with all (and only) required functionality for working with Telegram Bot API" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.core/publish.gradle b/tgbotapi.core/publish.gradle deleted file mode 100644 index 0826870836..0000000000 --- a/tgbotapi.core/publish.gradle +++ /dev/null @@ -1,79 +0,0 @@ -apply plugin: 'maven-publish' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - 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" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -if (project.hasProperty("signing.gnupg.keyName")) { - apply plugin: 'signing' - - signing { - useGpgCmd() - - sign publishing.publications - } - - task signAll { - tasks.withType(Sign).forEach { - dependsOn(it) - } - } -} diff --git a/tgbotapi.core/publish.kpsb b/tgbotapi.core/publish.kpsb deleted file mode 100644 index 48aeac4f9d..0000000000 --- a/tgbotapi.core/publish.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/multiserver/SimpleMultiServerRequestsExecutor.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/multiserver/SimpleMultiServerRequestsExecutor.kt new file mode 100644 index 0000000000..1dd4e28076 --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/multiserver/SimpleMultiServerRequestsExecutor.kt @@ -0,0 +1,224 @@ +package dev.inmo.tgbotapi.bot.multiserver + +import dev.inmo.tgbotapi.bot.Ktor.KtorRequestsExecutorBuilder +import dev.inmo.tgbotapi.bot.Ktor.telegramBot +import dev.inmo.tgbotapi.bot.RequestsExecutor +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.abstracts.Request +import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper +import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl +import kotlinx.coroutines.* +import kotlin.js.JsName +import kotlin.jvm.JvmName + +/** + * This type of [RequestsExecutor] (aka [TelegramBot]) has been created to aggregate several bots under the hood and make + * requests, for example, with changing of api url + * + * @param bots Bots which will be used to [execute] [Request]s + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one [execute]. By default, will select next + * [TelegramBot] when called (or first when current index is last or -1) + * @param onClose This method will be called inside of [close] method. By default, will close all [bots] + */ +class SimpleMultiServerRequestsExecutor( + private val bots: List, + private val botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + private val onClose: () -> Unit = { + bots.forEach(TelegramBot::close) + } +) : RequestsExecutor { + override suspend fun execute(request: Request): T { + var currentBot = bots.botSelector(-1, null) + while (currentCoroutineContext().isActive) { + val i = bots.indexOf(currentBot) + runCatching { + currentBot.execute(request) + }.onSuccess { + return it + }.onFailure { + currentBot = bots.botSelector(i, it) + } + } + error("Coroutine has been terminated") + } + + override fun close() { + onClose() + } + + companion object { + /** + * @param keepers Will be used to create result [bots] + * @param builder Will be called with each item from [keepers] in process of bots creation + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one [execute]. By default, will select next + * [TelegramBot] when called (or first when current index is last or -1) + * @param onClose This method will be called inside of [close] method. By default, will close all [bots] + */ + @JvmName("createByUrlsKeepers") + @JsName("createByUrlsKeepers") + inline operator fun invoke( + keepers: Iterable, + crossinline builder: KtorRequestsExecutorBuilder.(TelegramAPIUrlsKeeper) -> Unit = {}, + noinline botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + noinline onClose: ((List) -> Unit)? = null + ): SimpleMultiServerRequestsExecutor { + val bots = keepers.map { telegramBot(it) { builder(it) } } + return if (onClose == null) { + SimpleMultiServerRequestsExecutor(bots, botSelector) + } else { + SimpleMultiServerRequestsExecutor(bots, botSelector) { + onClose(bots) + } + } + } + + /** + * @param tokens Will be used to create result [bots] + * @param builder Will be called with each item from [tokens] in process of bots creation + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one [execute]. By default, will select next + * [TelegramBot] when called (or first when current index is last or -1) + * @param onClose This method will be called inside of [close] method. By default, will close all [bots] + */ + @JvmName("createByTokens") + @JsName("createByTokens") + inline operator fun invoke( + tokens: Iterable, + crossinline builder: KtorRequestsExecutorBuilder.(String) -> Unit = {}, + noinline botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + noinline onClose: ((List) -> Unit)? = null + ): SimpleMultiServerRequestsExecutor { + val bots = tokens.map { telegramBot(it) { builder(it) } } + return if (onClose == null) { + SimpleMultiServerRequestsExecutor(bots, botSelector) + } else { + SimpleMultiServerRequestsExecutor(bots, botSelector) { + onClose(bots) + } + } + } + + /** + * @param tokens [Pair]s with first parameter as a token and second parameter api url. Will be used to create + * result [bots] + * @param builder Will be called with each item from [tokens] in process of bots creation + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one [execute]. By default, will select next + * [TelegramBot] when called (or first when current index is last or -1) + * @param onClose This method will be called inside of [close] method. By default, will close all [bots] + */ + @JvmName("createByTokensAndApiUrls") + @JsName("createByTokensAndApiUrls") + inline operator fun invoke( + tokens: Iterable>, + crossinline builder: KtorRequestsExecutorBuilder.(Pair) -> Unit = {}, + noinline botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + noinline onClose: ((List) -> Unit)? = null + ): SimpleMultiServerRequestsExecutor { + val bots = tokens.map { telegramBot(it.first, it.second) { builder(it) } } + return if (onClose == null) { + SimpleMultiServerRequestsExecutor(bots, botSelector) + } else { + SimpleMultiServerRequestsExecutor(bots, botSelector) { + onClose(bots) + } + } + } + } +} + + +/** + * Creates [SimpleMultiServerRequestsExecutor] + * + * @param bots Bots which will be used to [SimpleMultiServerRequestsExecutor.execute] [Request]s + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one + * [SimpleMultiServerRequestsExecutor.execute]. By default, will select next [TelegramBot] when called (or first when + * current index is last or -1) + * @param onClose This method will be called inside of [SimpleMultiServerRequestsExecutor.close] method. By default, will close all [bots] + */ +@Suppress("NOTHING_TO_INLINE") +inline fun telegramBot( + bots: List, + noinline botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + noinline onClose: () -> Unit = { + bots.forEach(TelegramBot::close) + } +): TelegramBot = SimpleMultiServerRequestsExecutor(bots, botSelector, onClose) + +/** + * @param keepers Will be used to create result [SimpleMultiServerRequestsExecutor.bots] + * @param builder Will be called with each item from [keepers] in process of bots creation + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one + * [SimpleMultiServerRequestsExecutor.execute]. By default, will select next [TelegramBot] when called (or first when + * current index is last or -1) + * @param onClose This method will be called inside of [SimpleMultiServerRequestsExecutor.close] method. By default, + * will close all [SimpleMultiServerRequestsExecutor.bots] + */ +@JvmName("telegramBotByApiUrlsKeepers") +@JsName("telegramBotByApiUrlsKeepers") +inline fun telegramBot( + keepers: Iterable, + crossinline builder: KtorRequestsExecutorBuilder.(TelegramAPIUrlsKeeper) -> Unit = {}, + noinline botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + noinline onClose: ((List) -> Unit)? = null +): TelegramBot = SimpleMultiServerRequestsExecutor(keepers, builder, botSelector, onClose) + +/** + * @param tokens Will be used to create result [SimpleMultiServerRequestsExecutor.bots] + * @param builder Will be called with each item from [tokens] in process of bots creation + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one + * [SimpleMultiServerRequestsExecutor.execute]. By default, will select next [TelegramBot] when called (or first when + * current index is last or -1) + * @param onClose This method will be called inside of [SimpleMultiServerRequestsExecutor.close] method. By default, + * will close all [SimpleMultiServerRequestsExecutor.bots] + */ +@JvmName("telegramBotByTokens") +@JsName("telegramBotByTokens") +inline fun telegramBot( + tokens: Iterable, + crossinline builder: KtorRequestsExecutorBuilder.(String) -> Unit = {}, + noinline botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + noinline onClose: ((List) -> Unit)? = null +): TelegramBot = SimpleMultiServerRequestsExecutor(tokens, builder, botSelector, onClose) + +/** + * @param tokens [Pair]s with first parameter as a token and second parameter api url. Will be used to create + * result [SimpleMultiServerRequestsExecutor.bots] + * @param builder Will be called with each item from [tokens] in process of bots creation + * @param botSelector It is strategy by which the bot is selected for the execution. This lambda will receive **-1** + * when request execution just started and this call is first in context of one + * [SimpleMultiServerRequestsExecutor.execute]. By default, will select next + * [TelegramBot] when called (or first when current index is last or -1) + * @param onClose This method will be called inside of [SimpleMultiServerRequestsExecutor.close] method. By default, + * will close all [SimpleMultiServerRequestsExecutor.bots] + */ +@JvmName("telegramBotByTokensAndApiUrls") +@JsName("telegramBotByTokensAndApiUrls") +inline fun telegramBot( + tokens: Iterable>, + crossinline builder: KtorRequestsExecutorBuilder.(Pair) -> Unit = {}, + noinline botSelector: suspend List.(currentBotIndex: Int, t: Throwable?) -> TelegramBot = { i, _ -> + getOrElse(i + 1) { first() } + }, + noinline onClose: ((List) -> Unit)? = null +): TelegramBot = SimpleMultiServerRequestsExecutor(tokens, builder, botSelector, onClose) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MessageContent.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MessageContent.kt index 96c6d9c83c..ed5545ffe5 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MessageContent.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/message/content/abstracts/MessageContent.kt @@ -1,3 +1,41 @@ package dev.inmo.tgbotapi.types.message.content.abstracts -interface MessageContent: ResendableContent +import dev.inmo.tgbotapi.types.message.content.* +import dev.inmo.tgbotapi.types.message.content.media.* +import dev.inmo.tgbotapi.types.message.payments.InvoiceContent +import dev.inmo.tgbotapi.utils.RiskFeature +import kotlinx.serialization.modules.* + +interface MessageContent: ResendableContent { + companion object { + @RiskFeature("This serialization module can be changed in near releases") + fun serializationModule( + additionalBuilder: PolymorphicModuleBuilder.() -> Unit = {} + ) = SerializersModule { + polymorphic(MessageContent::class) { + + subclass(ContactContent::class) + subclass(VenueContent::class) + subclass(PollContent::class) + subclass(DiceContent::class) + subclass(TextContent::class) + + subclass(LiveLocationContent::class) + subclass(StaticLocationContent::class) + + subclass(PhotoContent::class) + subclass(VideoContent::class) + subclass(AudioContent::class) + subclass(DocumentContent::class) + + subclass(VoiceContent::class) + subclass(VideoNoteContent::class) + subclass(AnimationContent::class) + subclass(StickerContent::class) + subclass(InvoiceContent::class) + + additionalBuilder() + } + } + } +} diff --git a/tgbotapi.extensions.api/build.gradle b/tgbotapi.extensions.api/build.gradle index ad5ab19c66..19f9b94bce 100644 --- a/tgbotapi.extensions.api/build.gradle +++ b/tgbotapi.extensions.api/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "DEPRECATED, use tgbotapi.api" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.extensions.api/mpp_publish_template.kpsb b/tgbotapi.extensions.api/mpp_publish_template.kpsb deleted file mode 100644 index 693f3cac16..0000000000 --- a/tgbotapi.extensions.api/mpp_publish_template.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 API Extensions for tgbotapi.api","description":"","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} diff --git a/tgbotapi.extensions.api/publish.gradle b/tgbotapi.extensions.api/publish.gradle deleted file mode 100644 index 2b4408727a..0000000000 --- a/tgbotapi.extensions.api/publish.gradle +++ /dev/null @@ -1,69 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "${project.name}" - name = "Telegram Bot API API Extensions for tgbotapi.api" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -signing { - useGpgCmd() - sign publishing.publications -} diff --git a/tgbotapi.extensions.behaviour_builder.fsm/build.gradle b/tgbotapi.extensions.behaviour_builder.fsm/build.gradle index aa2d82b664..d65af85ca1 100644 --- a/tgbotapi.extensions.behaviour_builder.fsm/build.gradle +++ b/tgbotapi.extensions.behaviour_builder.fsm/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "DEPRECATED, use tgbotapi.behaviour_builder.fsm" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.extensions.behaviour_builder.fsm/mpp_publish_template.kpsb b/tgbotapi.extensions.behaviour_builder.fsm/mpp_publish_template.kpsb deleted file mode 100644 index eebed183f7..0000000000 --- a/tgbotapi.extensions.behaviour_builder.fsm/mpp_publish_template.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 BehaviourBuilder FSM Extensions for tgbotapi.behaviour_builder.fsm","description":"","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} \ No newline at end of file diff --git a/tgbotapi.extensions.behaviour_builder.fsm/publish.gradle b/tgbotapi.extensions.behaviour_builder.fsm/publish.gradle deleted file mode 100644 index 80c48eb3ff..0000000000 --- a/tgbotapi.extensions.behaviour_builder.fsm/publish.gradle +++ /dev/null @@ -1,69 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "${project.name}" - name = "Telegram Bot API BehaviourBuilder FSM Extensions for tgbotapi.behaviour_builder.fsm" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -signing { - useGpgCmd() - sign publishing.publications -} diff --git a/tgbotapi.extensions.behaviour_builder/build.gradle b/tgbotapi.extensions.behaviour_builder/build.gradle index 0167fa3ae8..74e5743851 100644 --- a/tgbotapi.extensions.behaviour_builder/build.gradle +++ b/tgbotapi.extensions.behaviour_builder/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "DEPRECATED, use tgbotapi.behaviour_builder" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.extensions.behaviour_builder/mpp_publish_template.kpsb b/tgbotapi.extensions.behaviour_builder/mpp_publish_template.kpsb deleted file mode 100644 index faf67d4114..0000000000 --- a/tgbotapi.extensions.behaviour_builder/mpp_publish_template.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 BehaviourBuilder Extensions for tgbotapi.behaviour_builder","description":"","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} diff --git a/tgbotapi.extensions.behaviour_builder/publish.gradle b/tgbotapi.extensions.behaviour_builder/publish.gradle deleted file mode 100644 index 5f260c1a79..0000000000 --- a/tgbotapi.extensions.behaviour_builder/publish.gradle +++ /dev/null @@ -1,69 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "${project.name}" - name = "Telegram Bot API BehaviourBuilder Extensions for tgbotapi.behaviour_builder" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -signing { - useGpgCmd() - sign publishing.publications -} diff --git a/tgbotapi.extensions.utils/build.gradle b/tgbotapi.extensions.utils/build.gradle index a6a9ad771e..f34195fe8d 100644 --- a/tgbotapi.extensions.utils/build.gradle +++ b/tgbotapi.extensions.utils/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "DEPRECATED, use tgbotapi.utils" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.extensions.utils/mpp_publish_template.kpsb b/tgbotapi.extensions.utils/mpp_publish_template.kpsb deleted file mode 100644 index d3b6348ee8..0000000000 --- a/tgbotapi.extensions.utils/mpp_publish_template.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 Utils Extensions for tgbotapi.utils","description":"","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}} diff --git a/tgbotapi.extensions.utils/publish.gradle b/tgbotapi.extensions.utils/publish.gradle deleted file mode 100644 index 7fccf82acc..0000000000 --- a/tgbotapi.extensions.utils/publish.gradle +++ /dev/null @@ -1,69 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "${project.name}" - name = "Telegram Bot API Utils Extensions for tgbotapi.utils" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-behaviour_builder-fsm" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -signing { - useGpgCmd() - sign publishing.publications -} diff --git a/tgbotapi.utils/build.gradle b/tgbotapi.utils/build.gradle index f5f75bdb2c..d84f636549 100644 --- a/tgbotapi.utils/build.gradle +++ b/tgbotapi.utils/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "Additional extensions for core part of tgbotapi" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi.utils/publish.gradle b/tgbotapi.utils/publish.gradle deleted file mode 100644 index 9d0054f20c..0000000000 --- a/tgbotapi.utils/publish.gradle +++ /dev/null @@ -1,79 +0,0 @@ -apply plugin: 'maven-publish' - -task javadocsJar(type: Jar) { - classifier = 'javadoc' -} - -publishing { - publications.all { - artifact javadocsJar - - pom { - description = "Util extensions for more useful work with updates and other things" - name = "Telegram Bot API Utility Extensions" - url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-utils" - - scm { - developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git" - url = "https://github.com/insanusmokrassar/TelegramBotAPI.git" - } - - developers { - - developer { - id = "InsanusMokrassar" - name = "Ovsiannikov Aleksei" - email = "ovsyannikov.alexey95@gmail.com" - } - - } - - licenses { - - license { - name = "Apache Software License 2.0" - url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" - } - - } - } - repositories { - if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) { - maven { - name = "GithubPackages" - url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") - credentials { - username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') - password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') - } - } - } - if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { - maven { - name = "sonatype" - url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - credentials { - username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') - password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') - } - } - } - } - } -} - -if (project.hasProperty("signing.gnupg.keyName")) { - apply plugin: 'signing' - - signing { - useGpgCmd() - - sign publishing.publications - } - - task signAll { - tasks.withType(Sign).forEach { - dependsOn(it) - } - } -} diff --git a/tgbotapi.utils/publish.kpsb b/tgbotapi.utils/publish.kpsb deleted file mode 100644 index f7b70b9aac..0000000000 --- a/tgbotapi.utils/publish.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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 Utility Extensions","description":"Util extensions for more useful work with updates and other things","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI-extensions-utils","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file diff --git a/tgbotapi/build.gradle b/tgbotapi/build.gradle index 561e2722c6..f5ee245a85 100644 --- a/tgbotapi/build.gradle +++ b/tgbotapi/build.gradle @@ -17,8 +17,9 @@ plugins { project.version = "$library_version" project.group = "$library_group" +project.description = "Full collection of all built-in tgbotapi tools" -apply from: "publish.gradle" +apply from: "../publish.gradle" repositories { mavenLocal() diff --git a/tgbotapi/publish.kpsb b/tgbotapi/publish.kpsb deleted file mode 100644 index e91196a721..0000000000 --- a/tgbotapi/publish.kpsb +++ /dev/null @@ -1 +0,0 @@ -{"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","description":"This project just include all subproject of TelegramBotAPI","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}} \ No newline at end of file