mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-12-27 16:39:20 +00:00
Compare commits
62 Commits
9.3.0
...
95011e2b3e
| Author | SHA1 | Date | |
|---|---|---|---|
| 95011e2b3e | |||
| cad0bf8a95 | |||
| f760e60089 | |||
| 6c76e1c47a | |||
| b5f4219635 | |||
| 5190f7b856 | |||
| 14756fd6e8 | |||
| e66537ee32 | |||
| 825ecc1d73 | |||
| 05bfbfe381 | |||
| 430240a6ad | |||
| 860e35258c | |||
| d9c39d7a26 | |||
| 52fd55eea5 | |||
| cb11532b58 | |||
| dce63713f9 | |||
| fb9ff653ef | |||
| 57f53813c8 | |||
| fc183bfd2f | |||
| c025a027c6 | |||
| db2101d85c | |||
| a01a9910b5 | |||
| 4e1ecc0e34 | |||
| 90225a9380 | |||
| 3026c8708d | |||
| 63975cc88e | |||
| a622c4d6fa | |||
| e124bb18df | |||
| 152728afca | |||
| 38d672b665 | |||
| d2c299301a | |||
| 25fb6b2b46 | |||
| 5b5de5253c | |||
| 9a7dd6ec9a | |||
| 4085f721be | |||
| ffc915cae1 | |||
| a6c90b3df5 | |||
| a6d9fa6ce3 | |||
| 7fd2442f8b | |||
| 8b37ecea9e | |||
| 35fc9f60df | |||
| 68e89dc1ad | |||
| 129fb31b74 | |||
| a2c353ca41 | |||
| cb74abfce5 | |||
| ca7314923e | |||
| 74f625a53a | |||
| 3a5fed3dd9 | |||
| 6158143220 | |||
| f8182ddb85 | |||
| b7c3f9f607 | |||
| 8763ea23fa | |||
| b412e7b3b7 | |||
| 98e5d182bb | |||
| ffc0f5abb7 | |||
| 816cf00dac | |||
| e34bc7453e | |||
| 3b2ccbf33b | |||
| 6ecfbdf56d | |||
| b49e1c50f5 | |||
| d7389dfcfe | |||
| cf5cee3e53 |
3
.github/workflows/greetings.yml
vendored
3
.github/workflows/greetings.yml
vendored
@@ -5,6 +5,9 @@ on: [pull_request, issues]
|
|||||||
jobs:
|
jobs:
|
||||||
greeting:
|
greeting:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/first-interaction@v1
|
- uses: actions/first-interaction@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
5
.github/workflows/packages_publishing.yml
vendored
5
.github/workflows/packages_publishing.yml
vendored
@@ -22,9 +22,10 @@ jobs:
|
|||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
- name: Publish to Gitea
|
- name: Publish to Gitea
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToGiteaRepository
|
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
INMONEXUS_USER: ${{ secrets.INMONEXUS_USER }}
|
||||||
|
INMONEXUS_PASSWORD: ${{ secrets.INMONEXUS_PASSWORD }}
|
||||||
- name: Publish to GithubPackages
|
- name: Publish to GithubPackages
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
||||||
|
|||||||
34
CHANGELOG.md
34
CHANGELOG.md
@@ -1,5 +1,39 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 10.0.0
|
||||||
|
|
||||||
|
**IN THIS UPDATE KLOCK DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-time` UP TO 5.3.0 VERSION**
|
||||||
|
|
||||||
|
**IN THIS UPDATE KRYPTO DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-crypto` UP TO 5.3.0 VERSION**
|
||||||
|
|
||||||
|
## 9.4.3
|
||||||
|
|
||||||
|
**IetfLanguageCode has been renamed to IetfLang in MicroUtils**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `1.9.21` -> `1.9.22`
|
||||||
|
* `MicroUtils`: `0.20.19` -> `0.20.23`
|
||||||
|
|
||||||
|
## 9.4.2
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Serialization`: `1.6.1` -> `1.6.2`
|
||||||
|
* `Ktor`: `2.3.6` -> `2.3.7`
|
||||||
|
* `MicroUtils`: `0.20.15` -> `0.20.19`
|
||||||
|
* `UUID`: `0.8.1` -> `0.8.2`
|
||||||
|
|
||||||
|
## 9.4.1
|
||||||
|
|
||||||
|
* Replace warning about two bots from `LongPolling` to `DefaultKtorRequestsExecutor`
|
||||||
|
|
||||||
|
## 9.4.0
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `1.9.20` -> `1.9.21`
|
||||||
|
* `Serialization`: `1.6.0` -> `1.6.1`
|
||||||
|
* `Ktor`: `2.3.5` -> `2.3.6`
|
||||||
|
* `MicroUtils`: `0.20.12` -> `0.20.15`
|
||||||
|
|
||||||
## 9.3.0
|
## 9.3.0
|
||||||
|
|
||||||
This release become possible thanks to [Anton Lakotka](https://youtrack.jetbrains.com/users/anton.lakotka)
|
This release become possible thanks to [Anton Lakotka](https://youtrack.jetbrains.com/users/anton.lakotka)
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ buildscript {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.dokka)
|
alias(libs.plugins.kotlin.dokka)
|
||||||
|
alias(libs.plugins.versions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
@@ -24,7 +25,7 @@ allprojects {
|
|||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
|
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
||||||
}
|
}
|
||||||
if (it != rootProject.findProject("docs")) {
|
if (it != rootProject.findProject("docs")) {
|
||||||
tasks.whenTaskAdded { task ->
|
tasks.whenTaskAdded { task ->
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=9.3.0
|
library_version=10.0.0
|
||||||
|
|||||||
@@ -1,19 +1,22 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "1.9.20"
|
kotlin = "1.9.22"
|
||||||
kotlin-serialization = "1.6.0"
|
kotlin-serialization = "1.6.2"
|
||||||
kotlin-coroutines = "1.7.3"
|
kotlin-coroutines = "1.7.3"
|
||||||
|
|
||||||
javax-activation = "1.1.1"
|
javax-activation = "1.1.1"
|
||||||
|
|
||||||
korlibs = "4.0.10"
|
korlibs = "5.3.0"
|
||||||
uuid = "0.8.1"
|
uuid = "0.8.2"
|
||||||
ktor = "2.3.5"
|
ktor = "2.3.7"
|
||||||
|
|
||||||
ksp = "1.9.20-1.0.14"
|
ksp = "1.9.22-1.0.16"
|
||||||
kotlin-poet = "1.14.2"
|
kotlin-poet = "1.15.3"
|
||||||
|
|
||||||
microutils = "0.20.12"
|
microutils = "0.20.25"
|
||||||
|
kslog = "1.3.1"
|
||||||
|
|
||||||
|
versions = "0.50.0"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
github-release-plugin = "2.4.1"
|
||||||
dokka = "1.9.10"
|
dokka = "1.9.10"
|
||||||
@@ -38,11 +41,12 @@ ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.
|
|||||||
|
|
||||||
javax-activation = { module = "javax.activation:activation", version.ref = "javax-activation" }
|
javax-activation = { module = "javax.activation:activation", version.ref = "javax-activation" }
|
||||||
|
|
||||||
korlibs-klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "korlibs" }
|
korlibs-klock = { module = "com.soywiz.korge:korlibs-time", version.ref = "korlibs" }
|
||||||
korlibs-krypto = { module = "com.soywiz.korlibs.krypto:krypto", version.ref = "korlibs" }
|
korlibs-krypto = { module = "com.soywiz.korge:korlibs-crypto", version.ref = "korlibs" }
|
||||||
|
|
||||||
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
|
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
|
||||||
|
|
||||||
|
microutils-colors-common = { module = "dev.inmo:micro_utils.colors.common", version.ref = "microutils" }
|
||||||
microutils-coroutines = { module = "dev.inmo:micro_utils.coroutines", version.ref = "microutils" }
|
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-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-encapsulator = { module = "dev.inmo:micro_utils.serialization.encapsulator", version.ref = "microutils" }
|
||||||
@@ -52,6 +56,8 @@ microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", ver
|
|||||||
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", 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" }
|
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
||||||
|
|
||||||
|
kslog = { module = "dev.inmo:kslog", version.ref = "kslog" }
|
||||||
|
|
||||||
# ksp dependencies
|
# ksp dependencies
|
||||||
|
|
||||||
kotlin-poet = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlin-poet" }
|
kotlin-poet = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlin-poet" }
|
||||||
@@ -71,3 +77,4 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|||||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||||
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
|
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
|||||||
@@ -50,18 +50,14 @@ publishing {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
|
if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) {
|
||||||
maven {
|
maven {
|
||||||
name = "Gitea"
|
name = "InmoNexus"
|
||||||
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
|
||||||
|
|
||||||
credentials(HttpHeaderCredentials) {
|
credentials {
|
||||||
name = "Authorization"
|
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
|
||||||
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
|
||||||
}
|
|
||||||
|
|
||||||
authentication {
|
|
||||||
header(HttpHeaderAuthentication)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -102,4 +98,21 @@ if (project.hasProperty("signing.gnupg.keyName")) {
|
|||||||
def signingTasks = project.getTasks().withType(Sign.class)
|
def signingTasks = project.getTasks().withType(Sign.class)
|
||||||
mustRunAfter(signingTasks)
|
mustRunAfter(signingTasks)
|
||||||
}
|
}
|
||||||
|
// Workaround to make test tasks use sign
|
||||||
|
project.getTasks().withType(Sign.class).configureEach { signTask ->
|
||||||
|
def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name)
|
||||||
|
def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign
|
||||||
|
// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets
|
||||||
|
|
||||||
|
// Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
|
||||||
|
def debugTestTask = tasks.findByName("linkDebugTest$pubName")
|
||||||
|
if (debugTestTask != null) {
|
||||||
|
signTask.mustRunAfter(debugTestTask)
|
||||||
|
}
|
||||||
|
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
|
||||||
|
def testTask = tasks.findByName("compileTestKotlin$pubName")
|
||||||
|
if (testTask != null) {
|
||||||
|
signTask.mustRunAfter(testTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -6,9 +6,8 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -23,7 +22,7 @@ suspend fun TelegramBot.deleteMessage(
|
|||||||
) = deleteMessage(chat.id, messageId)
|
) = deleteMessage(chat.id, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
message: Message
|
message: AccessibleMessage
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
||||||
if (mediaGroupContent == null) {
|
if (mediaGroupContent == null) {
|
||||||
@@ -46,9 +45,9 @@ suspend fun TelegramBot.delete(
|
|||||||
) = deleteMessage(chat, messageId)
|
) = deleteMessage(chat, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
suspend fun TelegramBot.delete(
|
||||||
message: Message
|
message: AccessibleMessage
|
||||||
) = deleteMessage(message)
|
) = deleteMessage(message)
|
||||||
|
|
||||||
suspend fun Message.delete(
|
suspend fun AccessibleMessage.delete(
|
||||||
requestsExecutor: TelegramBot
|
requestsExecutor: TelegramBot
|
||||||
) = requestsExecutor.deleteMessage(this)
|
) = requestsExecutor.deleteMessage(this)
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.DeleteMessages
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteMessages(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageIds: List<MessageId>
|
||||||
|
) = messageIds.chunked(deleteMessagesLimit.last).map {
|
||||||
|
execute(
|
||||||
|
DeleteMessages(
|
||||||
|
chatId = chatId,
|
||||||
|
messageIds = it
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}.all { it }
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteMessages(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageIds: Array<MessageId>
|
||||||
|
) = deleteMessages(
|
||||||
|
chatId = chatId,
|
||||||
|
messageIds = messageIds.toList()
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteMessages(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId
|
||||||
|
) = deleteMessages(
|
||||||
|
chatId = chatId,
|
||||||
|
messageIds = (listOf(firstMessageId) + messageIds.toList())
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteMessages(
|
||||||
|
messages: List<AccessibleMessage>
|
||||||
|
) = messages.groupBy { it.chat }.map { (chat, messages) ->
|
||||||
|
deleteMessages(
|
||||||
|
chatId = chat.id,
|
||||||
|
messageIds = messages.map { it.messageId }
|
||||||
|
)
|
||||||
|
}.all { it }
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageIds: List<MessageId>
|
||||||
|
) = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageIds: Array<MessageId>
|
||||||
|
) = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
secondMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId
|
||||||
|
) = deleteMessages(chatId = chatId, messageIds = (listOf(firstMessageId, secondMessageId) + messageIds.toList()))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
messages: List<AccessibleMessage>
|
||||||
|
) = deleteMessages(messages)
|
||||||
@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.threadId
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
@@ -49,7 +49,7 @@ suspend fun TelegramBot.forwardMessage(
|
|||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
@@ -57,7 +57,7 @@ suspend fun TelegramBot.forwardMessage(
|
|||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
|
|||||||
@@ -0,0 +1,156 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.ForwardMessages
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forwardMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: List<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = messageIds.chunked(forwardMessagesLimit.last).flatMap {
|
||||||
|
execute(
|
||||||
|
ForwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = it,
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forwardMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: Array<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = messageIds.toList(),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forwardMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = (listOf(firstMessageId) + messageIds.toList()),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forwardMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
messages: List<AccessibleMessage>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = messages.groupBy { it.chat }.flatMap { (chat, messages) ->
|
||||||
|
forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = chat.id,
|
||||||
|
messageIds = messages.map { it.messageId },
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forward(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: List<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = messageIds,
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forward(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: Array<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = messageIds,
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forward(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
firstMessageId = firstMessageId,
|
||||||
|
messageIds = *messageIds,
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forward(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
messages: List<AccessibleMessage>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
messages = messages,
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
@@ -2,38 +2,24 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
|
|
||||||
import korlibs.time.DateTime
|
import korlibs.time.DateTime
|
||||||
import korlibs.time.TimeSpan
|
import korlibs.time.TimeSpan
|
||||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
|
||||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
|
||||||
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
|
||||||
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
import io.ktor.utils.io.core.Closeable
|
import io.ktor.utils.io.core.Closeable
|
||||||
|
import korlibs.time.millisecondsLong
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.CoroutineStart
|
|
||||||
import kotlinx.coroutines.currentCoroutineContext
|
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
import kotlinx.coroutines.flow.map
|
|
||||||
import kotlinx.coroutines.isActive
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.js.JsName
|
|
||||||
import kotlin.jvm.JvmName
|
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
||||||
@@ -252,7 +238,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
@@ -287,7 +273,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.StopPoll
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -35,7 +35,7 @@ suspend fun TelegramBot.stopPoll(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
suspend fun TelegramBot.stopPoll(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chatId, message.messageId, replyMarkup)
|
) = stopPoll(chatId, message.messageId, replyMarkup)
|
||||||
|
|
||||||
@@ -45,6 +45,6 @@ suspend fun TelegramBot.stopPoll(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
suspend fun TelegramBot.stopPoll(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
|
import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||||
@@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
|
|
||||||
suspend fun TelegramBot.deleteMyCommands(
|
suspend fun TelegramBot.deleteMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode?
|
languageCode: IetfLang?
|
||||||
) = execute(DeleteMyCommands(scope, languageCode))
|
) = execute(DeleteMyCommands(scope, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMyCommands(
|
suspend fun TelegramBot.deleteMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String? = null
|
languageCode: String? = null
|
||||||
) = deleteMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
) = deleteMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||||
@@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
|
|
||||||
suspend fun TelegramBot.getMyCommands(
|
suspend fun TelegramBot.getMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(GetMyCommands(scope, languageCode))
|
) = execute(GetMyCommands(scope, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyCommands(
|
suspend fun TelegramBot.getMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = getMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
) = getMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyDescription(
|
suspend fun TelegramBot.getMyDescription(
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(GetMyDescription(languageCode))
|
) = execute(GetMyDescription(languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyDescription(
|
suspend fun TelegramBot.getMyDescription(
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = getMyDescription(languageCode ?.let(::IetfLanguageCode))
|
) = getMyDescription(languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyName(
|
suspend fun TelegramBot.getMyName(
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(GetMyName(languageCode))
|
) = execute(GetMyName(languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyName(
|
suspend fun TelegramBot.getMyName(
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = getMyName(languageCode ?.let(::IetfLanguageCode))
|
) = getMyName(languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
|
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
|
||||||
@@ -8,9 +8,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
|||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyShortDescription(
|
suspend fun TelegramBot.getMyShortDescription(
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(GetMyShortDescription(languageCode))
|
) = execute(GetMyShortDescription(languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyShortDescription(
|
suspend fun TelegramBot.getMyShortDescription(
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = getMyShortDescription(languageCode ?.let(::IetfLanguageCode))
|
) = getMyShortDescription(languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.tgbotapi.types.BotCommand
|
||||||
@@ -10,20 +10,20 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
commands: List<BotCommand>,
|
commands: List<BotCommand>,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode?
|
languageCode: IetfLang?
|
||||||
) = execute(SetMyCommands(commands, scope, languageCode))
|
) = execute(SetMyCommands(commands, scope, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
vararg commands: BotCommand,
|
vararg commands: BotCommand,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode?
|
languageCode: IetfLang?
|
||||||
) = setMyCommands(commands.toList(), scope, languageCode)
|
) = setMyCommands(commands.toList(), scope, languageCode)
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
commands: List<BotCommand>,
|
commands: List<BotCommand>,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String? = null
|
languageCode: String? = null
|
||||||
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLanguageCode))
|
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
vararg commands: BotCommand,
|
vararg commands: BotCommand,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||||
@@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
|
|
||||||
suspend fun TelegramBot.setMyDescription(
|
suspend fun TelegramBot.setMyDescription(
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(SetMyDescription(description, languageCode))
|
) = execute(SetMyDescription(description, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyDescription(
|
suspend fun TelegramBot.setMyDescription(
|
||||||
description: String?,
|
description: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = setMyDescription(description, languageCode ?.let(::IetfLanguageCode))
|
) = setMyDescription(description, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
||||||
@@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
|
|
||||||
suspend fun TelegramBot.setMyName(
|
suspend fun TelegramBot.setMyName(
|
||||||
name: String? = null,
|
name: String? = null,
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(SetMyName(name, languageCode))
|
) = execute(SetMyName(name, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyName(
|
suspend fun TelegramBot.setMyName(
|
||||||
name: String?,
|
name: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = setMyName(name, languageCode ?.let(::IetfLanguageCode))
|
) = setMyName(name, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyShortDescription(
|
suspend fun TelegramBot.setMyShortDescription(
|
||||||
shortDescription: String? = null,
|
shortDescription: String? = null,
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(SetMyShortDescription(shortDescription, languageCode))
|
) = execute(SetMyShortDescription(shortDescription, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyShortDescription(
|
suspend fun TelegramBot.setMyShortDescription(
|
||||||
shortDescription: String?,
|
shortDescription: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLanguageCode))
|
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.PinChatMessage
|
|||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
suspend fun TelegramBot.pinChatMessage(
|
suspend fun TelegramBot.pinChatMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -20,6 +20,6 @@ suspend fun TelegramBot.pinChatMessage(
|
|||||||
) = pinChatMessage(chat.id, messageId, disableNotification)
|
) = pinChatMessage(chat.id, messageId, disableNotification)
|
||||||
|
|
||||||
suspend fun TelegramBot.pinChatMessage(
|
suspend fun TelegramBot.pinChatMessage(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
) = pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
) = pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage
|
|||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -18,5 +18,5 @@ suspend fun TelegramBot.unpinChatMessage(
|
|||||||
) = unpinChatMessage(chat.id, messageId)
|
) = unpinChatMessage(chat.id, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
message: Message
|
message: AccessibleMessage
|
||||||
) = unpinChatMessage(message.chat.id, message.messageId)
|
) = unpinChatMessage(message.chat.id, message.messageId)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import dev.inmo.tgbotapi.types.location.LiveLocation
|
|||||||
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
@@ -181,7 +181,7 @@ suspend fun TelegramBot.edit(
|
|||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageReplyMarkup(message, replyMarkup)
|
) = editMessageReplyMarkup(message, replyMarkup)
|
||||||
|
|
||||||
@@ -194,9 +194,9 @@ suspend fun TelegramBot.edit(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -206,9 +206,9 @@ suspend fun TelegramBot.edit(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -218,10 +218,10 @@ suspend fun TelegramBot.edit(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -231,10 +231,10 @@ suspend fun TelegramBot.edit(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -244,9 +244,9 @@ suspend fun TelegramBot.edit(
|
|||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = edit(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = edit(message.chat.id, message.messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -255,9 +255,9 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = edit(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
) = edit(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -266,10 +266,10 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -278,10 +278,10 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -290,10 +290,10 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -302,7 +302,7 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|||||||
@@ -74,9 +74,9 @@ suspend fun TelegramBot.edit(
|
|||||||
messageId: InlineMessageIdentifier,
|
messageId: InlineMessageIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -85,9 +85,9 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
messageId: InlineMessageIdentifier,
|
messageId: InlineMessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -96,10 +96,10 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
messageId: InlineMessageIdentifier,
|
messageId: InlineMessageIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -108,7 +108,7 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
messageId: InlineMessageIdentifier,
|
messageId: InlineMessageIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
|
|||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ suspend fun <T> TelegramBot.editMessageCaption(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not media message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not media message this method will throw an exception")
|
||||||
suspend fun <T> TelegramBot.editMessageCaption(
|
suspend fun <T> TelegramBot.editMessageCaption(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: List<TextSource>,
|
entities: List<TextSource>,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -35,7 +35,7 @@ suspend fun TelegramBot.editMessageReplyMarkup(
|
|||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageReplyMarkup(
|
suspend fun TelegramBot.editMessageReplyMarkup(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText
|
import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.LinkPreviewOptions
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.utils.*
|
import dev.inmo.tgbotapi.utils.*
|
||||||
@@ -23,10 +24,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
EditChatMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
EditChatMessageText(chatId, messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,9 +39,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -50,9 +51,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -62,10 +63,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
EditChatMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
|
EditChatMessageText(chatId, messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,10 +77,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -89,10 +90,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -102,9 +103,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chat.id, messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -114,10 +115,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -127,10 +128,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -139,9 +140,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -150,10 +151,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -162,10 +163,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -173,11 +174,11 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -185,12 +186,12 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -198,9 +199,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
|
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
|
||||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.LinkPreviewOptions
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
@@ -18,9 +19,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, replyMarkup))
|
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, linkPreviewOptions, replyMarkup))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -29,9 +30,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(EditInlineMessageText(inlineMessageId, entities, disableWebPagePreview, replyMarkup))
|
) = execute(EditInlineMessageText(inlineMessageId, entities, linkPreviewOptions, replyMarkup))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -40,10 +41,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -52,7 +53,7 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.get
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.get.GetUserChatBoosts
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getUserChatBoosts(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId
|
||||||
|
) = execute(
|
||||||
|
GetUserChatBoosts(chatId = chatId, userId = userId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getUserChatBoosts(
|
||||||
|
chat: Chat,
|
||||||
|
userId: UserId
|
||||||
|
) = getUserChatBoosts(chatId = chat.id, userId = userId)
|
||||||
@@ -9,7 +9,7 @@ import dev.inmo.tgbotapi.types.MessageThreadId
|
|||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.threadId
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -186,7 +186,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
@@ -203,7 +203,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
@@ -220,7 +220,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -236,7 +236,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.send
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.send.CopyMessages
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
|
suspend fun TelegramBot.copyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: List<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = messageIds.chunked(copyMessagesLimit.last).flatMap {
|
||||||
|
execute(
|
||||||
|
CopyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = it,
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.copyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: Array<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = copyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = messageIds.toList(),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.copyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = copyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = (listOf(firstMessageId) + messageIds.toList()),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.copyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
messages: List<AccessibleMessage>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = messages.groupBy { it.chat }.flatMap { (chat, messages) ->
|
||||||
|
copyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = chat.id,
|
||||||
|
messageIds = messages.map { it.messageId },
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -22,8 +22,7 @@ import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
|||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.Game
|
import dev.inmo.tgbotapi.types.games.Game
|
||||||
import dev.inmo.tgbotapi.types.location.*
|
import dev.inmo.tgbotapi.types.location.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
@@ -44,7 +43,7 @@ import kotlin.jvm.JvmName
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
phoneNumber: String,
|
phoneNumber: String,
|
||||||
firstName: String,
|
firstName: String,
|
||||||
lastName: String? = null,
|
lastName: String? = null,
|
||||||
@@ -70,7 +69,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
contact: Contact,
|
contact: Contact,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -95,7 +94,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.replyWithDice(
|
suspend inline fun TelegramBot.replyWithDice(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
animationType: DiceAnimationType? = null,
|
animationType: DiceAnimationType? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -108,7 +107,7 @@ suspend inline fun TelegramBot.replyWithDice(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
animationType: DiceAnimationType,
|
animationType: DiceAnimationType,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -124,7 +123,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -148,7 +147,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -173,10 +172,10 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
@@ -185,7 +184,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to.chat,
|
to.chat,
|
||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
to.threadIdOrNull,
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
@@ -199,9 +198,9 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
@@ -209,7 +208,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendTextMessage(
|
) = sendTextMessage(
|
||||||
to.chat,
|
to.chat,
|
||||||
entities,
|
entities,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
to.threadIdOrNull,
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
@@ -223,30 +222,30 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = reply(to, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
) = reply(to, buildEntities(separator, builderBody), linkPreviewOptions, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = reply(to, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
) = reply(to, buildEntities(separator, builderBody), linkPreviewOptions, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Venue
|
// Venue
|
||||||
@@ -256,7 +255,7 @@ suspend fun TelegramBot.reply(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
title: String,
|
title: String,
|
||||||
@@ -288,7 +287,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
title: String,
|
title: String,
|
||||||
address: String,
|
address: String,
|
||||||
@@ -319,7 +318,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
venue: Venue,
|
venue: Venue,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -340,7 +339,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Game
|
// Game
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithGame(
|
suspend inline fun TelegramBot.replyWithGame(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
gameShortName: String,
|
gameShortName: String,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -351,7 +350,7 @@ suspend inline fun TelegramBot.replyWithGame(
|
|||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithGame(
|
suspend inline fun TelegramBot.replyWithGame(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
game: Game,
|
game: Game,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -362,7 +361,7 @@ suspend inline fun TelegramBot.replyWithGame(
|
|||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
game: Game,
|
game: Game,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -374,7 +373,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Animation
|
// Animation
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAnimation(
|
suspend inline fun TelegramBot.replyWithAnimation(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
animation: InputFile,
|
animation: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
@@ -406,7 +405,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
animation: AnimationFile,
|
animation: AnimationFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -421,7 +420,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendAnimation(to.chat, animation, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(to.chat, animation, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAnimation(
|
suspend inline fun TelegramBot.replyWithAnimation(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
animation: InputFile,
|
animation: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
@@ -451,7 +450,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
animation: AnimationFile,
|
animation: AnimationFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
@@ -468,7 +467,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Audio
|
// Audio
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAudio(
|
suspend inline fun TelegramBot.replyWithAudio(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
audio: InputFile,
|
audio: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
@@ -483,7 +482,7 @@ suspend inline fun TelegramBot.replyWithAudio(
|
|||||||
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
audio: AudioFile,
|
audio: AudioFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -495,7 +494,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendAudio(to.chat, audio, text, parseMode, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, text, parseMode, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAudio(
|
suspend inline fun TelegramBot.replyWithAudio(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
audio: InputFile,
|
audio: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
@@ -509,7 +508,7 @@ suspend inline fun TelegramBot.replyWithAudio(
|
|||||||
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
audio: AudioFile,
|
audio: AudioFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
title: String? = null,
|
title: String? = null,
|
||||||
@@ -523,7 +522,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Documents
|
// Documents
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithDocument(
|
suspend inline fun TelegramBot.replyWithDocument(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
document: InputFile,
|
document: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
@@ -536,7 +535,7 @@ suspend inline fun TelegramBot.replyWithDocument(
|
|||||||
) = sendDocument(to.chat, document, thumb, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, thumb, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
document: DocumentFile,
|
document: DocumentFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -548,7 +547,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendDocument(to.chat, document, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithDocument(
|
suspend inline fun TelegramBot.replyWithDocument(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
document: InputFile,
|
document: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
@@ -560,7 +559,7 @@ suspend inline fun TelegramBot.replyWithDocument(
|
|||||||
) = sendDocument(to.chat, document, thumb, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, thumb, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
document: DocumentFile,
|
document: DocumentFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -575,7 +574,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
|
|
||||||
@RiskFeature(rawSendingMediaGroupsWarning)
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
||||||
suspend inline fun TelegramBot.replyWithMediaGroup(
|
suspend inline fun TelegramBot.replyWithMediaGroup(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
media: List<MediaGroupMemberTelegramMedia>,
|
media: List<MediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -583,7 +582,7 @@ suspend inline fun TelegramBot.replyWithMediaGroup(
|
|||||||
) = sendMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
) = sendMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithPlaylist(
|
suspend inline fun TelegramBot.replyWithPlaylist(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
media: List<AudioMediaGroupMemberTelegramMedia>,
|
media: List<AudioMediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -591,7 +590,7 @@ suspend inline fun TelegramBot.replyWithPlaylist(
|
|||||||
) = sendPlaylist(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
) = sendPlaylist(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithDocuments(
|
suspend inline fun TelegramBot.replyWithDocuments(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
media: List<DocumentMediaGroupMemberTelegramMedia>,
|
media: List<DocumentMediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -599,7 +598,7 @@ suspend inline fun TelegramBot.replyWithDocuments(
|
|||||||
) = sendDocumentsGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
) = sendDocumentsGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithGallery(
|
suspend inline fun TelegramBot.replyWithGallery(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
media: List<VisualMediaGroupMemberTelegramMedia>,
|
media: List<VisualMediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -610,7 +609,7 @@ suspend inline fun TelegramBot.replyWithGallery(
|
|||||||
// Photo
|
// Photo
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithPhoto(
|
suspend inline fun TelegramBot.replyWithPhoto(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
fileId: InputFile,
|
fileId: InputFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -622,7 +621,7 @@ suspend inline fun TelegramBot.replyWithPhoto(
|
|||||||
) = sendPhoto(to.chat, fileId, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, fileId, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
photo: Photo,
|
photo: Photo,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -634,7 +633,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendPhoto(to.chat, photo, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photo, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
photoSize: PhotoSize,
|
photoSize: PhotoSize,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -647,7 +646,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithPhoto(
|
suspend inline fun TelegramBot.replyWithPhoto(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
fileId: InputFile,
|
fileId: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
@@ -658,7 +657,7 @@ suspend inline fun TelegramBot.replyWithPhoto(
|
|||||||
) = sendPhoto(to.chat, fileId, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, fileId, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
photo: Photo,
|
photo: Photo,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
@@ -669,7 +668,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendPhoto(to.chat, photo, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photo, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
photoSize: PhotoSize,
|
photoSize: PhotoSize,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
@@ -683,7 +682,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Sticker
|
// Sticker
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithSticker(
|
suspend inline fun TelegramBot.replyWithSticker(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
sticker: InputFile,
|
sticker: InputFile,
|
||||||
emoji: String? = null,
|
emoji: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -693,7 +692,7 @@ suspend inline fun TelegramBot.replyWithSticker(
|
|||||||
) = sendSticker(to.chat, sticker, to.threadIdOrNull, emoji, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(to.chat, sticker, to.threadIdOrNull, emoji, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
sticker: Sticker,
|
sticker: Sticker,
|
||||||
emoji: String? = null,
|
emoji: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -706,7 +705,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Videos
|
// Videos
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVideo(
|
suspend inline fun TelegramBot.replyWithVideo(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
video: InputFile,
|
video: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
@@ -722,7 +721,7 @@ suspend inline fun TelegramBot.replyWithVideo(
|
|||||||
) = sendVideo(to.chat, video, thumb, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, thumb, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
video: VideoFile,
|
video: VideoFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -734,7 +733,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendVideo(to.chat, video, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVideo(
|
suspend inline fun TelegramBot.replyWithVideo(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
video: InputFile,
|
video: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
@@ -749,7 +748,7 @@ suspend inline fun TelegramBot.replyWithVideo(
|
|||||||
) = sendVideo(to.chat, video, thumb, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, thumb, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
video: VideoFile,
|
video: VideoFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
spoilered: Boolean = false,
|
spoilered: Boolean = false,
|
||||||
@@ -763,7 +762,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// VideoNotes
|
// VideoNotes
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVideoNote(
|
suspend inline fun TelegramBot.replyWithVideoNote(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
videoNote: InputFile,
|
videoNote: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
@@ -775,7 +774,7 @@ suspend inline fun TelegramBot.replyWithVideoNote(
|
|||||||
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
videoNote: VideoNoteFile,
|
videoNote: VideoNoteFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -787,7 +786,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Voice
|
// Voice
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVoice(
|
suspend inline fun TelegramBot.replyWithVoice(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
voice: InputFile,
|
voice: InputFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -799,7 +798,7 @@ suspend inline fun TelegramBot.replyWithVoice(
|
|||||||
) = sendVoice(to.chat, voice, text, parseMode, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, text, parseMode, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
voice: VoiceFile,
|
voice: VoiceFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -811,7 +810,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVoice(
|
suspend inline fun TelegramBot.replyWithVoice(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
voice: InputFile,
|
voice: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
@@ -822,7 +821,7 @@ suspend inline fun TelegramBot.replyWithVoice(
|
|||||||
) = sendVoice(to.chat, voice, entities, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, entities, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
voice: VoiceFile,
|
voice: VoiceFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -839,7 +838,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
payload: String,
|
payload: String,
|
||||||
@@ -867,7 +866,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
// Polls
|
// Polls
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
question: String,
|
question: String,
|
||||||
options: List<String>,
|
options: List<String>,
|
||||||
isAnonymous: Boolean = true,
|
isAnonymous: Boolean = true,
|
||||||
@@ -881,7 +880,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
poll: RegularPoll,
|
poll: RegularPoll,
|
||||||
isClosed: Boolean = false,
|
isClosed: Boolean = false,
|
||||||
question: String = poll.question,
|
question: String = poll.question,
|
||||||
@@ -896,7 +895,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
question: String,
|
question: String,
|
||||||
options: List<String>,
|
options: List<String>,
|
||||||
correctOptionId: Int,
|
correctOptionId: Int,
|
||||||
@@ -912,7 +911,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
quizPoll: QuizPoll,
|
quizPoll: QuizPoll,
|
||||||
isClosed: Boolean = false,
|
isClosed: Boolean = false,
|
||||||
question: String = quizPoll.question,
|
question: String = quizPoll.question,
|
||||||
@@ -929,7 +928,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
question: String,
|
question: String,
|
||||||
options: List<String>,
|
options: List<String>,
|
||||||
correctOptionId: Int,
|
correctOptionId: Int,
|
||||||
@@ -944,7 +943,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
quizPoll: QuizPoll,
|
quizPoll: QuizPoll,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
isClosed: Boolean = false,
|
isClosed: Boolean = false,
|
||||||
@@ -961,7 +960,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
poll: Poll,
|
poll: Poll,
|
||||||
isClosed: Boolean = false,
|
isClosed: Boolean = false,
|
||||||
question: String = poll.question,
|
question: String = poll.question,
|
||||||
@@ -1006,7 +1005,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
@@ -1030,7 +1029,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
@@ -1042,8 +1041,8 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = reply(to, fromChat.id, messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
) = reply(to, fromChat.id, messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
copy: Message,
|
copy: AccessibleMessage,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -1053,13 +1052,13 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = reply(to, copy.chat.id, copy.messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
) = reply(to, copy.chat.id, copy.messageId, text, parseMode, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
content: MessageContent,
|
content: MessageContent,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): Message = execute(
|
): AccessibleMessage = execute(
|
||||||
content.createResend(
|
content.createResend(
|
||||||
to.chat.id,
|
to.chat.id,
|
||||||
to.threadIdOrNull,
|
to.threadIdOrNull,
|
||||||
@@ -1077,7 +1076,7 @@ suspend fun TelegramBot.reply(
|
|||||||
* @see handleLiveLocation
|
* @see handleLiveLocation
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
locationsFlow: Flow<EditLiveLocationInfo>,
|
locationsFlow: Flow<EditLiveLocationInfo>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -1102,7 +1101,7 @@ suspend fun TelegramBot.reply(
|
|||||||
@JvmName("replyLiveLocationWithLocation")
|
@JvmName("replyLiveLocationWithLocation")
|
||||||
@JsName("replyLiveLocationWithLocation")
|
@JsName("replyLiveLocationWithLocation")
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
locationsFlow: Flow<Location>,
|
locationsFlow: Flow<Location>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -1129,7 +1128,7 @@ suspend fun TelegramBot.reply(
|
|||||||
@JvmName("replyLiveLocationWithLatLong")
|
@JvmName("replyLiveLocationWithLatLong")
|
||||||
@JsName("replyLiveLocationWithLatLong")
|
@JsName("replyLiveLocationWithLatLong")
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
locationsFlow: Flow<Pair<Double, Double>>,
|
locationsFlow: Flow<Pair<Double, Double>>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -1149,7 +1148,7 @@ suspend fun TelegramBot.reply(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
mediaFile: TelegramMediaFile,
|
mediaFile: TelegramMediaFile,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -1233,7 +1232,7 @@ suspend fun TelegramBot.reply(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
content: TextedMediaContent,
|
content: TextedMediaContent,
|
||||||
text: String?,
|
text: String?,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
@@ -1307,7 +1306,7 @@ suspend fun TelegramBot.reply(
|
|||||||
}
|
}
|
||||||
|
|
||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
content: TextedMediaContent,
|
content: TextedMediaContent,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
|||||||
import dev.inmo.tgbotapi.types.files.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.Game
|
import dev.inmo.tgbotapi.types.games.Game
|
||||||
import dev.inmo.tgbotapi.types.location.*
|
import dev.inmo.tgbotapi.types.location.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
||||||
@@ -187,7 +187,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
toMessageId: MessageId,
|
toMessageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -197,7 +197,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
toChatId,
|
toChatId,
|
||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
@@ -214,7 +214,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
toChatId: IdChatIdentifier,
|
toChatId: IdChatIdentifier,
|
||||||
toMessageId: MessageId,
|
toMessageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -223,7 +223,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendTextMessage(
|
) = sendTextMessage(
|
||||||
toChatId,
|
toChatId,
|
||||||
entities,
|
entities,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
@@ -240,14 +240,14 @@ suspend fun TelegramBot.reply(
|
|||||||
toChatId: IdChatIdentifier,
|
toChatId: IdChatIdentifier,
|
||||||
toMessageId: MessageId,
|
toMessageId: MessageId,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -257,14 +257,14 @@ suspend fun TelegramBot.reply(
|
|||||||
toChatId: IdChatIdentifier,
|
toChatId: IdChatIdentifier,
|
||||||
toMessageId: MessageId,
|
toMessageId: MessageId,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
) = reply(toChatId, toMessageId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Venue
|
// Venue
|
||||||
@@ -1166,7 +1166,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
toChatId: IdChatIdentifier,
|
toChatId: IdChatIdentifier,
|
||||||
toMessageId: MessageId,
|
toMessageId: MessageId,
|
||||||
copy: Message,
|
copy: AccessibleMessage,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -31,7 +31,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
chatId,
|
chatId,
|
||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
@@ -49,7 +49,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -57,7 +57,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(
|
) = sendMessage(
|
||||||
chatId, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,14 +68,14 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,14 +86,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, 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
|
||||||
@@ -102,7 +102,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -110,7 +110,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendTextMessage(chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendTextMessage(chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,7 +120,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -128,7 +128,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +138,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -146,7 +146,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, 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
|
||||||
@@ -155,7 +155,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -163,7 +163,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(
|
) = sendMessage(
|
||||||
chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,7 +173,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -181,7 +181,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,7 +191,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -199,7 +199,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, 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
|
||||||
@@ -208,14 +208,14 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -224,7 +224,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -232,7 +232,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -242,7 +242,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -250,7 +250,7 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,14 +260,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -276,7 +276,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -284,7 +284,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -294,7 +294,7 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -302,4 +302,4 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|||||||
@@ -550,14 +550,14 @@ suspend fun TelegramBot.send(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chatId, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chatId, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will execute [sendTextMessage] request
|
* Will execute [sendTextMessage] request
|
||||||
@@ -568,14 +568,14 @@ suspend fun TelegramBot.send(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will execute [sendTextMessage] request
|
* Will execute [sendTextMessage] request
|
||||||
@@ -585,14 +585,14 @@ suspend fun TelegramBot.send(
|
|||||||
suspend fun TelegramBot.send(
|
suspend fun TelegramBot.send(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -601,7 +601,7 @@ suspend fun TelegramBot.send(
|
|||||||
suspend fun TelegramBot.send(
|
suspend fun TelegramBot.send(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -609,7 +609,7 @@ suspend fun TelegramBot.send(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = send(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = send(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -619,7 +619,7 @@ suspend fun TelegramBot.send(
|
|||||||
suspend fun TelegramBot.send(
|
suspend fun TelegramBot.send(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -627,7 +627,7 @@ suspend fun TelegramBot.send(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = send(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = send(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -638,14 +638,14 @@ suspend fun TelegramBot.send(
|
|||||||
suspend fun TelegramBot.send(
|
suspend fun TelegramBot.send(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -654,7 +654,7 @@ suspend fun TelegramBot.send(
|
|||||||
suspend fun TelegramBot.send(
|
suspend fun TelegramBot.send(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -662,7 +662,7 @@ suspend fun TelegramBot.send(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = send(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = send(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -672,7 +672,7 @@ suspend fun TelegramBot.send(
|
|||||||
suspend fun TelegramBot.send(
|
suspend fun TelegramBot.send(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -680,7 +680,7 @@ suspend fun TelegramBot.send(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = send(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = send(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will execute [sendPhoto] request
|
* Will execute [sendPhoto] request
|
||||||
|
|||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.send
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.send.SetMessageReactions
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
import dev.inmo.tgbotapi.types.reactions.Reaction
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMessageReactions(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
reactions: List<Reaction>,
|
||||||
|
big: Boolean = false
|
||||||
|
) = execute(
|
||||||
|
SetMessageReactions(chatId, messageId, reactions, big)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMessageReaction(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
reaction: Reaction?,
|
||||||
|
big: Boolean = false
|
||||||
|
) = setMessageReactions(chatId, messageId, listOfNotNull(reaction), big)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMessageReactions(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
reactions: List<Reaction>,
|
||||||
|
big: Boolean = false
|
||||||
|
) = setMessageReactions(chat.id, messageId, reactions, big)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMessageReaction(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
reaction: Reaction?,
|
||||||
|
big: Boolean = false
|
||||||
|
) = setMessageReaction(chat.id, messageId, reaction, big)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMessageReactions(
|
||||||
|
message: AccessibleMessage,
|
||||||
|
reactions: List<Reaction>,
|
||||||
|
big: Boolean = false
|
||||||
|
) = setMessageReactions(message.chat, message.messageId, reactions, big)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMessageReaction(
|
||||||
|
message: AccessibleMessage,
|
||||||
|
reaction: Reaction?,
|
||||||
|
big: Boolean = false
|
||||||
|
) = setMessageReaction(message.chat, message.messageId, reaction, big)
|
||||||
@@ -13,6 +13,8 @@ kotlin {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api project(":tgbotapi.core")
|
||||||
|
api project(":tgbotapi.utils")
|
||||||
api project(":tgbotapi.behaviour_builder")
|
api project(":tgbotapi.behaviour_builder")
|
||||||
api libs.microutils.fsm.common
|
api libs.microutils.fsm.common
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ kotlin {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(":tgbotapi.utils")
|
api project(path: ':tgbotapi.core')
|
||||||
|
api project(path: ':tgbotapi.utils')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatBoostRemovedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostRemoved
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostRemoved(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<ChatBoostRemoved> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
it.chatBoostRemovedUpdateOrNull() ?.data.let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatBoostUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostUpdated
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostUpdated(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<ChatBoostUpdated> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
it.chatBoostUpdatedUpdateOrNull() ?.data.let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
@RiskFeature(lowLevelRiskFeatureMessage)
|
||||||
|
suspend inline fun <reified O : ChatMessageReactionUpdated> BehaviourContext.waitChatMessageReactionUpdated(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<O> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
(it.chatMessageReactionUpdatedUpdateOrNull() ?.data as? O).let(::listOfNotNull)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatMessageReactionUpdatedByUser(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitChatMessageReactionUpdated<ChatMessageReactionUpdated.ByUser>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatMessageReactionUpdatedByChat(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitChatMessageReactionUpdated<ChatMessageReactionUpdated.ByChat>(initRequest, errorFactory)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionsCountUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionsCountUpdated
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
suspend inline fun BehaviourContext.waitChatMessageReactionsCountUpdated(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<ChatMessageReactionsCountUpdated> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
(it.chatMessageReactionsCountUpdatedUpdateOrNull() ?.data).let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -138,3 +138,13 @@ suspend fun BehaviourContext.waitMediaContent(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent(initRequest, errorFactory).mapContent<MediaContent>()
|
) = waitContent(initRequest, errorFactory).mapContent<MediaContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitScheduledGiveawayContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<ScheduledGiveawayContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitGiveawayPublicResultsContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<GiveawayPublicResultsContent>()
|
||||||
|
|||||||
@@ -152,3 +152,13 @@ suspend fun BehaviourContext.waitMediaContentMessage(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage(initRequest, errorFactory).mapWithContent<MediaContent>()
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<MediaContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitScheduledGiveawayContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<ScheduledGiveawayContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitGiveawayPublicResultsContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<GiveawayPublicResultsContent>()
|
||||||
|
|||||||
@@ -130,3 +130,14 @@ suspend fun BehaviourContext.waitEditedInvoice(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
|
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedScheduledGiveawayContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContent<ScheduledGiveawayContent>(initRequest, false, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, false, errorFactory)
|
||||||
|
|
||||||
|
|||||||
@@ -136,3 +136,14 @@ suspend fun BehaviourContext.waitEditedInvoiceMessage(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEditedContentMessage<InvoiceContent>(initRequest, errorFactory)
|
) = waitEditedContentMessage<InvoiceContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedScheduledGiveawayContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContentMessage<ScheduledGiveawayContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContentMessage<GiveawayPublicResultsContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||||
import dev.inmo.tgbotapi.types.request.UserShared
|
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
@@ -202,7 +202,7 @@ suspend fun BehaviourContext.waitChatSharedRequest(
|
|||||||
suspend fun BehaviourContext.waitUserShared(
|
suspend fun BehaviourContext.waitUserShared(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEvents<UserShared>(initRequest, errorFactory)
|
) = waitEvents<UsersShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitChatShared(
|
suspend fun BehaviourContext.waitChatShared(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||||
import dev.inmo.tgbotapi.types.request.UserShared
|
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
@@ -196,7 +196,7 @@ suspend fun BehaviourContext.waitChatSharedRequestEventsMessages(
|
|||||||
suspend fun BehaviourContext.waitUserSharedEventsMessages(
|
suspend fun BehaviourContext.waitUserSharedEventsMessages(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEventsMessages<UserShared>(initRequest, errorFactory)
|
) = waitEventsMessages<UsersShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitChatSharedEventsMessages(
|
suspend fun BehaviourContext.waitChatSharedEventsMessages(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
|
|||||||
@@ -6,24 +6,24 @@ import dev.inmo.tgbotapi.extensions.utils.extensions.sourceUser
|
|||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||||
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
||||||
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
|
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
||||||
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||||
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow only events from the same chat as base [Message]
|
* Allow only events from the same chat as base [AccessibleMessage]
|
||||||
*/
|
*/
|
||||||
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, Message, Update> = { message, update ->
|
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, AccessibleMessage, Update> = { message, update ->
|
||||||
update.sourceChat() ?.let {
|
update.sourceChat() ?.let {
|
||||||
it.id == message.chat.id
|
it.id == message.chat.id
|
||||||
} != false
|
} != false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allow only events from the same chat as base [List] of [Message]
|
* Allow only events from the same chat as base [List] of [AccessibleMessage]
|
||||||
*/
|
*/
|
||||||
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<Message>, Update> = { messages, update ->
|
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<AccessibleMessage>, Update> = { messages, update ->
|
||||||
val sourceChatId = update.sourceChat() ?.id
|
val sourceChatId = update.sourceChat() ?.id
|
||||||
sourceChatId != null && messages.all { sourceChatId == it.chat.id }
|
sourceChatId != null && messages.all { sourceChatId == it.chat.id }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupMessage
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupMessage
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow only messages which are not [MediaGroupMessage]
|
* Allow only messages which are not [MediaGroupMessage]
|
||||||
*/
|
*/
|
||||||
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<Message> {
|
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<AccessibleMessage> {
|
||||||
it !is CommonMessage<*> || it.content !is MediaGroupContent<*>
|
it !is CommonMessage<*> || it.content !is MediaGroupContent<*>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
|||||||
/**
|
/**
|
||||||
* Allow only messages which are not in some forum
|
* Allow only messages which are not in some forum
|
||||||
*/
|
*/
|
||||||
val MessageFilterForums = SimpleFilter<Message> {
|
val MessageFilterForums = SimpleFilter<AccessibleMessage> {
|
||||||
it.threadIdOrNull == null
|
it.threadIdOrNull == null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ suspend fun <BC : BehaviourContext> BC.onUnhandledInlineMessageIdDataCallbackQue
|
|||||||
markerFactory: MarkerFactory<in InlineMessageIdDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
markerFactory: MarkerFactory<in InlineMessageIdDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InlineMessageIdDataCallbackQuery>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InlineMessageIdDataCallbackQuery>
|
||||||
) = onCallbackQuery (
|
) = onCallbackQuery (
|
||||||
initialFilter * !SimpleFilter<MessageDataCallbackQuery> { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) },
|
initialFilter * !SimpleFilter<InlineMessageIdDataCallbackQuery> { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) },
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
markerFactory,
|
markerFactory,
|
||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.CustomBehaviourContextAndTwoTypesReceiver
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.CustomBehaviourContextAndTypeReceiver
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByIdChatBoostRemovedMarkerFactory
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatBoostRemovedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostRemoved
|
||||||
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatBoostRemoved(
|
||||||
|
initialFilter: SimpleFilter<ChatBoostRemoved>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatBoostRemoved, Update>? = null,
|
||||||
|
markerFactory: MarkerFactory<ChatBoostRemoved, Any> = ByIdChatBoostRemovedMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatBoostRemoved>
|
||||||
|
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
|
||||||
|
(it.chatBoostRemovedUpdateOrNull() ?.data) ?.let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.CustomBehaviourContextAndTwoTypesReceiver
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.CustomBehaviourContextAndTypeReceiver
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByIdChatBoostUpdatedMarkerFactory
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatBoostUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostUpdated
|
||||||
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatBoostUpdated(
|
||||||
|
initialFilter: SimpleFilter<ChatBoostUpdated>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatBoostUpdated, Update>? = null,
|
||||||
|
markerFactory: MarkerFactory<ChatBoostUpdated, Any> = ByIdChatBoostUpdatedMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatBoostUpdated>
|
||||||
|
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
|
||||||
|
(it.chatBoostUpdatedUpdateOrNull() ?.data) ?.let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.triggers_handling
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.*
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByChatIdChatMessageReactionUpdatedMarkerFactory
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.ByIdPollMarkerFactory
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories.MarkerFactory
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
|
||||||
|
import dev.inmo.tgbotapi.types.polls.*
|
||||||
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
|
internal suspend inline fun <BC : BehaviourContext, reified T : ChatMessageReactionUpdated> BC.onChatMessageReactionUpdated(
|
||||||
|
initialFilter: SimpleFilter<T>? = null,
|
||||||
|
noinline subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, T, Update>? = null,
|
||||||
|
markerFactory: MarkerFactory<in T, Any> = ByChatIdChatMessageReactionUpdatedMarkerFactory,
|
||||||
|
noinline scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, T>
|
||||||
|
) = on(markerFactory, initialFilter, subcontextUpdatesFilter, scenarioReceiver) {
|
||||||
|
(it.chatMessageReactionUpdatedUpdateOrNull() ?.data as? T) ?.let(::listOfNotNull)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatMessageReactionUpdatedByUser(
|
||||||
|
initialFilter: SimpleFilter<ChatMessageReactionUpdated.ByUser>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatMessageReactionUpdated.ByUser, Update>? = null,
|
||||||
|
markerFactory: MarkerFactory<in ChatMessageReactionUpdated.ByUser, Any> = ByChatIdChatMessageReactionUpdatedMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatMessageReactionUpdated.ByUser>
|
||||||
|
) = onChatMessageReactionUpdated(
|
||||||
|
initialFilter,
|
||||||
|
subcontextUpdatesFilter,
|
||||||
|
markerFactory,
|
||||||
|
scenarioReceiver
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatMessageReactionUpdatedByChat(
|
||||||
|
initialFilter: SimpleFilter<ChatMessageReactionUpdated.ByChat>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatMessageReactionUpdated.ByChat, Update>? = null,
|
||||||
|
markerFactory: MarkerFactory<in ChatMessageReactionUpdated.ByChat, Any> = ByChatIdChatMessageReactionUpdatedMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatMessageReactionUpdated.ByChat>
|
||||||
|
) = onChatMessageReactionUpdated(
|
||||||
|
initialFilter,
|
||||||
|
subcontextUpdatesFilter,
|
||||||
|
markerFactory,
|
||||||
|
scenarioReceiver
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onChatMessageReactionUpdatedUnknown(
|
||||||
|
initialFilter: SimpleFilter<ChatMessageReactionUpdated.Unknown>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ChatMessageReactionUpdated.Unknown, Update>? = null,
|
||||||
|
markerFactory: MarkerFactory<in ChatMessageReactionUpdated.Unknown, Any> = ByChatIdChatMessageReactionUpdatedMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ChatMessageReactionUpdated.Unknown>
|
||||||
|
) = onChatMessageReactionUpdated(
|
||||||
|
initialFilter,
|
||||||
|
subcontextUpdatesFilter,
|
||||||
|
markerFactory,
|
||||||
|
scenarioReceiver
|
||||||
|
)
|
||||||
@@ -703,3 +703,52 @@ suspend fun <BC : BehaviourContext> BC.onMediaContent(
|
|||||||
markerFactory,
|
markerFactory,
|
||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onScheduledGiveawayContent(
|
||||||
|
initialFilter: CommonMessageFilter<ScheduledGiveawayContent>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, ScheduledGiveawayContentMessage, Update>? = MessageFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in ScheduledGiveawayContentMessage, Any> = ByChatMessageMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, ScheduledGiveawayContentMessage>
|
||||||
|
) = onContentMessageWithType(
|
||||||
|
initialFilter,
|
||||||
|
subcontextUpdatesFilter,
|
||||||
|
markerFactory,
|
||||||
|
scenarioReceiver
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param initialFilter This filter will be called to remove unnecessary data BEFORE [scenarioReceiver] call
|
||||||
|
* @param subcontextUpdatesFilter This filter will be applied to each update inside of [scenarioReceiver]. For example,
|
||||||
|
* this filter will be used if you will call [dev.inmo.tgbotapi.extensions.behaviour_builder.expectations.waitContentMessage].
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver] function to create your own.
|
||||||
|
* Use [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.plus] or [dev.inmo.tgbotapi.extensions.behaviour_builder.utils.times]
|
||||||
|
* to combinate several filters
|
||||||
|
* @param [markerFactory] Will be used to identify different "stream". [scenarioReceiver] will be called synchronously
|
||||||
|
* in one "stream". Output of [markerFactory] will be used as a key for "stream"
|
||||||
|
* @param scenarioReceiver Main callback which will be used to handle incoming data if [initialFilter] will pass that
|
||||||
|
* data
|
||||||
|
*/
|
||||||
|
suspend fun <BC : BehaviourContext> BC.onScheduledGiveawayContent(
|
||||||
|
initialFilter: CommonMessageFilter<GiveawayPublicResultsContent>? = null,
|
||||||
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, GiveawayPublicResultsContentMessage, Update>? = MessageFilterByChat,
|
||||||
|
markerFactory: MarkerFactory<in GiveawayPublicResultsContentMessage, Any> = ByChatMessageMarkerFactory,
|
||||||
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, GiveawayPublicResultsContentMessage>
|
||||||
|
) = onContentMessageWithType(
|
||||||
|
initialFilter,
|
||||||
|
subcontextUpdatesFilter,
|
||||||
|
markerFactory,
|
||||||
|
scenarioReceiver
|
||||||
|
)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.SupergroupEventMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||||
import dev.inmo.tgbotapi.types.request.UserShared
|
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
internal suspend inline fun <BC : BehaviourContext, reified T : ChatEvent> BC.onEvent(
|
internal suspend inline fun <BC : BehaviourContext, reified T : ChatEvent> BC.onEvent(
|
||||||
@@ -776,10 +776,10 @@ suspend fun <BC : BehaviourContext> BC.onChatSharedRequest(
|
|||||||
* data
|
* data
|
||||||
*/
|
*/
|
||||||
suspend fun <BC : BehaviourContext> BC.onUserShared(
|
suspend fun <BC : BehaviourContext> BC.onUserShared(
|
||||||
initialFilter: SimpleFilter<PrivateEventMessage<UserShared>>? = null,
|
initialFilter: SimpleFilter<PrivateEventMessage<UsersShared>>? = null,
|
||||||
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<UserShared>, Update>? = MessageFilterByChat,
|
subcontextUpdatesFilter: CustomBehaviourContextAndTwoTypesReceiver<BC, Boolean, PrivateEventMessage<UsersShared>, Update>? = MessageFilterByChat,
|
||||||
markerFactory: MarkerFactory<in ChatEventMessage<UserShared>, Any> = ByChatMessageMarkerFactory,
|
markerFactory: MarkerFactory<in ChatEventMessage<UsersShared>, Any> = ByChatMessageMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<UserShared>>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, PrivateEventMessage<UsersShared>>
|
||||||
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
) = onEventWithCustomChatEventMessage(initialFilter, subcontextUpdatesFilter, markerFactory, scenarioReceiver)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostRemoved
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostUpdated
|
||||||
|
import dev.inmo.tgbotapi.types.polls.PollAnswer
|
||||||
|
|
||||||
|
object ByIdChatBoostRemovedMarkerFactory : MarkerFactory<ChatBoostRemoved, Any> {
|
||||||
|
override suspend fun invoke(data: ChatBoostRemoved) = data.chat.id
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostUpdated
|
||||||
|
import dev.inmo.tgbotapi.types.polls.PollAnswer
|
||||||
|
|
||||||
|
object ByIdChatBoostUpdatedMarkerFactory : MarkerFactory<ChatBoostUpdated, Any> {
|
||||||
|
override suspend fun invoke(data: ChatBoostUpdated) = data.chat.id
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
|
||||||
|
|
||||||
|
object ByChatIdChatMessageReactionUpdatedMarkerFactory : MarkerFactory<ChatMessageReactionUpdated, Any> {
|
||||||
|
override suspend fun invoke(data: ChatMessageReactionUpdated) = data.chat.id
|
||||||
|
}
|
||||||
@@ -2,12 +2,12 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.utils.marker_factories
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||||
|
|
||||||
object ByChatMessageMarkerFactory : MarkerFactory<Message, Any> {
|
object ByChatMessageMarkerFactory : MarkerFactory<AccessibleMessage, Any> {
|
||||||
override suspend fun invoke(data: Message) = data.chat
|
override suspend fun invoke(data: AccessibleMessage) = data.chat
|
||||||
}
|
}
|
||||||
|
|
||||||
object ByUserMessageMarkerFactory : MarkerFactory<Message, Any> {
|
object ByUserMessageMarkerFactory : MarkerFactory<AccessibleMessage, Any> {
|
||||||
override suspend fun invoke(data: Message) = when (data) {
|
override suspend fun invoke(data: AccessibleMessage) = when (data) {
|
||||||
is FromUserMessage -> data.user
|
is FromUserMessage -> data.user
|
||||||
is FromChannelGroupContentMessage<*> -> data.channel
|
is FromChannelGroupContentMessage<*> -> data.channel
|
||||||
else -> data.chat // including anonymous
|
else -> data.chat // including anonymous
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ kotlin {
|
|||||||
api libs.korlibs.krypto
|
api libs.korlibs.krypto
|
||||||
api libs.uuid
|
api libs.uuid
|
||||||
|
|
||||||
|
api libs.microutils.colors.common
|
||||||
api libs.microutils.coroutines
|
api libs.microutils.coroutines
|
||||||
api libs.microutils.serialization.base64
|
api libs.microutils.serialization.base64
|
||||||
api libs.microutils.serialization.encapsulator
|
api libs.microutils.serialization.encapsulator
|
||||||
@@ -31,6 +32,8 @@ kotlin {
|
|||||||
api libs.microutils.languageCodes
|
api libs.microutils.languageCodes
|
||||||
|
|
||||||
api libs.ktor.client.core
|
api libs.ktor.client.core
|
||||||
|
|
||||||
|
api libs.kslog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commonTest {
|
commonTest {
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package dev.inmo.tgbotapi.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All inheritors of this interface have [messageId] field and related to this [messageId]
|
||||||
|
*/
|
||||||
|
interface WithMessageId {
|
||||||
|
val messageId: MessageId
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package dev.inmo.tgbotapi.abstracts
|
||||||
|
|
||||||
|
interface WithPreviewChatAndMessageId : WithPreviewChat, WithMessageId
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.abstracts.types
|
|
||||||
|
|
||||||
interface DisableWebPagePreview {
|
|
||||||
val disableWebPagePreview: Boolean?
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.inmo.tgbotapi.abstracts.types
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.LinkPreviewOptions
|
||||||
|
|
||||||
|
interface LinkPreviewOptionsContainer {
|
||||||
|
val linkPreviewOptions: LinkPreviewOptions?
|
||||||
|
val disableWebPagePreview: Boolean?
|
||||||
|
get() = linkPreviewOptions ?.isDisabled != true
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("LinkPreviewOptionsContainer", "dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer"))
|
||||||
|
typealias DisableWebPagePreview = LinkPreviewOptionsContainer
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
package dev.inmo.tgbotapi.abstracts.types
|
package dev.inmo.tgbotapi.abstracts.types
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.abstracts.WithMessageId
|
||||||
|
|
||||||
interface MessageAction: ChatRequest {
|
interface MessageAction : ChatRequest, WithMessageId
|
||||||
val messageId: MessageId
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package dev.inmo.tgbotapi.abstracts.types
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
|
||||||
|
interface MessagesAction: ChatRequest {
|
||||||
|
val messageIds: List<MessageId>
|
||||||
|
}
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.bot.ktor
|
package dev.inmo.tgbotapi.bot.ktor
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.KSLog
|
||||||
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
||||||
import dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter
|
import dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter
|
||||||
import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter
|
import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter
|
||||||
|
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
import dev.inmo.tgbotapi.utils.nonstrictJsonFormat
|
||||||
import io.ktor.client.*
|
import io.ktor.client.*
|
||||||
@@ -22,6 +24,7 @@ expect class KtorRequestsExecutor internal constructor(
|
|||||||
requestsLimiter: RequestLimiter,
|
requestsLimiter: RequestLimiter,
|
||||||
jsonFormatter: Json,
|
jsonFormatter: Json,
|
||||||
pipelineStepsHolder: KtorPipelineStepsHolder,
|
pipelineStepsHolder: KtorPipelineStepsHolder,
|
||||||
|
logger: KSLog,
|
||||||
diff: Unit // just a diff property to know where constructor and where calling function with defaults
|
diff: Unit // just a diff property to know where constructor and where calling function with defaults
|
||||||
) : BaseRequestsExecutor
|
) : BaseRequestsExecutor
|
||||||
|
|
||||||
@@ -32,7 +35,8 @@ fun KtorRequestsExecutor(
|
|||||||
excludeDefaultFactories: Boolean = false,
|
excludeDefaultFactories: Boolean = false,
|
||||||
requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter,
|
requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter,
|
||||||
jsonFormatter: Json = nonstrictJsonFormat,
|
jsonFormatter: Json = nonstrictJsonFormat,
|
||||||
pipelineStepsHolder: KtorPipelineStepsHolder = KtorPipelineStepsHolder
|
pipelineStepsHolder: KtorPipelineStepsHolder = KtorPipelineStepsHolder,
|
||||||
|
logger: KSLog = DefaultKTgBotAPIKSLog,
|
||||||
) = KtorRequestsExecutor(
|
) = KtorRequestsExecutor(
|
||||||
telegramAPIUrlsKeeper = telegramAPIUrlsKeeper,
|
telegramAPIUrlsKeeper = telegramAPIUrlsKeeper,
|
||||||
client = client,
|
client = client,
|
||||||
@@ -41,5 +45,6 @@ fun KtorRequestsExecutor(
|
|||||||
requestsLimiter = requestsLimiter,
|
requestsLimiter = requestsLimiter,
|
||||||
jsonFormatter = jsonFormatter,
|
jsonFormatter = jsonFormatter,
|
||||||
pipelineStepsHolder = pipelineStepsHolder,
|
pipelineStepsHolder = pipelineStepsHolder,
|
||||||
diff = kotlin.Unit
|
logger = logger,
|
||||||
|
diff = kotlin.Unit,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.bot.ktor
|
package dev.inmo.tgbotapi.bot.ktor
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.KSLog
|
||||||
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.bot.ktor.base.*
|
import dev.inmo.tgbotapi.bot.ktor.base.*
|
||||||
@@ -10,9 +11,9 @@ import io.ktor.client.HttpClient
|
|||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
@RiskFeature
|
@RiskFeature
|
||||||
fun createTelegramBotDefaultKtorCallRequestsFactories() = listOf(
|
fun createTelegramBotDefaultKtorCallRequestsFactories(logger: KSLog? = null) = listOf(
|
||||||
SimpleRequestCallFactory(),
|
SimpleRequestCallFactory(logger),
|
||||||
MultipartRequestCallFactory(),
|
MultipartRequestCallFactory(logger),
|
||||||
DownloadFileRequestCallFactory,
|
DownloadFileRequestCallFactory,
|
||||||
DownloadFileChannelRequestCallFactory
|
DownloadFileChannelRequestCallFactory
|
||||||
)
|
)
|
||||||
@@ -25,6 +26,8 @@ class KtorRequestsExecutorBuilder(
|
|||||||
var excludeDefaultFactories: Boolean = false
|
var excludeDefaultFactories: Boolean = false
|
||||||
var requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter
|
var requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter
|
||||||
var jsonFormatter: Json = nonstrictJsonFormat
|
var jsonFormatter: Json = nonstrictJsonFormat
|
||||||
|
var logger: KSLog = DefaultKTgBotAPIKSLog
|
||||||
|
var pipelineStepsHolder: KtorPipelineStepsHolder = KtorPipelineStepsHolder
|
||||||
|
|
||||||
fun build() = KtorRequestsExecutor(
|
fun build() = KtorRequestsExecutor(
|
||||||
telegramAPIUrlsKeeper,
|
telegramAPIUrlsKeeper,
|
||||||
@@ -32,7 +35,9 @@ class KtorRequestsExecutorBuilder(
|
|||||||
callsFactories,
|
callsFactories,
|
||||||
excludeDefaultFactories,
|
excludeDefaultFactories,
|
||||||
requestsLimiter,
|
requestsLimiter,
|
||||||
jsonFormatter
|
jsonFormatter,
|
||||||
|
pipelineStepsHolder,
|
||||||
|
logger
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,30 @@
|
|||||||
package dev.inmo.tgbotapi.bot.ktor.base
|
package dev.inmo.tgbotapi.bot.ktor.base
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.KSLog
|
||||||
|
import dev.inmo.kslog.common.v
|
||||||
|
import dev.inmo.kslog.common.w
|
||||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||||
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
||||||
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
||||||
import dev.inmo.tgbotapi.requests.GetUpdatesRequest
|
import dev.inmo.tgbotapi.requests.GetUpdatesRequest
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.types.Response
|
import dev.inmo.tgbotapi.types.Response
|
||||||
|
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.plugins.timeout
|
import io.ktor.client.plugins.timeout
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
import io.ktor.client.statement.bodyAsText
|
import io.ktor.client.statement.bodyAsText
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlin.collections.set
|
import kotlin.collections.set
|
||||||
|
|
||||||
var defaultUpdateTimeoutForZeroDelay = 1000L
|
var defaultUpdateTimeoutForZeroDelay = 1000L
|
||||||
|
|
||||||
abstract class AbstractRequestCallFactory : KtorCallFactory {
|
abstract class AbstractRequestCallFactory(
|
||||||
|
protected open val logger: KSLog = DefaultKTgBotAPIKSLog
|
||||||
|
) : KtorCallFactory {
|
||||||
private val methodsCache: MutableMap<String, String> = mutableMapOf()
|
private val methodsCache: MutableMap<String, String> = mutableMapOf()
|
||||||
override suspend fun <T : Any> makeCall(
|
override suspend fun <T : Any> makeCall(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
@@ -26,6 +33,7 @@ abstract class AbstractRequestCallFactory : KtorCallFactory {
|
|||||||
jsonFormatter: Json
|
jsonFormatter: Json
|
||||||
): T? {
|
): T? {
|
||||||
val preparedBody = prepareCallBody(client, urlsKeeper, request) ?: return null
|
val preparedBody = prepareCallBody(client, urlsKeeper, request) ?: return null
|
||||||
|
logger.v { "Prepared body for $request: $preparedBody" }
|
||||||
|
|
||||||
client.post {
|
client.post {
|
||||||
url(
|
url(
|
||||||
@@ -54,7 +62,9 @@ abstract class AbstractRequestCallFactory : KtorCallFactory {
|
|||||||
setBody(preparedBody)
|
setBody(preparedBody)
|
||||||
}.let { response ->
|
}.let { response ->
|
||||||
val content = response.bodyAsText()
|
val content = response.bodyAsText()
|
||||||
|
logger.v { "Raw answer for $request: $content" }
|
||||||
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
|
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
|
||||||
|
logger.v { "Answer as json for $request: $responseObject" }
|
||||||
|
|
||||||
return runCatchingSafely {
|
return runCatchingSafely {
|
||||||
(responseObject.result?.let {
|
(responseObject.result?.let {
|
||||||
@@ -66,6 +76,8 @@ abstract class AbstractRequestCallFactory : KtorCallFactory {
|
|||||||
"Can't get result object from $content"
|
"Can't get result object from $content"
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
}.onFailure {
|
||||||
|
logger.w { "Got exception answer for $request: $it" }
|
||||||
}.getOrThrow()
|
}.getOrThrow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package dev.inmo.tgbotapi.bot.ktor.base
|
package dev.inmo.tgbotapi.bot.ktor.base
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.*
|
||||||
|
import dev.inmo.micro_utils.coroutines.defaultSafelyExceptionHandler
|
||||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||||
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
||||||
import dev.inmo.tgbotapi.bot.exceptions.BotException
|
import dev.inmo.tgbotapi.bot.exceptions.BotException
|
||||||
import dev.inmo.tgbotapi.bot.exceptions.CommonBotException
|
import dev.inmo.tgbotapi.bot.exceptions.CommonBotException
|
||||||
|
import dev.inmo.tgbotapi.bot.exceptions.GetUpdatesConflict
|
||||||
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
import dev.inmo.tgbotapi.bot.exceptions.newRequestException
|
||||||
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
||||||
import dev.inmo.tgbotapi.bot.ktor.KtorPipelineStepsHolder
|
import dev.inmo.tgbotapi.bot.ktor.KtorPipelineStepsHolder
|
||||||
@@ -28,12 +31,15 @@ class DefaultKtorRequestsExecutor internal constructor(
|
|||||||
private val requestsLimiter: RequestLimiter,
|
private val requestsLimiter: RequestLimiter,
|
||||||
private val jsonFormatter: Json,
|
private val jsonFormatter: Json,
|
||||||
private val pipelineStepsHolder: KtorPipelineStepsHolder,
|
private val pipelineStepsHolder: KtorPipelineStepsHolder,
|
||||||
|
private val logger: KSLog,
|
||||||
diff: Unit
|
diff: Unit
|
||||||
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
||||||
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
|
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
|
||||||
if (!excludeDefaultFactories) {
|
if (!excludeDefaultFactories) {
|
||||||
this + createTelegramBotDefaultKtorCallRequestsFactories()
|
logger.v { "Installing default factories" }
|
||||||
|
this + createTelegramBotDefaultKtorCallRequestsFactories(logger)
|
||||||
} else {
|
} else {
|
||||||
|
logger.v { "Default factories will not be installed" }
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -46,19 +52,23 @@ class DefaultKtorRequestsExecutor internal constructor(
|
|||||||
|
|
||||||
override suspend fun <T : Any> execute(request: Request<T>): T {
|
override suspend fun <T : Any> execute(request: Request<T>): T {
|
||||||
return runCatchingSafely {
|
return runCatchingSafely {
|
||||||
|
logger.v { "Start request $request" }
|
||||||
pipelineStepsHolder.onBeforeSearchCallFactory(request, callsFactories)
|
pipelineStepsHolder.onBeforeSearchCallFactory(request, callsFactories)
|
||||||
requestsLimiter.limit(request) {
|
requestsLimiter.limit(request) {
|
||||||
var result: T? = null
|
var result: T? = null
|
||||||
lateinit var factoryHandledRequest: KtorCallFactory
|
lateinit var factoryHandledRequest: KtorCallFactory
|
||||||
for (potentialFactory in callsFactories) {
|
for (potentialFactory in callsFactories) {
|
||||||
pipelineStepsHolder.onBeforeCallFactoryMakeCall(request, potentialFactory)
|
pipelineStepsHolder.onBeforeCallFactoryMakeCall(request, potentialFactory)
|
||||||
result = potentialFactory.makeCall(
|
logger.v { "Trying factory $potentialFactory for $request" }
|
||||||
|
val resultFromFactory = potentialFactory.makeCall(
|
||||||
client,
|
client,
|
||||||
telegramAPIUrlsKeeper,
|
telegramAPIUrlsKeeper,
|
||||||
request,
|
request,
|
||||||
jsonFormatter
|
jsonFormatter
|
||||||
)
|
)
|
||||||
result = pipelineStepsHolder.onAfterCallFactoryMakeCall(result, request, potentialFactory)
|
logger.v { "Result of factory $potentialFactory handling $request: $resultFromFactory" }
|
||||||
|
result = pipelineStepsHolder.onAfterCallFactoryMakeCall(resultFromFactory, request, potentialFactory)
|
||||||
|
logger.v { "Result of pipeline $pipelineStepsHolder handling $resultFromFactory: $result" }
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
factoryHandledRequest = potentialFactory
|
factoryHandledRequest = potentialFactory
|
||||||
break
|
break
|
||||||
@@ -71,6 +81,7 @@ class DefaultKtorRequestsExecutor internal constructor(
|
|||||||
}
|
}
|
||||||
}.let {
|
}.let {
|
||||||
val result = it.exceptionOrNull() ?.let { e ->
|
val result = it.exceptionOrNull() ?.let { e ->
|
||||||
|
logger.v(e) { "Got exception on handling of $request" }
|
||||||
pipelineStepsHolder.onRequestException(request, e) ?.let { return@let it }
|
pipelineStepsHolder.onRequestException(request, e) ?.let { return@let it }
|
||||||
|
|
||||||
when (e) {
|
when (e) {
|
||||||
@@ -90,9 +101,18 @@ class DefaultKtorRequestsExecutor internal constructor(
|
|||||||
}
|
}
|
||||||
is BotException -> e
|
is BotException -> e
|
||||||
else -> CommonBotException(cause = e)
|
else -> CommonBotException(cause = e)
|
||||||
|
}.also { newException ->
|
||||||
|
logger.v(newException) { "Result exception on handling of $request is an exception" }
|
||||||
|
if (newException is GetUpdatesConflict) {
|
||||||
|
logger.w(newException) {
|
||||||
|
"Warning!!! Other bot with the same bot token requests updates with getUpdate in parallel"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} ?.let { Result.failure(it) } ?: it
|
} ?.let { Result.failure(it) } ?: it
|
||||||
pipelineStepsHolder.onRequestReturnResult(result, request, callsFactories)
|
pipelineStepsHolder.onRequestReturnResult(result, request, callsFactories).also {
|
||||||
|
logger.v { "Result of handling $request: $it" }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
|||||||
import dev.inmo.tgbotapi.requests.DownloadFileStream
|
import dev.inmo.tgbotapi.requests.DownloadFileStream
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.utils.ByteReadChannelAllocator
|
import dev.inmo.tgbotapi.utils.ByteReadChannelAllocator
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.call.receive
|
import io.ktor.client.call.receive
|
||||||
@@ -15,6 +16,7 @@ import io.ktor.utils.io.*
|
|||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
@RiskFeature
|
||||||
object DownloadFileChannelRequestCallFactory : KtorCallFactory {
|
object DownloadFileChannelRequestCallFactory : KtorCallFactory {
|
||||||
override suspend fun <T : Any> makeCall(
|
override suspend fun <T : Any> makeCall(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
|
|||||||
@@ -4,12 +4,14 @@ import dev.inmo.micro_utils.coroutines.safely
|
|||||||
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
||||||
import dev.inmo.tgbotapi.requests.DownloadFile
|
import dev.inmo.tgbotapi.requests.DownloadFile
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.request.get
|
import io.ktor.client.request.get
|
||||||
import io.ktor.client.statement.readBytes
|
import io.ktor.client.statement.readBytes
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
@RiskFeature
|
||||||
object DownloadFileRequestCallFactory : KtorCallFactory {
|
object DownloadFileRequestCallFactory : KtorCallFactory {
|
||||||
override suspend fun <T : Any> makeCall(
|
override suspend fun <T : Any> makeCall(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.bot.ktor.base
|
package dev.inmo.tgbotapi.bot.ktor.base
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.KSLog
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import dev.inmo.tgbotapi.utils.mapWithCommonValues
|
import dev.inmo.tgbotapi.utils.mapWithCommonValues
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
@@ -8,7 +10,7 @@ import io.ktor.client.request.forms.*
|
|||||||
import io.ktor.http.Headers
|
import io.ktor.http.Headers
|
||||||
import io.ktor.http.HttpHeaders
|
import io.ktor.http.HttpHeaders
|
||||||
|
|
||||||
class MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
class MultipartRequestCallFactory(logger: KSLog? = null) : AbstractRequestCallFactory(logger ?: DefaultKTgBotAPIKSLog) {
|
||||||
override fun <T : Any> prepareCallBody(
|
override fun <T : Any> prepareCallBody(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.bot.ktor.base
|
package dev.inmo.tgbotapi.bot.ktor.base
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.KSLog
|
||||||
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
import dev.inmo.micro_utils.coroutines.runCatchingSafely
|
||||||
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
import dev.inmo.tgbotapi.bot.BaseRequestsExecutor
|
||||||
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory
|
||||||
@@ -48,6 +49,7 @@ class MultipleClientKtorRequestsExecutor (
|
|||||||
jsonFormatter: Json,
|
jsonFormatter: Json,
|
||||||
pipelineStepsHolder: KtorPipelineStepsHolder,
|
pipelineStepsHolder: KtorPipelineStepsHolder,
|
||||||
requestExecutorsCount: Int,
|
requestExecutorsCount: Int,
|
||||||
|
logger: KSLog,
|
||||||
clientFactory: () -> HttpClient
|
clientFactory: () -> HttpClient
|
||||||
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
||||||
private val requestExecutors = (0 until requestExecutorsCount).map {
|
private val requestExecutors = (0 until requestExecutorsCount).map {
|
||||||
@@ -59,6 +61,7 @@ class MultipleClientKtorRequestsExecutor (
|
|||||||
requestsLimiter,
|
requestsLimiter,
|
||||||
jsonFormatter,
|
jsonFormatter,
|
||||||
pipelineStepsHolder,
|
pipelineStepsHolder,
|
||||||
|
logger,
|
||||||
Unit
|
Unit
|
||||||
)
|
)
|
||||||
}.toSet()
|
}.toSet()
|
||||||
@@ -80,6 +83,7 @@ class MultipleClientKtorRequestsExecutor (
|
|||||||
requestsLimiter: RequestLimiter,
|
requestsLimiter: RequestLimiter,
|
||||||
jsonFormatter: Json,
|
jsonFormatter: Json,
|
||||||
pipelineStepsHolder: KtorPipelineStepsHolder,
|
pipelineStepsHolder: KtorPipelineStepsHolder,
|
||||||
|
logger: KSLog,
|
||||||
diff: Unit
|
diff: Unit
|
||||||
) : this(
|
) : this(
|
||||||
telegramAPIUrlsKeeper,
|
telegramAPIUrlsKeeper,
|
||||||
@@ -89,6 +93,7 @@ class MultipleClientKtorRequestsExecutor (
|
|||||||
jsonFormatter,
|
jsonFormatter,
|
||||||
pipelineStepsHolder,
|
pipelineStepsHolder,
|
||||||
client.engineConfig.threadsCount,
|
client.engineConfig.threadsCount,
|
||||||
|
logger,
|
||||||
{ platformClientCopy(client) }
|
{ platformClientCopy(client) }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
package dev.inmo.tgbotapi.bot.ktor.base
|
package dev.inmo.tgbotapi.bot.ktor.base
|
||||||
|
|
||||||
|
import dev.inmo.kslog.common.KSLog
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.*
|
import dev.inmo.tgbotapi.requests.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
import io.ktor.http.content.TextContent
|
import io.ktor.http.content.TextContent
|
||||||
|
|
||||||
class SimpleRequestCallFactory : AbstractRequestCallFactory() {
|
class SimpleRequestCallFactory(logger: KSLog? = null) : AbstractRequestCallFactory(logger ?: DefaultKTgBotAPIKSLog) {
|
||||||
override fun <T : Any> prepareCallBody(
|
override fun <T : Any> prepareCallBody(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
|
|||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.MessageAction
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.MessagesAction
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.serializer
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class DeleteMessages(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(messageIdsField)
|
||||||
|
override val messageIds: List<MessageId>
|
||||||
|
) : SimpleRequest<Boolean>, MessagesAction {
|
||||||
|
override fun method(): String = "deleteMessages"
|
||||||
|
|
||||||
|
init {
|
||||||
|
require(messageIds.size in deleteMessagesLimit) {
|
||||||
|
"Messages count for deleteMessages must be in $deleteMessagesLimit range"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
get() = Boolean.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.DisableNotification
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.MessagesAction
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
|
|
||||||
|
fun ForwardMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: Array<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = ForwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = messageIds.toList(),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
fun ForwardMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = ForwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = (listOf(messageId) + messageIds.toList()),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ForwardMessages (
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
val toChatId: ChatIdentifier,
|
||||||
|
@SerialName(fromChatIdField)
|
||||||
|
val fromChatId: ChatIdentifier,
|
||||||
|
@SerialName(messageIdsField)
|
||||||
|
override val messageIds: List<MessageId>,
|
||||||
|
@SerialName(messageThreadIdField)
|
||||||
|
override val threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
@SerialName(disableNotificationField)
|
||||||
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
|
@SerialName(removeCaptionField)
|
||||||
|
private val removeCaption: Boolean = false
|
||||||
|
): SimpleRequest<List<MessageId>>,
|
||||||
|
MessagesAction,
|
||||||
|
ProtectContent,
|
||||||
|
OptionallyMessageThreadRequest,
|
||||||
|
DisableNotification {
|
||||||
|
override val chatId: ChatIdentifier
|
||||||
|
get() = fromChatId
|
||||||
|
|
||||||
|
init {
|
||||||
|
require(messageIds.size in forwardMessagesLimit) {
|
||||||
|
"Messages count for forwardMessages must be in $forwardMessagesLimit range"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun method(): String = "forwardMessages"
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<List<MessageId>>
|
||||||
|
get() = ListSerializer(MessageIdSerializer)
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
@@ -1,6 +1,5 @@
|
|||||||
package dev.inmo.tgbotapi.requests
|
package dev.inmo.tgbotapi.requests
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.UpdateSerializerWithoutSerialization
|
import dev.inmo.tgbotapi.types.update.abstracts.UpdateSerializerWithoutSerialization
|
||||||
@@ -15,7 +14,7 @@ private val updatesListSerializer = ListSerializer(
|
|||||||
* Request updates from Telegram Bot API system. It is important, that the result updates WILL NOT include
|
* Request updates from Telegram Bot API system. It is important, that the result updates WILL NOT include
|
||||||
* [dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdate] objects due to the fact,
|
* [dev.inmo.tgbotapi.types.update.MediaGroupUpdates.MediaGroupUpdate] objects due to the fact,
|
||||||
* that it is internal abstraction and in fact any [dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage]
|
* that it is internal abstraction and in fact any [dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage]
|
||||||
* is just a common [dev.inmo.tgbotapi.types.message.abstracts.Message]
|
* is just a common [dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage]
|
||||||
*
|
*
|
||||||
* @see dev.inmo.tgbotapi.extensions.utils.updates.retrieving.updateHandlerWithMediaGroupsAdaptation
|
* @see dev.inmo.tgbotapi.extensions.utils.updates.retrieving.updateHandlerWithMediaGroupsAdaptation
|
||||||
* @see dev.inmo.tgbotapi.utils.convertWithMediaGroupUpdates
|
* @see dev.inmo.tgbotapi.utils.convertWithMediaGroupUpdates
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.commands.*
|
import dev.inmo.tgbotapi.types.commands.*
|
||||||
import dev.inmo.tgbotapi.types.languageCodeField
|
import dev.inmo.tgbotapi.types.languageCodeField
|
||||||
import dev.inmo.tgbotapi.types.scopeField
|
import dev.inmo.tgbotapi.types.scopeField
|
||||||
@@ -14,8 +15,8 @@ data class DeleteMyCommands(
|
|||||||
@Serializable(BotCommandScopeSerializer::class)
|
@Serializable(BotCommandScopeSerializer::class)
|
||||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : MyCommandsRequest<Boolean> {
|
) : MyCommandsRequest<Boolean> {
|
||||||
override fun method(): String = "deleteMyCommands"
|
override fun method(): String = "deleteMyCommands"
|
||||||
override val requestSerializer: SerializationStrategy<DeleteMyCommands>
|
override val requestSerializer: SerializationStrategy<DeleteMyCommands>
|
||||||
@@ -28,7 +29,7 @@ data class DeleteMyCommands(
|
|||||||
languageCode: String?
|
languageCode: String?
|
||||||
) : this(
|
) : this(
|
||||||
scope,
|
scope,
|
||||||
languageCode ?.let(::IetfLanguageCode)
|
languageCode ?.let(::IetfLang)
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object : MyCommandsRequest<Boolean> by DeleteMyCommands()
|
companion object : MyCommandsRequest<Boolean> by DeleteMyCommands()
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.commands.*
|
import dev.inmo.tgbotapi.types.commands.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -15,8 +16,8 @@ data class GetMyCommands(
|
|||||||
@Serializable(BotCommandScopeSerializer::class)
|
@Serializable(BotCommandScopeSerializer::class)
|
||||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : MyCommandsRequest<List<BotCommand>> {
|
) : MyCommandsRequest<List<BotCommand>> {
|
||||||
override fun method(): String = "getMyCommands"
|
override fun method(): String = "getMyCommands"
|
||||||
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
|
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
|
||||||
@@ -29,7 +30,7 @@ data class GetMyCommands(
|
|||||||
languageCode: String?
|
languageCode: String?
|
||||||
) : this(
|
) : this(
|
||||||
scope,
|
scope,
|
||||||
languageCode ?.let(::IetfLanguageCode)
|
languageCode ?.let(::IetfLang)
|
||||||
)
|
)
|
||||||
|
|
||||||
companion object : MyCommandsRequest<List<BotCommand>> by GetMyCommands()
|
companion object : MyCommandsRequest<List<BotCommand>> by GetMyCommands()
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||||
@@ -12,8 +13,8 @@ import kotlinx.serialization.builtins.serializer
|
|||||||
@Serializable
|
@Serializable
|
||||||
class GetMyDescription(
|
class GetMyDescription(
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : SimpleRequest<BotDescription>, WithOptionalLanguageCode {
|
) : SimpleRequest<BotDescription>, WithOptionalLanguageCode {
|
||||||
override fun method(): String = "getMyDescription"
|
override fun method(): String = "getMyDescription"
|
||||||
override val resultDeserializer: DeserializationStrategy<BotDescription>
|
override val resultDeserializer: DeserializationStrategy<BotDescription>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||||
@@ -12,8 +13,8 @@ import kotlinx.serialization.builtins.serializer
|
|||||||
@Serializable
|
@Serializable
|
||||||
class GetMyName(
|
class GetMyName(
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : SimpleRequest<BotName>, WithOptionalLanguageCode {
|
) : SimpleRequest<BotName>, WithOptionalLanguageCode {
|
||||||
override fun method(): String = "getMyName"
|
override fun method(): String = "getMyName"
|
||||||
override val resultDeserializer: DeserializationStrategy<BotName>
|
override val resultDeserializer: DeserializationStrategy<BotName>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||||
@@ -12,8 +13,8 @@ import kotlinx.serialization.builtins.serializer
|
|||||||
@Serializable
|
@Serializable
|
||||||
class GetMyShortDescription(
|
class GetMyShortDescription(
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : SimpleRequest<BotShortDescription>, WithOptionalLanguageCode {
|
) : SimpleRequest<BotShortDescription>, WithOptionalLanguageCode {
|
||||||
override fun method(): String = "getMyShortDescription"
|
override fun method(): String = "getMyShortDescription"
|
||||||
override val resultDeserializer: DeserializationStrategy<BotShortDescription>
|
override val resultDeserializer: DeserializationStrategy<BotShortDescription>
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.commands.*
|
import dev.inmo.tgbotapi.types.commands.*
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
@@ -15,8 +16,8 @@ class SetMyCommands(
|
|||||||
@Serializable(BotCommandScopeSerializer::class)
|
@Serializable(BotCommandScopeSerializer::class)
|
||||||
override val scope: BotCommandScope = BotCommandScopeDefault,
|
override val scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : MyCommandsRequest<Boolean> {
|
) : MyCommandsRequest<Boolean> {
|
||||||
override fun method(): String = "setMyCommands"
|
override fun method(): String = "setMyCommands"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
@@ -31,7 +32,7 @@ class SetMyCommands(
|
|||||||
) : this(
|
) : this(
|
||||||
commands,
|
commands,
|
||||||
scope,
|
scope,
|
||||||
languageCode ?.let(::IetfLanguageCode)
|
languageCode ?.let(::IetfLang)
|
||||||
)
|
)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||||
@@ -14,8 +14,8 @@ class SetMyDescription(
|
|||||||
@SerialName(descriptionField)
|
@SerialName(descriptionField)
|
||||||
val description: String? = null,
|
val description: String? = null,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||||
override fun method(): String = "setMyDescription"
|
override fun method(): String = "setMyDescription"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||||
@@ -14,8 +14,8 @@ class SetMyName(
|
|||||||
@SerialName(nameField)
|
@SerialName(nameField)
|
||||||
val name: String? = null,
|
val name: String? = null,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||||
override fun method(): String = "setMyName"
|
override fun method(): String = "setMyName"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.requests.bot
|
package dev.inmo.tgbotapi.requests.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCodeSerializer
|
import dev.inmo.micro_utils.language_codes.IetfLangSerializer
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
|
||||||
@@ -14,8 +14,8 @@ class SetMyShortDescription(
|
|||||||
@SerialName(shortDescriptionField)
|
@SerialName(shortDescriptionField)
|
||||||
val shortDescription: String? = null,
|
val shortDescription: String? = null,
|
||||||
@SerialName(languageCodeField)
|
@SerialName(languageCodeField)
|
||||||
@Serializable(IetfLanguageCodeSerializer::class)
|
@Serializable(IetfLangSerializer::class)
|
||||||
override val ietfLanguageCode: IetfLanguageCode? = null
|
override val ietfLanguageCode: IetfLang? = null
|
||||||
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
) : SimpleRequest<Boolean>, WithOptionalLanguageCode {
|
||||||
override fun method(): String = "setMyShortDescription"
|
override fun method(): String = "setMyShortDescription"
|
||||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.requests.edit.abstracts
|
|
||||||
|
|
||||||
interface EditDisableWebPagePreviewMessage {
|
|
||||||
val disableWebPagePreview: Boolean?
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.edit.abstracts
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer
|
||||||
|
|
||||||
|
interface EditLinkPreviewOptionsContainer : LinkPreviewOptionsContainer
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("EditLinkPreviewOptionsContainer", "dev.inmo.tgbotapi.requests.edit.abstracts.EditLinkPreviewOptionsContainer"))
|
||||||
|
typealias EditDisableWebPagePreviewMessage = EditLinkPreviewOptionsContainer
|
||||||
@@ -22,7 +22,7 @@ fun EditChatMessageText(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditChatMessageText(
|
) = EditChatMessageText(
|
||||||
chatId,
|
chatId,
|
||||||
@@ -30,7 +30,7 @@ fun EditChatMessageText(
|
|||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ fun EditChatMessageText(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditChatMessageText(
|
) = EditChatMessageText(
|
||||||
chatId,
|
chatId,
|
||||||
@@ -46,7 +46,7 @@ fun EditChatMessageText(
|
|||||||
entities.makeString(),
|
entities.makeString(),
|
||||||
null,
|
null,
|
||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -62,11 +62,11 @@ data class EditChatMessageText internal constructor(
|
|||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(entitiesField)
|
@SerialName(entitiesField)
|
||||||
private val rawEntities: List<RawMessageEntity>? = null,
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(linkPreviewOptionsField)
|
||||||
override val disableWebPagePreview: Boolean? = null,
|
override val linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditChatMessage<TextContent>, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
) : EditChatMessage<TextContent>, EditTextChatMessage, EditReplyMessage, EditLinkPreviewOptionsContainer {
|
||||||
override val textSources: TextSourcesList? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextSources(text)
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,28 +16,28 @@ fun EditInlineMessageText(
|
|||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditInlineMessageText(
|
) = EditInlineMessageText(
|
||||||
inlineMessageId,
|
inlineMessageId,
|
||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
fun EditInlineMessageText(
|
fun EditInlineMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = EditInlineMessageText(
|
) = EditInlineMessageText(
|
||||||
inlineMessageId,
|
inlineMessageId,
|
||||||
entities.makeString(),
|
entities.makeString(),
|
||||||
null,
|
null,
|
||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -51,11 +51,11 @@ data class EditInlineMessageText internal constructor(
|
|||||||
override val parseMode: ParseMode? = null,
|
override val parseMode: ParseMode? = null,
|
||||||
@SerialName(entitiesField)
|
@SerialName(entitiesField)
|
||||||
private val rawEntities: List<RawMessageEntity>? = null,
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(linkPreviewOptionsField)
|
||||||
override val disableWebPagePreview: Boolean? = null,
|
override val linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
@SerialName(replyMarkupField)
|
@SerialName(replyMarkupField)
|
||||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
|
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditLinkPreviewOptionsContainer {
|
||||||
override val textSources: TextSourcesList? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextSources(text)
|
rawEntities ?.asTextSources(text)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.get
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ChatRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.UserChatBoosts
|
||||||
|
import kotlinx.serialization.DeserializationStrategy
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlinx.serialization.SerializationStrategy
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class GetUserChatBoosts(
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
override val chatId: ChatIdentifier,
|
||||||
|
@SerialName(userIdField)
|
||||||
|
val userId: UserId
|
||||||
|
) : SimpleRequest<UserChatBoosts>, ChatRequest {
|
||||||
|
override fun method(): String = "getUserChatBoosts"
|
||||||
|
override val resultDeserializer: DeserializationStrategy<UserChatBoosts>
|
||||||
|
get() = UserChatBoosts.serializer()
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package dev.inmo.tgbotapi.requests.send
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.DisableNotification
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.MessagesAction
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.ProtectContent
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
|
||||||
|
import dev.inmo.tgbotapi.requests.send.abstracts.OptionallyMessageThreadRequest
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.types.message.*
|
||||||
|
import dev.inmo.tgbotapi.types.message.toRawMessageEntities
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.makeString
|
||||||
|
import kotlinx.serialization.*
|
||||||
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
|
|
||||||
|
fun CopyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageIds: Array<MessageId>,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = CopyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = messageIds.toList(),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
fun CopyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = CopyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = (listOf(messageId) + messageIds.toList()),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CopyMessages (
|
||||||
|
@SerialName(chatIdField)
|
||||||
|
val toChatId: ChatIdentifier,
|
||||||
|
@SerialName(fromChatIdField)
|
||||||
|
val fromChatId: ChatIdentifier,
|
||||||
|
@SerialName(messageIdsField)
|
||||||
|
override val messageIds: List<MessageId>,
|
||||||
|
@SerialName(messageThreadIdField)
|
||||||
|
override val threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
@SerialName(disableNotificationField)
|
||||||
|
override val disableNotification: Boolean = false,
|
||||||
|
@SerialName(protectContentField)
|
||||||
|
override val protectContent: Boolean = false,
|
||||||
|
@SerialName(removeCaptionField)
|
||||||
|
private val removeCaption: Boolean = false
|
||||||
|
): SimpleRequest<List<MessageId>>,
|
||||||
|
MessagesAction,
|
||||||
|
ProtectContent,
|
||||||
|
OptionallyMessageThreadRequest,
|
||||||
|
DisableNotification {
|
||||||
|
override val chatId: ChatIdentifier
|
||||||
|
get() = fromChatId
|
||||||
|
|
||||||
|
init {
|
||||||
|
require(messageIds.size in copyMessagesLimit) {
|
||||||
|
"Messages count for copyMessages must be in $copyMessagesLimit range"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun method(): String = "copyMessages"
|
||||||
|
|
||||||
|
override val resultDeserializer: DeserializationStrategy<List<MessageId>>
|
||||||
|
get() = ListSerializer(MessageIdSerializer)
|
||||||
|
override val requestSerializer: SerializationStrategy<*>
|
||||||
|
get() = serializer()
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.requests.send
|
package dev.inmo.tgbotapi.requests.send
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.abstracts.types.DisableWebPagePreview
|
import dev.inmo.tgbotapi.abstracts.types.LinkPreviewOptionsContainer
|
||||||
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
import dev.inmo.tgbotapi.requests.send.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
@@ -24,7 +24,7 @@ fun SendTextMessage(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -37,7 +37,7 @@ fun SendTextMessage(
|
|||||||
parseMode,
|
parseMode,
|
||||||
null,
|
null,
|
||||||
threadId,
|
threadId,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@@ -48,7 +48,7 @@ fun SendTextMessage(
|
|||||||
fun SendTextMessage(
|
fun SendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
@@ -61,7 +61,7 @@ fun SendTextMessage(
|
|||||||
null,
|
null,
|
||||||
entities.toRawMessageEntities(),
|
entities.toRawMessageEntities(),
|
||||||
threadId,
|
threadId,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@@ -81,8 +81,8 @@ data class SendTextMessage internal constructor(
|
|||||||
private val rawEntities: List<RawMessageEntity>? = null,
|
private val rawEntities: List<RawMessageEntity>? = null,
|
||||||
@SerialName(messageThreadIdField)
|
@SerialName(messageThreadIdField)
|
||||||
override val threadId: MessageThreadId? = chatId.threadId,
|
override val threadId: MessageThreadId? = chatId.threadId,
|
||||||
@SerialName(disableWebPagePreviewField)
|
@SerialName(linkPreviewOptionsField)
|
||||||
override val disableWebPagePreview: Boolean? = null,
|
override val linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
@SerialName(disableNotificationField)
|
@SerialName(disableNotificationField)
|
||||||
override val disableNotification: Boolean = false,
|
override val disableNotification: Boolean = false,
|
||||||
@SerialName(protectContentField)
|
@SerialName(protectContentField)
|
||||||
@@ -96,7 +96,7 @@ data class SendTextMessage internal constructor(
|
|||||||
) : SendMessageRequest<ContentMessage<TextContent>>,
|
) : SendMessageRequest<ContentMessage<TextContent>>,
|
||||||
ReplyingMarkupSendMessageRequest<ContentMessage<TextContent>>,
|
ReplyingMarkupSendMessageRequest<ContentMessage<TextContent>>,
|
||||||
TextableSendMessageRequest<ContentMessage<TextContent>>,
|
TextableSendMessageRequest<ContentMessage<TextContent>>,
|
||||||
DisableWebPagePreview
|
LinkPreviewOptionsContainer
|
||||||
{
|
{
|
||||||
override val textSources: TextSourcesList? by lazy {
|
override val textSources: TextSourcesList? by lazy {
|
||||||
rawEntities ?.asTextSources(text)
|
rawEntities ?.asTextSources(text)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user