1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-20 06:15:49 +00:00

Compare commits

...

40 Commits

Author SHA1 Message Date
c85983bd59 update microutils 2022-07-22 18:45:09 +06:00
d72e1029d3 fill changelog 2022-07-22 16:50:20 +06:00
4b89563cff fixes in classcasts, withContentOrNull and withContentOrThrow 2022-07-22 16:45:54 +06:00
542079f4bf Merge pull request #629 from d1snin/tgbotapi-627
Add content-oriented typealiases for messages
2022-07-22 16:15:02 +06:00
d1snin
5c7164e864 refactored the handlers to use new typealiases when possible 2022-07-18 11:59:01 +03:00
6329905f62 Update libs.versions.toml 2022-07-18 14:53:10 +06:00
c54945e4cc Update gradle-wrapper.properties 2022-07-18 14:52:16 +06:00
8f20e1d617 Update gradle.properties 2022-07-18 14:48:52 +06:00
d1snin
edbfedb74e added logically missing typealiases 2022-07-18 11:26:18 +03:00
d1snin
b5006cd1e0 Add content-oriented typealiases for messages 2022-07-18 11:02:13 +03:00
ca01ce7843 Merge pull request #628 from InsanusMokrassar/tg_channel_imh
Tg Channel QR
2022-07-18 13:44:04 +06:00
54fad3f338 Add files via upload 2022-07-18 13:43:06 +06:00
15ef481fd7 Update README.md 2022-07-18 13:42:17 +06:00
91e1202674 Delete 68a81ca4-7950-48df-b842-85f285ce3741.jpg 2022-07-18 13:33:23 +06:00
bdd39963a8 Add files via upload 2022-07-18 13:31:30 +06:00
01dfedf540 Merge pull request #623 from InsanusMokrassar/2.2.0
2.2.0
2022-07-11 11:18:07 +06:00
8ded892b72 new class casts 2022-07-11 02:20:28 +06:00
d0b606469b fixes related to owner chat member 2022-07-11 02:05:10 +06:00
678f79da04 CreatorChatMember -> OwnerChatMember 2022-07-11 01:56:31 +06:00
fde2c79f4c extract force_reply field into constant 2022-07-11 01:43:04 +06:00
acaf46e015 ReplyForce companion improvements 2022-07-11 01:27:28 +06:00
3f9237b5de flatInlineKeyboard and flatReplyKeyboard 2022-07-11 01:10:35 +06:00
3d7334dd62 sameChat 2022-07-11 00:57:13 +06:00
26306f1567 sameMessage 2022-07-11 00:53:20 +06:00
247553d990 add note about parameters order 2022-07-11 00:45:11 +06:00
049a8a3263 copy message order of parameters changed 2022-07-11 00:26:57 +06:00
cc67a31e97 start 2.2.0 2022-07-11 00:10:30 +06:00
8791573145 Update build.gradle 2022-07-10 00:04:36 +06:00
5752f7a4fb Merge pull request #622 from InsanusMokrassar/2.1.3
2.1.3
2022-07-09 23:54:18 +06:00
ade236eaa3 update microutils 2022-07-09 23:52:16 +06:00
e7340a483a fixes 2022-07-09 23:45:24 +06:00
c7dc69d09f ChatJoinRequest#inviteLink fix 2022-07-09 23:09:52 +06:00
c2487c5adc fixes in links 2022-07-09 22:43:19 +06:00
7c4808f163 start 2.1.3 2022-07-09 22:37:58 +06:00
b91b516659 Merge pull request #618 from InsanusMokrassar/2.1.2
2.1.2
2022-06-29 14:42:01 +06:00
57cdc4ff2a fill changelog 2022-06-29 14:27:29 +06:00
864992aff0 complete rewriting on libs.versions.toml 2022-06-29 14:23:45 +06:00
e18e8ba6df start to use more unified way of scripts organization 2022-06-29 13:47:21 +06:00
02cedc6626 start 2.1.2 2022-06-29 13:27:35 +06:00
619b890956 Merge pull request #615 from InsanusMokrassar/2.1.1
2.1.1
2022-06-26 13:42:26 +06:00
42 changed files with 4396 additions and 634 deletions

View File

@@ -1,5 +1,52 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 2.2.1
* `Versions`:
* `Coroutines`: `1.6.3` -> `1.6.4`
* `MicroUtils`: `0.11.12` -> `0.11.13`
* `Core`:
* New `typealiase`s for `CommonMessage` with all supported content types, more info: [PR](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/629)
* `Utils`:
* New extensions for all types of messages `*.withContentOrNull` and `*.withContentOrThrow` as analogies to the same ones from class casts
## 2.2.0
* `Core`:
* For `CopyMessage` order of parameters has been changed
* `ReplyForce` defaults changes:
* All old companion properties (like `ReplyForce.ReplyForceSelective`) have been renamed:
* `ReplyForceSelective` -> `Selective`
* `ReplyForceNonSelective` -> `NonSelective`
* `ReplyForceDefault` -> `Default`
* New companion functions:
* `ReplyForce#Selective`
* `ReplyForce#NonSelective`
* Rename `CreatorChatMember` -> `OwnerChatMember`
* `API`:
* For `copyMessage` order of parameters has been changed
* `Utils`:
* New extension `Message#sameChat`
* New extension `Message#sameMessage`
* New functions `flatInlineKeyboard` and `flatReplyKeyboard`
* Experimentally add new triple of class casts: `if*`, `*OrNull` and `*OrThrow`
## 2.1.3
* `Versions`:
* `MicroUtils`: `0.11.9` -> `0.11.12`
* `Utils`:
* Rename `UserId` extension `link` to `userLink`
* `Core`
* `ChatJoinRequest#inviteLink` is nullable due to the fact that join requests without link do not require invite link
## 2.1.2
* `Versions`:
* `Coroutines`: `1.6.1` -> `1.6.3`
* `Ktor`: `2.0.2` -> `2.0.3`
* `MicroUtils`: `0.11.6` -> `0.11.9`
## 2.1.1 ## 2.1.1
* `API`: * `API`:

View File

@@ -3,6 +3,7 @@
| [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://github.com/InsanusMokrassar/TelegramBotAPI/workflows/Build/badge.svg)](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [![Small survey](https://img.shields.io/static/v1?label=Google&message=Survey&color=blue&logo=google-sheets)](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) [![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram&message=Chat&color=blue&logo=telegram)](https://t.me/InMoTelegramBotAPI) | | [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://github.com/InsanusMokrassar/TelegramBotAPI/workflows/Build/badge.svg)](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [![Small survey](https://img.shields.io/static/v1?label=Google&message=Survey&color=blue&logo=google-sheets)](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) [![Chat in Telegram](https://img.shields.io/static/v1?label=Telegram&message=Chat&color=blue&logo=telegram)](https://t.me/InMoTelegramBotAPI) |
|:---:| |:---:|
| [![Create bot](https://img.shields.io/static/v1?label=Github&message=Template&color=blue&logo=github)](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [![Examples](https://img.shields.io/static/v1?label=Github&message=Examples&color=blue&logo=github)](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Bookstack&message=Tutorial&color=blue&logo=bookstack)](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) | | [![Create bot](https://img.shields.io/static/v1?label=Github&message=Template&color=blue&logo=github)](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [![Examples](https://img.shields.io/static/v1?label=Github&message=Examples&color=blue&logo=github)](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Bookstack&message=Tutorial&color=blue&logo=bookstack)](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
| [![Telegram Channel](./resources/tg_channel_qr.jpg)](https://t.me/InMoTelegramBotAPI) |
Hello! This is a set of libraries for working with Telegram Bot API. Hello! This is a set of libraries for working with Telegram Bot API.

View File

@@ -6,19 +6,20 @@ buildscript {
} }
dependencies { dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath libs.kotlin.gradle.plugin
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version" classpath libs.kotlin.serialization.plugin
classpath "com.github.breadmoirai:github-release:$github_release_plugin_version" classpath libs.kotlin.dokka.plugin
classpath libs.github.release.plugin
} }
} }
plugins {
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" apply false
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" apply false
}
// temporal crutch until legacy tests will be stabled or legacy target will be removed // temporal crutch until legacy tests will be stabled or legacy target will be removed
allprojects { allprojects {
repositories {
mavenLocal()
mavenCentral()
google()
}
if (it != rootProject.findProject("docs")) { if (it != rootProject.findProject("docs")) {
tasks.whenTaskAdded { task -> tasks.whenTaskAdded { task ->
if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") { if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") {
@@ -27,6 +28,7 @@ allprojects {
} }
} }
} }
apply from: "./extensions.gradle"
private String getCurrentVersionChangelog() { private String getCurrentVersionChangelog() {
OutputStream changelogDataOS = new ByteArrayOutputStream() OutputStream changelogDataOS = new ByteArrayOutputStream()
@@ -48,7 +50,7 @@ if (new File(projectDir, "secret.gradle").exists()) {
owner "InsanusMokrassar" owner "InsanusMokrassar"
repo "TelegramBotAPI" repo "TelegramBotAPI"
tagName "$library_version" tagName "v$library_version"
releaseName "$library_version" releaseName "$library_version"
targetCommitish "$library_version" targetCommitish "$library_version"

View File

@@ -1,45 +1,17 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
id "org.jetbrains.dokka" version "$dokka_version" id "org.jetbrains.dokka"
} }
repositories { project.description = "Full collection of all built-in tgbotapi tools"
mavenLocal()
mavenCentral() apply from: "$mppProjectWithSerializationPresetPath"
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib')
api project(":tgbotapi.core") api project(":tgbotapi.core")
api project(":tgbotapi.api") api project(":tgbotapi.api")
api project(":tgbotapi.utils") api project(":tgbotapi.utils")
@@ -103,8 +75,3 @@ Object callback = {
tasks.dokkaGfm(callback) tasks.dokkaGfm(callback)
tasks.dokkaHtml(callback) tasks.dokkaHtml(callback)
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

8
extensions.gradle Normal file
View File

@@ -0,0 +1,8 @@
allprojects {
ext {
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle"
publishGradlePath = "${rootProject.projectDir.absolutePath}/publish.gradle"
}
}

View File

@@ -5,21 +5,5 @@ kotlin.js.generate.externals=true
kotlin.incremental=true kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
kotlin_version=1.6.21
kotlin_coroutines_version=1.6.1
kotlin_serialisation_runtime_version=1.3.3
korlibs_version=2.7.0
uuid_version=0.4.1
ktor_version=2.0.2
micro_utils_version=0.11.6
javax_activation_version=1.1.1
dokka_version=1.6.21
library_group=dev.inmo library_group=dev.inmo
library_version=2.1.1 library_version=2.2.1
github_release_plugin_version=2.4.1

59
gradle/libs.versions.toml Normal file
View File

@@ -0,0 +1,59 @@
[versions]
kotlin = "1.6.21"
kotlin-serialization = "1.3.3"
kotlin-coroutines = "1.6.4"
kotlin-gradle-plugin = "7.0.4"
javax-activation = "1.1.1"
korlibs = "2.7.0"
uuid = "0.4.1"
ktor = "2.0.3"
microutils = "0.11.13"
github-release-plugin = "2.4.1"
[libraries]
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization" }
kotlin-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlin-serialization" }
kotlin-test-common = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlin" }
kotlin-test-annotations-common = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlin" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
javax-activation = { module = "javax.activation:activation", version.ref = "javax-activation" }
korlibs-klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "korlibs" }
korlibs-krypto = { module = "com.soywiz.korlibs.krypto:krypto", version.ref = "korlibs" }
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
microutils-coroutines = { module = "dev.inmo:micro_utils.coroutines", version.ref = "microutils" }
microutils-serialization-base64 = { module = "dev.inmo:micro_utils.serialization.base64", version.ref = "microutils" }
microutils-serialization-encapsulator = { module = "dev.inmo:micro_utils.serialization.encapsulator", version.ref = "microutils" }
microutils-serialization-typedSerializer = { module = "dev.inmo:micro_utils.serialization.typed_serializer", version.ref = "microutils" }
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" }
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
# buildscript classpaths
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
kotlin-serialization-plugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
kotlin-dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "kotlin" }
github-release-plugin = { module = "com.github.breadmoirai:github-release", version.ref = "github-release-plugin" }
[plugins]
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }

View File

@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip

32
mppJsProject.gradle Normal file
View File

@@ -0,0 +1,32 @@
project.version = "$version"
project.group = "$group"
apply from: "$publishGradlePath"
kotlin {
js (IR) {
browser()
nodejs()
}
sourceSets {
commonMain {
dependencies {
implementation libs.kotlin
api libs.kotlin.serialization
}
}
commonTest {
dependencies {
implementation libs.kotlin.test.common
implementation libs.kotlin.test.annotations.common
}
}
jsTest {
dependencies {
implementation libs.kotlin.test.js
implementation libs.kotlin.test.junit
}
}
}
}

View File

@@ -0,0 +1,47 @@
project.version = "$library_version"
project.group = "$library_group"
kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js (IR) {
browser()
nodejs()
}
sourceSets {
commonMain {
dependencies {
implementation libs.kotlin
api libs.kotlin.serialization
}
}
commonTest {
dependencies {
implementation libs.kotlin.test.common
implementation libs.kotlin.test.annotations.common
}
}
jvmTest {
dependencies {
implementation libs.kotlin.test.junit
}
}
jsTest {
dependencies {
implementation libs.kotlin.test.js
implementation libs.kotlin.test.junit
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

BIN
resources/tg_channel_qr.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

View File

@@ -1,56 +1,20 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
project.version = "$library_version"
project.group = "$library_group"
project.description = "API extensions with \"Telegram Bot API\"-like extensions for TelegramBot and RequestsExecutor" project.description = "API extensions with \"Telegram Bot API\"-like extensions for TelegramBot and RequestsExecutor"
apply from: "../publish.gradle" apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
repositories {
mavenLocal()
mavenCentral()
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib')
api project(":tgbotapi.core") api project(":tgbotapi.core")
} }
} }
} }
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -16,8 +16,8 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChatId: ChatIdentifier,
messageId: MessageIdentifier, messageId: MessageIdentifier,
toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
@@ -26,7 +26,18 @@ suspend inline fun TelegramBot.copyMessage(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
CopyMessage(fromChatId, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) CopyMessage(
fromChatId,
messageId,
toChatId,
text,
parseMode,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
) )
/** /**
@@ -35,8 +46,8 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
toChatId: ChatIdentifier,
messageId: MessageIdentifier, messageId: MessageIdentifier,
toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
@@ -44,7 +55,7 @@ suspend inline fun TelegramBot.copyMessage(
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -52,8 +63,8 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChat: Chat,
messageId: MessageIdentifier, messageId: MessageIdentifier,
toChat: Chat,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
@@ -61,7 +72,7 @@ suspend inline fun TelegramBot.copyMessage(
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -69,40 +80,8 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
toChat: Chat,
messageId: MessageIdentifier, messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
message: Message,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChatId, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
message: Message,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
@@ -110,7 +89,7 @@ suspend inline fun TelegramBot.copyMessage(
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChat, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@@ -119,8 +98,8 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChatId: ChatIdentifier,
messageId: MessageIdentifier, messageId: MessageIdentifier,
toChatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
@@ -128,7 +107,17 @@ suspend inline fun TelegramBot.copyMessage(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
CopyMessage(fromChatId, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) CopyMessage(
fromChatId,
messageId,
toChatId,
entities,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
) )
/** /**
@@ -137,15 +126,15 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
toChatId: ChatIdentifier,
messageId: MessageIdentifier, messageId: MessageIdentifier,
toChatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -153,15 +142,15 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChat: Chat,
messageId: MessageIdentifier, messageId: MessageIdentifier,
toChat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChatId, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -169,15 +158,47 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
toChat: Chat,
messageId: MessageIdentifier, messageId: MessageIdentifier,
toChat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChat.id, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
message: Message,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
message: Message,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -192,7 +213,7 @@ suspend inline fun TelegramBot.copyMessage(
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChatId, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChatId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -207,4 +228,4 @@ suspend inline fun TelegramBot.copyMessage(
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, toChat, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChat, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -0,0 +1,180 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.CopyMessage
import dev.inmo.tgbotapi.requests.send.OrderChangingDeprecationWarn
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageIdentifier
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
// TODO:: Swap fromChatId and toChatId for more correct order of parameters
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(
fromChatId,
messageId,
toChatId,
text,
parseMode,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChat: Chat,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChat: Chat,
messageId: MessageIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
CopyMessage(
fromChatId,
messageId,
toChatId,
entities,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChatId: ChatIdentifier,
messageId: MessageIdentifier,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier,
toChat: Chat,
messageId: MessageIdentifier,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
@Deprecated(OrderChangingDeprecationWarn)
suspend inline fun TelegramBot.copyMessage(
fromChat: Chat,
toChat: Chat,
messageId: MessageIdentifier,
entities: TextSourcesList,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -1,56 +1,20 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
project.version = "$library_version" project.description = "Behaviour Builder DSL"
project.group = "$library_group"
project.description = "Behaviour Builder extension with built-in FSM"
apply from: "../publish.gradle" apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
repositories {
mavenLocal()
mavenCentral()
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib')
api project(":tgbotapi.behaviour_builder") api project(":tgbotapi.behaviour_builder")
api "dev.inmo:micro_utils.fsm.common:$micro_utils_version" api libs.microutils.fsm.common
} }
} }
} }
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -35,10 +35,10 @@ messages and filter messages for context which will be used in subcontext. Full
telegramBotWithBehaviour(TOKEN) { telegramBotWithBehaviour(TOKEN) {
onText( onText(
includeFilterByChatInBehaviourSubContext = true, // if false - last lambda will receive all messages instead of filtered by chat messages includeFilterByChatInBehaviourSubContext = true, // if false - last lambda will receive all messages instead of filtered by chat messages
additionalFilter = { message: CommonMessage<TextContent> -> additionalFilter = { message: TextMessage ->
// here you may check incoming message for any requirements before it will be passed to the main lambda // here you may check incoming message for any requirements before it will be passed to the main lambda
} }
) { message: CommonMessage<TextContent> -> // this here is `BehaviourContext` ) { message: TextMessage -> // this here is `BehaviourContext`
// here put your actions and additional waiters // here put your actions and additional waiters
} }
} }
@@ -50,7 +50,7 @@ Waiters targeted to get some content "here and now", they must be used inside so
```kotlin ```kotlin
telegramBotWithBehaviour(TOKEN) { telegramBotWithBehaviour(TOKEN) {
onCommand("start") { message: CommonMessage<TextContent> -> onCommand("start") { message: TextMessage ->
val userPhotos = waitPhoto( val userPhotos = waitPhoto(
SendTextMessage(it.chat.id, "Ok, send me some photo, please"), // init request, can be any `Request` object SendTextMessage(it.chat.id, "Ok, send me some photo, please"), // init request, can be any `Request` object
{ update: Update -> // That is update which is NOT passed requirements. In current context we expect some photo, but received something else { update: Update -> // That is update which is NOT passed requirements. In current context we expect some photo, but received something else

View File

@@ -1,55 +1,19 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
project.version = "$library_version"
project.group = "$library_group"
project.description = "Behaviour Builder DSL" project.description = "Behaviour Builder DSL"
apply from: "../publish.gradle" apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
repositories {
mavenLocal()
mavenCentral()
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib')
api project(":tgbotapi.utils") api project(":tgbotapi.utils")
} }
} }
} }
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -14,6 +14,7 @@ import dev.inmo.tgbotapi.extensions.utils.asBotCommandTextSource
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
import dev.inmo.tgbotapi.types.message.content.TextContent import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.content.TextMessage
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
@@ -21,9 +22,9 @@ internal suspend fun <BC : BehaviourContext> BC.commandUncounted(
commandRegex: Regex, commandRegex: Regex,
requireOnlyCommandInMessage: Boolean = true, requireOnlyCommandInMessage: Boolean = true,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
): Job = onText( ): Job = onText(
CommonMessageFilter<TextContent> { message -> CommonMessageFilter<TextContent> { message ->
val content = message.content val content = message.content
@@ -48,9 +49,9 @@ suspend fun <BC : BehaviourContext> BC.command(
commandRegex: Regex, commandRegex: Regex,
requireOnlyCommandInMessage: Boolean = true, requireOnlyCommandInMessage: Boolean = true,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
): Job = runCatchingSafely { ): Job = runCatchingSafely {
commandUncounted( commandUncounted(
commandRegex, commandRegex,
@@ -77,35 +78,35 @@ suspend fun <BC : BehaviourContext> BC.command(
command: String, command: String,
requireOnlyCommandInMessage: Boolean = true, requireOnlyCommandInMessage: Boolean = true,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
) = command(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ) = command(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
suspend fun <BC : BehaviourContext> BC.onCommand( suspend fun <BC : BehaviourContext> BC.onCommand(
commandRegex: Regex, commandRegex: Regex,
requireOnlyCommandInMessage: Boolean = true, requireOnlyCommandInMessage: Boolean = true,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
): Job = command(commandRegex, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ): Job = command(commandRegex, requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
suspend fun <BC : BehaviourContext> BC.onCommand( suspend fun <BC : BehaviourContext> BC.onCommand(
command: String, command: String,
requireOnlyCommandInMessage: Boolean = true, requireOnlyCommandInMessage: Boolean = true,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
): Job = onCommand(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ): Job = onCommand(command.toRegex(), requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
suspend fun <BC : BehaviourContext> BC.commandWithArgs( suspend fun <BC : BehaviourContext> BC.commandWithArgs(
commandRegex: Regex, commandRegex: Regex,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, CommonMessage<TextContent>, Array<String>> scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, TextMessage, Array<String>>
) = command( ) = command(
commandRegex, commandRegex,
requireOnlyCommandInMessage = false, requireOnlyCommandInMessage = false,
@@ -123,9 +124,9 @@ suspend fun <BC : BehaviourContext> BC.commandWithArgs(
suspend fun <BC : BehaviourContext> BC.commandWithArgs( suspend fun <BC : BehaviourContext> BC.commandWithArgs(
command: String, command: String,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, CommonMessage<TextContent>, Array<String>> scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, TextMessage, Array<String>>
) = commandWithArgs( ) = commandWithArgs(
command.toRegex(), command.toRegex(),
initialFilter = initialFilter, initialFilter = initialFilter,
@@ -137,15 +138,15 @@ suspend fun <BC : BehaviourContext> BC.commandWithArgs(
suspend fun <BC : BehaviourContext> BC.onCommandWithArgs( suspend fun <BC : BehaviourContext> BC.onCommandWithArgs(
commandRegex: Regex, commandRegex: Regex,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, CommonMessage<TextContent>, Array<String>> scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, TextMessage, Array<String>>
): Job = commandWithArgs(commandRegex, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ): Job = commandWithArgs(commandRegex, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
suspend fun <BC : BehaviourContext> BC.onCommandWithArgs( suspend fun <BC : BehaviourContext> BC.onCommandWithArgs(
command: String, command: String,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, CommonMessage<TextContent>, Array<String>> scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, TextMessage, Array<String>>
): Job = onCommandWithArgs(command.toRegex(), initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ): Job = onCommandWithArgs(command.toRegex(), initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)

View File

@@ -10,20 +10,19 @@ import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.Mar
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times
import dev.inmo.tgbotapi.extensions.utils.asBotCommandTextSource import dev.inmo.tgbotapi.extensions.utils.asBotCommandTextSource
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithParams
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
import dev.inmo.tgbotapi.types.message.content.TextContent import dev.inmo.tgbotapi.types.message.content.TextContent
import dev.inmo.tgbotapi.types.message.content.TextMessage
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.utils.PreviewFeature import dev.inmo.tgbotapi.utils.PreviewFeature
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
@PreviewFeature @PreviewFeature
suspend fun <BC : BehaviourContext> BC.unhandledCommand( suspend fun <BC : BehaviourContext> BC.unhandledCommand(
requireOnlyCommandInMessage: Boolean = true, requireOnlyCommandInMessage: Boolean = true,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
): Job = onText( ): Job = onText(
CommonMessageFilter<TextContent> { message -> CommonMessageFilter<TextContent> { message ->
val content = message.content val content = message.content
@@ -49,17 +48,17 @@ suspend fun <BC : BehaviourContext> BC.unhandledCommand(
suspend fun <BC : BehaviourContext> BC.onUnhandledCommand( suspend fun <BC : BehaviourContext> BC.onUnhandledCommand(
requireOnlyCommandInMessage: Boolean = true, requireOnlyCommandInMessage: Boolean = true,
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
): Job = unhandledCommand(requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ): Job = unhandledCommand(requireOnlyCommandInMessage, initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
@PreviewFeature @PreviewFeature
suspend fun <BC : BehaviourContext> BC.unhandledCommandWithArgs( suspend fun <BC : BehaviourContext> BC.unhandledCommandWithArgs(
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, CommonMessage<TextContent>, Map<String, Array<String>>> scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, TextMessage, Map<String, Array<String>>>
) = onUnhandledCommand( ) = onUnhandledCommand(
requireOnlyCommandInMessage = false, requireOnlyCommandInMessage = false,
initialFilter = initialFilter, initialFilter = initialFilter,
@@ -75,7 +74,7 @@ suspend fun <BC : BehaviourContext> BC.unhandledCommandWithArgs(
@PreviewFeature @PreviewFeature
suspend fun <BC : BehaviourContext> BC.onUnhandledCommandWithArgs( suspend fun <BC : BehaviourContext> BC.onUnhandledCommandWithArgs(
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, CommonMessage<TextContent>, Map<String, Array<String>>> scenarioReceiver: CustomBehaviourContextAndTwoTypesReceiver<BC, Unit, TextMessage, Map<String, Array<String>>>
): Job = unhandledCommandWithArgs(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver) ): Job = unhandledCommandWithArgs(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)

View File

@@ -75,9 +75,9 @@ suspend fun <BC : BehaviourContext> BC.onContentMessage(
*/ */
suspend fun <BC : BehaviourContext> BC.onContact( suspend fun <BC : BehaviourContext> BC.onContact(
initialFilter: CommonMessageFilter<ContactContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<ContactContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<ContactContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ContactMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<ContactContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in ContactMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<ContactContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ContactMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -99,9 +99,9 @@ suspend fun <BC : BehaviourContext> BC.onContact(
*/ */
suspend fun <BC : BehaviourContext> BC.onDice( suspend fun <BC : BehaviourContext> BC.onDice(
initialFilter: CommonMessageFilter<DiceContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<DiceContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DiceContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DiceMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<DiceContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DiceMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DiceContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DiceMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -123,9 +123,9 @@ suspend fun <BC : BehaviourContext> BC.onDice(
*/ */
suspend fun <BC : BehaviourContext> BC.onGame( suspend fun <BC : BehaviourContext> BC.onGame(
initialFilter: CommonMessageFilter<GameContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<GameContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<GameContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GameMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<GameContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in GameMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<GameContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, GameMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -147,9 +147,9 @@ suspend fun <BC : BehaviourContext> BC.onGame(
*/ */
suspend fun <BC : BehaviourContext> BC.onLocation( suspend fun <BC : BehaviourContext> BC.onLocation(
initialFilter: CommonMessageFilter<LocationContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<LocationContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<LocationContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, LocationMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<LocationContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in LocationMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<LocationContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, LocationMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -171,9 +171,9 @@ suspend fun <BC : BehaviourContext> BC.onLocation(
*/ */
suspend fun <BC : BehaviourContext> BC.onLiveLocation( suspend fun <BC : BehaviourContext> BC.onLiveLocation(
initialFilter: CommonMessageFilter<LiveLocationContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<LiveLocationContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<LiveLocationContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, LiveLocationMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<LiveLocationContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in LiveLocationMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<LiveLocationContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, LiveLocationMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -195,9 +195,9 @@ suspend fun <BC : BehaviourContext> BC.onLiveLocation(
*/ */
suspend fun <BC : BehaviourContext> BC.onStaticLocation( suspend fun <BC : BehaviourContext> BC.onStaticLocation(
initialFilter: CommonMessageFilter<StaticLocationContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<StaticLocationContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<StaticLocationContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, StaticLocationMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<StaticLocationContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in StaticLocationMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<StaticLocationContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, StaticLocationMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -219,9 +219,9 @@ suspend fun <BC : BehaviourContext> BC.onStaticLocation(
*/ */
suspend fun <BC : BehaviourContext> BC.onPoll( suspend fun <BC : BehaviourContext> BC.onPoll(
initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<PollContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PollContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PollMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<PollContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in PollMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PollContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PollMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -243,9 +243,9 @@ suspend fun <BC : BehaviourContext> BC.onPoll(
*/ */
suspend fun <BC : BehaviourContext> BC.onText( suspend fun <BC : BehaviourContext> BC.onText(
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -267,9 +267,9 @@ suspend fun <BC : BehaviourContext> BC.onText(
*/ */
suspend fun <BC : BehaviourContext> BC.onVenue( suspend fun <BC : BehaviourContext> BC.onVenue(
initialFilter: CommonMessageFilter<VenueContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<VenueContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VenueContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VenueMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VenueContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VenueMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VenueContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VenueMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -291,9 +291,9 @@ suspend fun <BC : BehaviourContext> BC.onVenue(
*/ */
suspend fun <BC : BehaviourContext> BC.onAudioMediaGroup( suspend fun <BC : BehaviourContext> BC.onAudioMediaGroup(
initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null, initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioMediaGroupContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<AudioMediaGroupContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AudioMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioMediaGroupContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMediaGroupMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -315,9 +315,9 @@ suspend fun <BC : BehaviourContext> BC.onAudioMediaGroup(
*/ */
suspend fun <BC : BehaviourContext> BC.onDocumentMediaGroupContent( suspend fun <BC : BehaviourContext> BC.onDocumentMediaGroupContent(
initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null, initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentMediaGroupContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<DocumentMediaGroupContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DocumentMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentMediaGroupContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMediaGroupMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -339,9 +339,9 @@ suspend fun <BC : BehaviourContext> BC.onDocumentMediaGroupContent(
*/ */
suspend fun <BC : BehaviourContext> BC.onTextedMediaContent( suspend fun <BC : BehaviourContext> BC.onTextedMediaContent(
initialFilter: CommonMessageFilter<TextedMediaContent>? = null, initialFilter: CommonMessageFilter<TextedMediaContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextedMediaContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextedMediaMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextedMediaContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextedMediaMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextedMediaContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextedMediaMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -363,9 +363,9 @@ suspend fun <BC : BehaviourContext> BC.onTextedMediaContent(
*/ */
suspend fun <BC : BehaviourContext> BC.onMediaCollection( suspend fun <BC : BehaviourContext> BC.onMediaCollection(
initialFilter: CommonMessageFilter<MediaCollectionContent<TelegramMediaFile>>? = null, initialFilter: CommonMessageFilter<MediaCollectionContent<TelegramMediaFile>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaCollectionMessage<TelegramMediaFile>, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in MediaCollectionMessage<TelegramMediaFile>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaCollectionContent<TelegramMediaFile>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaCollectionMessage<TelegramMediaFile>>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -387,9 +387,9 @@ suspend fun <BC : BehaviourContext> BC.onMediaCollection(
*/ */
suspend fun <BC : BehaviourContext> BC.onMedia( suspend fun <BC : BehaviourContext> BC.onMedia(
initialFilter: CommonMessageFilter<MediaContent>? = null, initialFilter: CommonMessageFilter<MediaContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<MediaContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in MediaMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -411,9 +411,9 @@ suspend fun <BC : BehaviourContext> BC.onMedia(
*/ */
suspend fun <BC : BehaviourContext> BC.onAnimation( suspend fun <BC : BehaviourContext> BC.onAnimation(
initialFilter: CommonMessageFilter<AnimationContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<AnimationContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AnimationContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AnimationMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<AnimationContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AnimationMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AnimationContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AnimationMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -435,9 +435,9 @@ suspend fun <BC : BehaviourContext> BC.onAnimation(
*/ */
suspend fun <BC : BehaviourContext> BC.onAudio( suspend fun <BC : BehaviourContext> BC.onAudio(
initialFilter: CommonMessageFilter<AudioContent>? = null, initialFilter: CommonMessageFilter<AudioContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<AudioContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AudioMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -459,9 +459,9 @@ suspend fun <BC : BehaviourContext> BC.onAudio(
*/ */
suspend fun <BC : BehaviourContext> BC.onDocument( suspend fun <BC : BehaviourContext> BC.onDocument(
initialFilter: CommonMessageFilter<DocumentContent>? = null, initialFilter: CommonMessageFilter<DocumentContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<DocumentContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DocumentMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -483,9 +483,9 @@ suspend fun <BC : BehaviourContext> BC.onDocument(
*/ */
suspend fun <BC : BehaviourContext> BC.onPhoto( suspend fun <BC : BehaviourContext> BC.onPhoto(
initialFilter: CommonMessageFilter<PhotoContent>? = null, initialFilter: CommonMessageFilter<PhotoContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PhotoContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PhotoMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<PhotoContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in PhotoMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PhotoContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PhotoMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -507,9 +507,9 @@ suspend fun <BC : BehaviourContext> BC.onPhoto(
*/ */
suspend fun <BC : BehaviourContext> BC.onSticker( suspend fun <BC : BehaviourContext> BC.onSticker(
initialFilter: CommonMessageFilter<StickerContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<StickerContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<StickerContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, StickerMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<StickerContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in StickerMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<StickerContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, StickerMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -531,9 +531,9 @@ suspend fun <BC : BehaviourContext> BC.onSticker(
*/ */
suspend fun <BC : BehaviourContext> BC.onVideo( suspend fun <BC : BehaviourContext> BC.onVideo(
initialFilter: CommonMessageFilter<VideoContent>? = null, initialFilter: CommonMessageFilter<VideoContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VideoMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VideoContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VideoMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VideoMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -555,9 +555,9 @@ suspend fun <BC : BehaviourContext> BC.onVideo(
*/ */
suspend fun <BC : BehaviourContext> BC.onVideoNote( suspend fun <BC : BehaviourContext> BC.onVideoNote(
initialFilter: CommonMessageFilter<VideoNoteContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<VideoNoteContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoNoteContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VideoNoteMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VideoNoteContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VideoNoteMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoNoteContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VideoNoteMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -579,9 +579,9 @@ suspend fun <BC : BehaviourContext> BC.onVideoNote(
*/ */
suspend fun <BC : BehaviourContext> BC.onVoice( suspend fun <BC : BehaviourContext> BC.onVoice(
initialFilter: CommonMessageFilter<VoiceContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<VoiceContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VoiceContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VoiceMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VoiceContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VoiceMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VoiceContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VoiceMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -603,9 +603,9 @@ suspend fun <BC : BehaviourContext> BC.onVoice(
*/ */
suspend fun <BC : BehaviourContext> BC.onInvoice( suspend fun <BC : BehaviourContext> BC.onInvoice(
initialFilter: CommonMessageFilter<InvoiceContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<InvoiceContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<InvoiceContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, InvoiceMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<InvoiceContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in InvoiceMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<InvoiceContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InvoiceMessage>
) = onContentMessageWithType( ) = onContentMessageWithType(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,

View File

@@ -85,9 +85,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedContentMessage(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedContact( suspend fun <BC : BehaviourContext> BC.onEditedContact(
initialFilter: CommonMessageFilter<ContactContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<ContactContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<ContactContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ContactMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<ContactContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in ContactMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<ContactContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ContactMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -109,9 +109,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedContact(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedDice( suspend fun <BC : BehaviourContext> BC.onEditedDice(
initialFilter: CommonMessageFilter<DiceContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<DiceContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DiceContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DiceMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<DiceContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DiceMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DiceContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DiceMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -133,9 +133,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedDice(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedGame( suspend fun <BC : BehaviourContext> BC.onEditedGame(
initialFilter: CommonMessageFilter<GameContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<GameContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<GameContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GameMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<GameContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in GameMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<GameContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, GameMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -157,9 +157,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedGame(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedLocation( suspend fun <BC : BehaviourContext> BC.onEditedLocation(
initialFilter: CommonMessageFilter<LocationContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<LocationContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<LocationContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, LocationMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<LocationContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in LocationMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<LocationContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, LocationMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -181,9 +181,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedLocation(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedText( suspend fun <BC : BehaviourContext> BC.onEditedText(
initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<TextContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -205,9 +205,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedText(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedVenue( suspend fun <BC : BehaviourContext> BC.onEditedVenue(
initialFilter: CommonMessageFilter<VenueContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<VenueContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VenueContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VenueMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VenueContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VenueMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VenueContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VenueMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -229,9 +229,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedVenue(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedAudioMediaGroup( suspend fun <BC : BehaviourContext> BC.onEditedAudioMediaGroup(
initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null, initialFilter: CommonMessageFilter<AudioMediaGroupContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioMediaGroupContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<AudioMediaGroupContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AudioMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioMediaGroupContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMediaGroupMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -253,9 +253,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedAudioMediaGroup(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedDocumentMediaGroupContent( suspend fun <BC : BehaviourContext> BC.onEditedDocumentMediaGroupContent(
initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null, initialFilter: CommonMessageFilter<DocumentMediaGroupContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentMediaGroupContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMediaGroupMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<DocumentMediaGroupContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DocumentMediaGroupMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentMediaGroupContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMediaGroupMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -277,9 +277,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedDocumentMediaGroupContent(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedTextedMediaContent( suspend fun <BC : BehaviourContext> BC.onEditedTextedMediaContent(
initialFilter: CommonMessageFilter<TextedMediaContent>? = null, initialFilter: CommonMessageFilter<TextedMediaContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<TextedMediaContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, TextedMediaMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<TextedMediaContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in TextedMediaMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<TextedMediaContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, TextedMediaMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -301,9 +301,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedTextedMediaContent(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedMediaCollection( suspend fun <BC : BehaviourContext> BC.onEditedMediaCollection(
initialFilter: CommonMessageFilter<MediaCollectionContent<TelegramMediaFile>>? = null, initialFilter: CommonMessageFilter<MediaCollectionContent<TelegramMediaFile>>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaCollectionMessage<TelegramMediaFile>, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<MediaCollectionContent<TelegramMediaFile>>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in MediaCollectionMessage<TelegramMediaFile>, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaCollectionContent<TelegramMediaFile>>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaCollectionMessage<TelegramMediaFile>>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -325,9 +325,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedMediaCollection(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedMedia( suspend fun <BC : BehaviourContext> BC.onEditedMedia(
initialFilter: CommonMessageFilter<MediaContent>? = null, initialFilter: CommonMessageFilter<MediaContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<MediaContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, MediaMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<MediaContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in MediaMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<MediaContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, MediaMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -349,9 +349,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedMedia(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedAnimation( suspend fun <BC : BehaviourContext> BC.onEditedAnimation(
initialFilter: CommonMessageFilter<AnimationContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<AnimationContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AnimationContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AnimationMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<AnimationContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AnimationMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AnimationContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AnimationMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -373,9 +373,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedAnimation(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedAudio( suspend fun <BC : BehaviourContext> BC.onEditedAudio(
initialFilter: CommonMessageFilter<AudioContent>? = null, initialFilter: CommonMessageFilter<AudioContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<AudioContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, AudioMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<AudioContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in AudioMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<AudioContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, AudioMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -397,9 +397,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedAudio(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedDocument( suspend fun <BC : BehaviourContext> BC.onEditedDocument(
initialFilter: CommonMessageFilter<DocumentContent>? = null, initialFilter: CommonMessageFilter<DocumentContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<DocumentContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, DocumentMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<DocumentContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in DocumentMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<DocumentContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, DocumentMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -421,9 +421,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedDocument(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedPhoto( suspend fun <BC : BehaviourContext> BC.onEditedPhoto(
initialFilter: CommonMessageFilter<PhotoContent>? = null, initialFilter: CommonMessageFilter<PhotoContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<PhotoContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PhotoMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<PhotoContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in PhotoMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<PhotoContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PhotoMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -445,9 +445,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedPhoto(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedSticker( suspend fun <BC : BehaviourContext> BC.onEditedSticker(
initialFilter: CommonMessageFilter<StickerContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<StickerContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<StickerContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, StickerMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<StickerContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in StickerMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<StickerContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, StickerMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -469,9 +469,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedSticker(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedVideo( suspend fun <BC : BehaviourContext> BC.onEditedVideo(
initialFilter: CommonMessageFilter<VideoContent>? = null, initialFilter: CommonMessageFilter<VideoContent>? = null,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VideoMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VideoContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VideoMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VideoMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -493,9 +493,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedVideo(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedVideoNote( suspend fun <BC : BehaviourContext> BC.onEditedVideoNote(
initialFilter: CommonMessageFilter<VideoNoteContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<VideoNoteContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VideoNoteContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VideoNoteMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VideoNoteContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VideoNoteMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VideoNoteContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VideoNoteMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -517,9 +517,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedVideoNote(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedVoice( suspend fun <BC : BehaviourContext> BC.onEditedVoice(
initialFilter: CommonMessageFilter<VoiceContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<VoiceContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<VoiceContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, VoiceMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<VoiceContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in VoiceMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<VoiceContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, VoiceMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,
@@ -541,9 +541,9 @@ suspend fun <BC : BehaviourContext> BC.onEditedVoice(
*/ */
suspend fun <BC : BehaviourContext> BC.onEditedInvoice( suspend fun <BC : BehaviourContext> BC.onEditedInvoice(
initialFilter: CommonMessageFilter<InvoiceContent>? = CommonMessageFilterExcludeMediaGroups, initialFilter: CommonMessageFilter<InvoiceContent>? = CommonMessageFilterExcludeMediaGroups,
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, CommonMessage<InvoiceContent>, Update> = MessageFilterByChat, subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, InvoiceMessage, Update> = MessageFilterByChat,
markerFactory: MarkerFactory<in CommonMessage<InvoiceContent>, Any> = ByChatMessageMarkerFactory, markerFactory: MarkerFactory<in InvoiceMessage, Any> = ByChatMessageMarkerFactory,
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, CommonMessage<InvoiceContent>> scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InvoiceMessage>
)= onEditedContent( )= onEditedContent(
initialFilter, initialFilter,
subcontextUpdatesFilter, subcontextUpdatesFilter,

View File

@@ -1,107 +1,57 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
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" project.description = "Core part of tgbotapi with all (and only) required functionality for working with Telegram Bot API"
apply from: "../publish.gradle" apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
repositories {
mavenLocal()
mavenCentral()
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib') api libs.kotlin.coroutines
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version" api libs.kotlin.serialization
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_runtime_version" api libs.kotlin.serialization.properties
api "org.jetbrains.kotlinx:kotlinx-serialization-properties:$kotlin_serialisation_runtime_version"
api "com.soywiz.korlibs.klock:klock:$korlibs_version" api libs.korlibs.klock
api "com.soywiz.korlibs.krypto:krypto:$korlibs_version" api libs.korlibs.krypto
api "com.benasher44:uuid:$uuid_version" api libs.uuid
api "dev.inmo:micro_utils.coroutines:$micro_utils_version" api libs.microutils.coroutines
api "dev.inmo:micro_utils.serialization.base64:$micro_utils_version" api libs.microutils.serialization.base64
api "dev.inmo:micro_utils.serialization.encapsulator:$micro_utils_version" api libs.microutils.serialization.encapsulator
api "dev.inmo:micro_utils.serialization.typed_serializer:$micro_utils_version" api libs.microutils.serialization.typedSerializer
api "dev.inmo:micro_utils.ktor.common:$micro_utils_version" api libs.microutils.ktor.common
api "dev.inmo:micro_utils.language_codes:$micro_utils_version" api libs.microutils.languageCodes
api "io.ktor:ktor-client-core:$ktor_version" api libs.ktor.client.core
} }
} }
commonTest { commonTest {
dependencies { dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
implementation project(":tgbotapi.utils") implementation project(":tgbotapi.utils")
} }
} }
jvmMain { jvmMain {
dependencies { dependencies {
api "io.ktor:ktor-server:$ktor_version" api libs.ktor.server
api "io.ktor:ktor-server-host-common:$ktor_version" api libs.ktor.server.host.common
api "io.ktor:ktor-client-cio:$ktor_version" api libs.ktor.client.cio
api "javax.activation:activation:$javax_activation_version" api libs.javax.activation
}
}
jvmTest {
dependencies {
implementation kotlin('test-junit')
}
}
jsTest {
dependencies {
implementation kotlin('test-junit')
implementation kotlin('test-js')
} }
} }
} }
targets.all { // targets.all {
compilations.all { // compilations.all {
kotlinOptions { // kotlinOptions {
freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlin.RequiresOptIn"] // freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlin.RequiresOptIn"]
} // }
} // }
} // }
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
} }

View File

@@ -16,6 +16,11 @@ import dev.inmo.tgbotapi.types.message.toRawMessageEntities
import dev.inmo.tgbotapi.utils.extensions.makeString import dev.inmo.tgbotapi.utils.extensions.makeString
import kotlinx.serialization.* import kotlinx.serialization.*
// TODO:: Swap fromChatId and toChatId for more correct order of parameters
const val OrderChangingDeprecationWarn = "The order of parameters in this factory will be changed soon. To avoid unexpected behaviour, swap message id and target chat id parameters"
@Deprecated(OrderChangingDeprecationWarn)
fun CopyMessage( fun CopyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
@@ -27,8 +32,21 @@ fun CopyMessage(
replyToMessageId: MessageIdentifier? = null, replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = CopyMessage(fromChatId, toChatId, messageId, text, parseMode, null, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup) ) = CopyMessage(
toChatId,
fromChatId,
messageId,
text,
parseMode,
null,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
@Deprecated(OrderChangingDeprecationWarn)
fun CopyMessage( fun CopyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
@@ -40,8 +58,57 @@ fun CopyMessage(
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = CopyMessage( ) = CopyMessage(
fromChatId,
toChatId, toChatId,
fromChatId,
messageId,
entities.makeString(),
null,
entities.toRawMessageEntities(),
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
fun CopyMessage(
fromChatId: ChatIdentifier,
messageId: MessageIdentifier,
toChatId: ChatIdentifier,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
fromChatId,
messageId,
text,
parseMode,
null,
disableNotification,
protectContent,
replyToMessageId,
allowSendingWithoutReply,
replyMarkup
)
fun CopyMessage(
fromChatId: ChatIdentifier,
messageId: MessageIdentifier,
toChatId: ChatIdentifier,
entities: List<TextSource>,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = CopyMessage(
toChatId,
fromChatId,
messageId, messageId,
entities.makeString(), entities.makeString(),
null, null,
@@ -55,10 +122,10 @@ fun CopyMessage(
@Serializable @Serializable
data class CopyMessage internal constructor( data class CopyMessage internal constructor(
@SerialName(fromChatIdField)
val fromChatId: ChatIdentifier,
@SerialName(chatIdField) @SerialName(chatIdField)
val toChatId: ChatIdentifier, val toChatId: ChatIdentifier,
@SerialName(fromChatIdField)
val fromChatId: ChatIdentifier,
@SerialName(messageIdField) @SerialName(messageIdField)
override val messageId: MessageIdentifier, override val messageId: MessageIdentifier,
@SerialName(captionField) @SerialName(captionField)

View File

@@ -11,6 +11,8 @@ import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.JsonPrimitive import kotlinx.serialization.json.JsonPrimitive
import kotlinx.serialization.json.longOrNull import kotlinx.serialization.json.longOrNull
const val internalLinkBeginning = "https://t.me"
@Serializable(ChatIdentifierSerializer::class) @Serializable(ChatIdentifierSerializer::class)
sealed class ChatIdentifier sealed class ChatIdentifier
@@ -26,16 +28,29 @@ data class ChatId(
* https://core.telegram.org/bots/api#formatting-options * https://core.telegram.org/bots/api#formatting-options
*/ */
@Warning("This API have restrictions in Telegram System") @Warning("This API have restrictions in Telegram System")
val Identifier.link: String val Identifier.userLink: String
get() = "tg://user?id=$this" get() = "tg://user?id=$this"
/** /**
* https://core.telegram.org/bots/api#formatting-options * https://core.telegram.org/bots/api#formatting-options
*/ */
@Warning("This API have restrictions in Telegram System") @Warning("This API have restrictions in Telegram System")
val UserId.link: String val UserId.userLink: String
get() = chatId.link get() = chatId.userLink
val User.link: String val User.link: String
get() = id.link get() = id.userLink
/**
* https://core.telegram.org/bots/api#formatting-options
*/
@Deprecated("Renamed", ReplaceWith("userLink", "dev.inmo.tgbotapi.types.userLink"))
val Identifier.link: String
get() = "tg://user?id=$this"
/**
* https://core.telegram.org/bots/api#formatting-options
*/
@Deprecated("Renamed", ReplaceWith("userLink", "dev.inmo.tgbotapi.types.userLink"))
val ChatId.link: String
get() = chatId.link
typealias UserId = ChatId typealias UserId = ChatId

View File

@@ -415,6 +415,7 @@ const val mediaField = "media"
const val disableEditMessageField = "disable_edit_message" const val disableEditMessageField = "disable_edit_message"
const val scoreField = "score" const val scoreField = "score"
const val forceField = "force" const val forceField = "force"
const val forceReplyField = "force_reply"
const val regularPollType = "regular" const val regularPollType = "regular"
const val quizPollType = "quiz" const val quizPollType = "quiz"

View File

@@ -1,7 +1,6 @@
package dev.inmo.tgbotapi.types.buttons package dev.inmo.tgbotapi.types.buttons
import dev.inmo.tgbotapi.types.inputFieldPlaceholderField import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.inputFieldPlaceholderLimit
import kotlinx.serialization.* import kotlinx.serialization.*
@Serializable @Serializable
@@ -10,13 +9,24 @@ data class ReplyForce(
@SerialName(inputFieldPlaceholderField) @SerialName(inputFieldPlaceholderField)
val inputFieldPlaceholder: String? = null val inputFieldPlaceholder: String? = null
) : KeyboardMarkup { ) : KeyboardMarkup {
@SerialName("force_reply") @SerialName(forceReplyField)
@Required @Required
val forceReply: Boolean = true val forceReply: Boolean = true
companion object { companion object {
val ReplyForceSelective = ReplyForce(true) fun Selective(inputFieldPlaceholder: String? = null) = ReplyForce(true, inputFieldPlaceholder)
val ReplyForceNonSelective = ReplyForce(false) fun NonSelective(inputFieldPlaceholder: String? = null) = ReplyForce(false, inputFieldPlaceholder)
val Selective = Selective()
val NonSelective = NonSelective()
val Default = ReplyForce()
@Deprecated("Renamed", ReplaceWith("ReplyForce.Selective"))
inline val ReplyForceSelective
get() = Selective
@Deprecated("Renamed", ReplaceWith("ReplyForce.NonSelective"))
inline val ReplyForceNonSelective
get() = NonSelective
@Deprecated("Renamed", ReplaceWith("ReplyForce.Default"))
val ReplyForceDefault = ReplyForce() val ReplyForceDefault = ReplyForce()
} }

View File

@@ -18,7 +18,7 @@ data class ChatJoinRequest(
@SerialName(dateField) @SerialName(dateField)
val date: TelegramDate, val date: TelegramDate,
@SerialName(inviteLinkField) @SerialName(inviteLinkField)
val inviteLink: ChatInviteLink, val inviteLink: ChatInviteLink? = null,
@SerialName(bioField) @SerialName(bioField)
val bio: String? = null val bio: String? = null
) : FromUser { ) : FromUser {

View File

@@ -22,7 +22,7 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
override fun deserialize(decoder: Decoder): ChatMember { override fun deserialize(decoder: Decoder): ChatMember {
val json = JsonObject.serializer().deserialize(decoder) val json = JsonObject.serializer().deserialize(decoder)
return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) { return when (json[statusField] ?.jsonPrimitive ?.content ?: error("Status field of chat member must be specified, but incoming json contains next: $json")) {
"creator" -> nonstrictJsonFormat.decodeFromJsonElement(CreatorChatMember.serializer(), json) "creator" -> nonstrictJsonFormat.decodeFromJsonElement(OwnerChatMember.serializer(), json)
"administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json) "administrator" -> nonstrictJsonFormat.decodeFromJsonElement(AdministratorChatMemberImpl.serializer(), json)
"member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMemberImpl.serializer(), json) "member" -> nonstrictJsonFormat.decodeFromJsonElement(MemberChatMemberImpl.serializer(), json)
"restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json) "restricted" -> nonstrictJsonFormat.decodeFromJsonElement(RestrictedChatMember.serializer(), json)
@@ -34,7 +34,7 @@ object ChatMemberSerializer : KSerializer<ChatMember> {
override fun serialize(encoder: Encoder, value: ChatMember) { override fun serialize(encoder: Encoder, value: ChatMember) {
when (value) { when (value) {
is CreatorChatMember -> CreatorChatMember.serializer() is OwnerChatMember -> OwnerChatMember.serializer()
is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer() is AdministratorChatMemberImpl -> AdministratorChatMemberImpl.serializer()
is MemberChatMember -> MemberChatMemberImpl.serializer() is MemberChatMember -> MemberChatMemberImpl.serializer()
is RestrictedChatMember -> RestrictedChatMember.serializer() is RestrictedChatMember -> RestrictedChatMember.serializer()

View File

@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.types.chat.User
import kotlinx.serialization.* import kotlinx.serialization.*
@Serializable @Serializable
data class CreatorChatMember( data class OwnerChatMember(
override val user: User, override val user: User,
@SerialName(isAnonymousField) @SerialName(isAnonymousField)
override val isAnonymous: Boolean = false, override val isAnonymous: Boolean = false,
@@ -38,3 +38,6 @@ data class CreatorChatMember(
@Required @Required
private val type: String = "creator" private val type: String = "creator"
} }
@Deprecated("Renamed", ReplaceWith("OwnerChatMember", "dev.inmo.tgbotapi.types.chat.member.OwnerChatMember"))
typealias CreatorChatMember = OwnerChatMember

View File

@@ -0,0 +1,33 @@
package dev.inmo.tgbotapi.types.message.content
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
typealias InvoiceMessage = CommonMessage<InvoiceContent>
typealias VenueMessage = CommonMessage<VenueContent>
typealias GameMessage = CommonMessage<GameContent>
typealias DiceMessage = CommonMessage<DiceContent>
typealias ContactMessage = CommonMessage<ContactContent>
typealias PollMessage = CommonMessage<PollContent>
typealias TextMessage = CommonMessage<TextContent>
typealias LocationMessage = CommonMessage<LocationContent>
typealias LiveLocationMessage = CommonMessage<LiveLocationContent>
typealias StaticLocationMessage = CommonMessage<StaticLocationContent>
typealias MediaCollectionMessage<T> = CommonMessage<MediaCollectionContent<T>>
typealias MediaMessage = CommonMessage<MediaContent>
typealias VideoNoteMessage = CommonMessage<VideoNoteContent>
typealias StickerMessage = CommonMessage<StickerContent>
typealias TextedMediaMessage = CommonMessage<TextedMediaContent>
typealias VoiceMessage = CommonMessage<VoiceContent>
typealias MediaGroupMessage = CommonMessage<MediaGroupContent>
typealias AudioMediaGroupMessage = CommonMessage<AudioMediaGroupContent>
typealias AudioMessage = CommonMessage<AudioContent>
typealias DocumentMediaGroupMessage = CommonMessage<DocumentMediaGroupContent>
typealias DocumentMessage = CommonMessage<DocumentContent>
typealias VisualMediaGroupMessage = CommonMessage<VisualMediaGroupContent>
typealias VideoMessage = CommonMessage<VideoContent>
typealias PhotoMessage = CommonMessage<PhotoContent>
typealias AnimationMessage = CommonMessage<AnimationContent>

View File

@@ -28,7 +28,7 @@ class ChatIdentifierTests {
@Test @Test
fun `Creating_link_from_ChatId_is_correct`() { fun `Creating_link_from_ChatId_is_correct`() {
val chatId = chatIdentifierChatId.toChatId() val chatId = chatIdentifierChatId.toChatId()
assertEquals(chatIdentifierLink, chatId.link) assertEquals(chatIdentifierLink, chatId.userLink)
} }
@Test @Test

View File

@@ -1,73 +1,19 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
project.version = "$library_version"
project.group = "$library_group"
project.description = "Additional extensions for core part of tgbotapi" project.description = "Additional extensions for core part of tgbotapi"
apply from: "../publish.gradle" apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
repositories {
mavenLocal()
mavenCentral()
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib')
api project(":tgbotapi.core") api project(":tgbotapi.core")
} }
} }
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmTest {
dependencies {
implementation kotlin('test-junit')
}
}
jsTest {
dependencies {
implementation kotlin('test-junit')
implementation kotlin('test-js')
}
}
} }
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -46,6 +46,7 @@ import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMember
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.* import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.* import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
import dev.inmo.tgbotapi.types.message.abstracts.* import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
import dev.inmo.tgbotapi.types.message.content.* import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.content.AudioMediaGroupContent import dev.inmo.tgbotapi.types.message.content.AudioMediaGroupContent
import dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupContent import dev.inmo.tgbotapi.types.message.content.DocumentMediaGroupContent
@@ -1828,14 +1829,26 @@ inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryR
this as InlineQueryResultVoiceCommon this as InlineQueryResultVoiceCommon
@PreviewFeature @PreviewFeature
@Deprecated("Renamed", ReplaceWith("whenOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.whenOwnerChatMember"))
inline fun <T> ChatMember.whenCreatorChatMember(block: (CreatorChatMember) -> T) = asCreatorChatMember() ?.let(block) inline fun <T> ChatMember.whenCreatorChatMember(block: (CreatorChatMember) -> T) = asCreatorChatMember() ?.let(block)
@PreviewFeature @PreviewFeature
@Deprecated("Renamed", ReplaceWith("asOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.asOwnerChatMember"))
inline fun ChatMember.asCreatorChatMember(): CreatorChatMember? = this as? CreatorChatMember inline fun ChatMember.asCreatorChatMember(): CreatorChatMember? = this as? CreatorChatMember
@PreviewFeature @PreviewFeature
@Deprecated("Renamed", ReplaceWith("requireOwnerChatMember", "dev.inmo.tgbotapi.extensions.utils.requireOwnerChatMember"))
inline fun ChatMember.requireCreatorChatMember(): CreatorChatMember = this as CreatorChatMember inline fun ChatMember.requireCreatorChatMember(): CreatorChatMember = this as CreatorChatMember
@PreviewFeature
inline fun <T> ChatMember.whenOwnerChatMember(block: (OwnerChatMember) -> T) = asOwnerChatMember() ?.let(block)
@PreviewFeature
inline fun ChatMember.asOwnerChatMember(): OwnerChatMember? = this as? OwnerChatMember
@PreviewFeature
inline fun ChatMember.requireOwnerChatMember(): OwnerChatMember = this as OwnerChatMember
@PreviewFeature @PreviewFeature
inline fun <T> ChatMember.whenKickedChatMember(block: (KickedChatMember) -> T) = asKickedChatMember() ?.let(block) inline fun <T> ChatMember.whenKickedChatMember(block: (KickedChatMember) -> T) = asKickedChatMember() ?.let(block)

View File

@@ -0,0 +1,42 @@
@file:Suppress("UNCHECKED_CAST")
package dev.inmo.tgbotapi.extensions.utils
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.content.MessageContent
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
inline fun <reified T : MessageContent> ContentMessage<*>.withContentOrNull() = if (content is T) { this as ContentMessage<T> } else { null }
inline fun <reified T : MessageContent> ContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> CommonMessage<*>.withContentOrNull() = if (content is T) { this as CommonMessage<T> } else { null }
inline fun <reified T : MessageContent> CommonMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> PossiblySentViaBotCommonMessage<*>.withContentOrNull() = if (content is T) { this as PossiblySentViaBotCommonMessage<T>
} else { null }
inline fun <reified T : MessageContent> PossiblySentViaBotCommonMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> ChannelContentMessage<*>.withContentOrNull() = if (content is T) { this as ChannelContentMessage<T> } else { null }
inline fun <reified T : MessageContent> ChannelContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> PrivateContentMessage<*>.withContentOrNull() = if (content is T) { this as PrivateContentMessage<T> } else { null }
inline fun <reified T : MessageContent> PrivateContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> PublicContentMessage<*>.withContentOrNull() = if (content is T) { this as PublicContentMessage<T> } else { null }
inline fun <reified T : MessageContent> PublicContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> GroupContentMessage<*>.withContentOrNull() = if (content is T) { this as GroupContentMessage<T> } else { null }
inline fun <reified T : MessageContent> GroupContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> FromChannelGroupContentMessage<*>.withContentOrNull() = if (content is T) { this as FromChannelGroupContentMessage<T> } else { null }
inline fun <reified T : MessageContent> FromChannelGroupContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> AnonymousGroupContentMessage<*>.withContentOrNull() = if (content is T) { this as AnonymousGroupContentMessage<T> } else { null }
inline fun <reified T : MessageContent> AnonymousGroupContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MessageContent> CommonGroupContentMessage<*>.withContentOrNull() = if (content is T) { this as CommonGroupContentMessage<T> } else { null }
inline fun <reified T : MessageContent> CommonGroupContentMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!
inline fun <reified T : MediaGroupContent> MediaGroupMessage<*>.withContentOrNull() = if (content is T) { this as MediaGroupMessage<T> } else { null }
inline fun <reified T : MediaGroupContent> MediaGroupMessage<*>.withContentOrThrow() = withContentOrNull<T>()!!

View File

@@ -0,0 +1,16 @@
package dev.inmo.tgbotapi.extensions.utils.extensions
import dev.inmo.tgbotapi.types.message.abstracts.Message
/**
* @return true in case if [this] message is placed in the same chat that [other]
*/
@Suppress("NOTHING_TO_INLINE")
inline fun Message.sameChat(other: Message) = chat.id == other.chat.id
/**
* @return true in case if [this] message is the same as [other]. The same here means that these messages from one chat
* and have equal [Message.messageId] identifier
*/
@Suppress("NOTHING_TO_INLINE")
inline fun Message.sameMessage(other: Message) = sameChat(other) && messageId == other.messageId

View File

@@ -5,5 +5,5 @@ import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
@RiskFeature(RawFieldsUsageWarning) @RiskFeature(RawFieldsUsageWarning)
val ChatJoinRequest.invite_link: ChatInviteLink val ChatJoinRequest.invite_link: ChatInviteLink?
get() = inviteLink get() = inviteLink

View File

@@ -5,8 +5,6 @@ import dev.inmo.tgbotapi.types.message.textsources.link
import dev.inmo.tgbotapi.types.chat.* import dev.inmo.tgbotapi.types.chat.*
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
private const val internalLinkBeginning = "https://t.me"
fun makeUsernameLink(username: String) = "$internalLinkBeginning/$username" fun makeUsernameLink(username: String) = "$internalLinkBeginning/$username"
fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start=" fun makeUsernameDeepLinkPrefix(username: String) = "${makeUsernameLink(username)}?start="
inline val Username.link inline val Username.link
@@ -73,7 +71,7 @@ val Message.link: String?
val Chat.link: String? val Chat.link: String?
get() { get() {
if (this is UsernameChat) { if (this is UsernameChat) {
username ?.username ?.let { return it } username ?.link
} }
if (this is ExtendedPublicChat) { if (this is ExtendedPublicChat) {
inviteLink ?.let { return it } inviteLink ?.let { return it }

View File

@@ -40,6 +40,16 @@ inline fun inlineKeyboard(
block: InlineKeyboardBuilder.() -> Unit block: InlineKeyboardBuilder.() -> Unit
) = InlineKeyboardBuilder().apply(block).build() ) = InlineKeyboardBuilder().apply(block).build()
/**
* Factory-function for [InlineKeyboardBuilder], but in difference with [inlineKeyboard] this function will create single-row
* inline keyboard
*
* @see InlineKeyboardBuilder.row
*/
inline fun flatInlineKeyboard(
block: InlineKeyboardRowBuilder.() -> Unit
) = inlineKeyboard { row(block) }
/** /**
* Creates an [InlineKeyboardRowBuilder] and [apply] [block] with this builder * Creates an [InlineKeyboardRowBuilder] and [apply] [block] with this builder
* *

View File

@@ -47,6 +47,20 @@ inline fun replyKeyboard(
block: ReplyKeyboardBuilder.() -> Unit block: ReplyKeyboardBuilder.() -> Unit
) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective) ) = ReplyKeyboardBuilder().apply(block).build(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective)
/**
* Factory-function for [ReplyKeyboardBuilder], but in difference with [replyKeyboard] this method will create single-row
* keyboard
*/
inline fun flatReplyKeyboard(
resizeKeyboard: Boolean? = null,
oneTimeKeyboard: Boolean? = null,
inputFieldPlaceholder: String? = null,
selective: Boolean? = null,
block: ReplyKeyboardRowBuilder.() -> Unit
) = replyKeyboard(resizeKeyboard, oneTimeKeyboard, inputFieldPlaceholder, selective) {
row(block)
}
/** /**
* Creates an [ReplyKeyboardRowBuilder] and [apply] [block] with this builder * Creates an [ReplyKeyboardRowBuilder] and [apply] [block] with this builder
* *

View File

@@ -1,56 +1,19 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
project.version = "$library_version"
project.group = "$library_group"
project.description = "Web App bindings for the Telegram Web Apps API" project.description = "Web App bindings for the Telegram Web Apps API"
apply from: "../publish.gradle" apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
repositories {
mavenLocal()
mavenCentral()
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib')
api project(":tgbotapi.core") api project(":tgbotapi.core")
} }
} }
} }
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@@ -1,48 +1,17 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
}
}
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization" id "org.jetbrains.kotlin.plugin.serialization"
} }
project.version = "$library_version"
project.group = "$library_group"
project.description = "Full collection of all built-in tgbotapi tools" project.description = "Full collection of all built-in tgbotapi tools"
apply from: "../publish.gradle" apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
repositories {
mavenLocal()
mavenCentral()
}
kotlin { kotlin {
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
implementation kotlin('stdlib')
api project(":tgbotapi.core") api project(":tgbotapi.core")
api project(":tgbotapi.api") api project(":tgbotapi.api")
api project(":tgbotapi.utils") api project(":tgbotapi.utils")
@@ -52,9 +21,3 @@ kotlin {
} }
} }
} }
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}