1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-29 10:55:42 +00:00

Compare commits

..

2 Commits

Author SHA1 Message Date
71001b772a Update CHANGELOG.md 2023-06-30 15:15:13 +06:00
449f7f836f Update libs.versions.toml 2023-06-30 15:13:36 +06:00
588 changed files with 5434 additions and 51169 deletions

View File

@@ -5,9 +5,6 @@ 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:

View File

@@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-java@v1 - uses: actions/setup-java@v1
with: with:
java-version: 17 java-version: 11
- name: Build - name: Build
run: ./gradlew dokkaHtmlMultiModule run: ./gradlew dokkaHtmlMultiModule
- name: Publish KDocs - name: Publish KDocs

View File

@@ -7,9 +7,9 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-java@v1 - uses: actions/setup-java@v1
with: with:
java-version: 17 java-version: 11
- name: Setup LibCurl - name: Setup LibCurl
run: sudo apt update && sudo apt install -y libcurl4-openssl-dev run: sudo apt install -y libcurl4-openssl-dev
- name: Rewrite version - name: Rewrite version
run: | run: |
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`" branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
@@ -20,14 +20,11 @@ jobs:
run: ./gradlew ksp run: ./gradlew ksp
- name: Build - name: Build
run: ./gradlew build run: ./gradlew build
- name: API compatibility check
run: ./gradlew apiCheck
- name: Publish to Gitea - name: Publish to Gitea
continue-on-error: true continue-on-error: true
run: ./gradlew publishAllPublicationsToInmoNexusRepository run: ./gradlew publishAllPublicationsToGiteaRepository
env: env:
INMONEXUS_USER: ${{ secrets.INMONEXUS_USER }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
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

View File

@@ -1,230 +1,9 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 14.0.1 ## 8.1.1
* In `core` and `api` modules related to invoices changed their APIs to suite current API
## 14.0.0
**Add support of [Telegram Bots API 7.4](https://core.telegram.org/bots/api-changelog#may-28-2024)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* `TelegramPaymentChargeId` has been added as value class and replaced raw strings in `SuccessfulPayment` type of `telegramPaymentChargeId`
* All the methods/classes related to sending of messages got `effectId` parameter
* All the methods/classes related to sending of photos/animations/videos got `showCaptionAboveMedia` parameter
## 13.0.0
**Add support of [Telegram Bots API 7.3](https://core.telegram.org/bots/api-changelog#may-6-2024)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* For polls, `textSources` now means `question` text sources. For `QuizPoll` there are `explanation` and `explanationTextSources`
for hinting
* `API`:
* A lot of API related to `Poll`s has been changed to include opportunity to pass `ParseMode` and `TextSource`s list
## 12.0.1
* `Version`:
* `Ktor`: `2.3.9` -> `2.3.10`
* `MicroUtils`: `0.20.39` -> `0.20.45`
* `UUID`: `0.8.2` -> `0.8.4`
## 12.0.0
**Add support of [Telegram Bots API 7.2](https://core.telegram.org/bots/api-changelog#march-31-2024)**
**THIS UPDATE CONTAINS A LOT OF BREAKING CHANGES**
## 11.0.0
**THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS**
**THIS UPDATE CONTAINS A LOT OF BREAKING CHANGES**
* `Core`:
* `MessageId` now is `value class`. `MessageIdentifier` become deprecated
* `MessageThreadId` now is `value class`
* `InlineQueryIdentifier` now is `value class`
* `MediaGroupIdentifier` has been renamed to `MediaGroupId` and now is `value class`
* `CallbackQueryIdentifier` has been renamed to `CallbackQueryId` and now is `value class`
* `WebAppQueryId` now is `value class`
* `PreCheckoutQueryId` now is `value class`
* `FileUniqueId` has been renamed to `TgFileUniqueId` and now is `value class`
* `UpdateIdentifier` has been renamed to `UpdateId` and now is `value class`
* `InlineMessageIdentifier` has been renamed to `InlineMessageId` and now is `value class`
* `ShippingQueryIdentifier` has been renamed to `ShippingQueryId` and now is `value class`
* `Identifier` has been renamed to `RawChatId` and now is `value class`
* `ShippingOptionIdentifier` has been renamed to `ShippingOptionId` and now is `value class`
* `PollIdentifier` has been renamed to `PollId` and now is `value class`
* `StickerSetName` now is `value class`
## 10.1.2
* `Version`:
* `Kotlin`: `1.9.22` -> `1.9.23`
* `Korlibs`: `5.3.2` -> `5.4.0`
* `Ktor`: `2.3.8` -> `2.3.9`
* `MicroUtils`: `0.20.37` -> `0.20.39`
* `KSLog`: `1.3.2` -> `1.3.3`
## 10.1.1
* `Version`:
* `Serialization`: `1.6.2` -> `1.6.3`
* `MicroUtils`: `0.20.34` -> `0.20.37`
* `Korlibs`: `5.3.1` -> `5.3.2`
## 10.1.0
**Add support of [Telegram Bots API 7.1](https://core.telegram.org/bots/api-changelog#february-16-2024)**
* `Version`:
* `Coroutines`: `1.7.3` -> `1.8.0`
* `MicroUtils`: `0.20.32` -> `0.20.34`
## 10.0.1
* `Version`:
* `Ktor`: `2.3.7` -> `2.3.8`
* `MicroUtils`: `0.20.26` -> `0.20.32`
* `Korlibs`: `5.3.0` -> `5.3.1`
* `KSLog`: `1.3.1` -> `1.3.2`
## 10.0.0
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**
**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**
* `Version`:
* `MicroUtils`: `0.20.23` -> `0.20.26`
* `Korlibs`: `4.0.10` -> `5.3.0`
* `Core`:
* `Message` now inherited by two variants: `AccessibleMessage` and `InaccessibleMessage`
* `Common`:
* In most places `disableWebPagePreview` has been replaced by new `LinkPreviewOptions`
* In most places arguments `replyToMessageId` and `allowSendingWithoutReply` has been replaced with
`ReplyParameters`
* In `reply` extension two parameters have been added: `replyInChatId` and `replyInThreadId`
## 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
This release become possible thanks to [Anton Lakotka](https://youtrack.jetbrains.com/users/anton.lakotka)
**THIS RELEASE CONTAINS UPDATES UP TO RELEASE CANDIDATES VERSIONS**
**UPDATE MAY HAVE BREAKING CHANGES**
**SINCE THIS UPDATE IT WILL BE REQUIRED TO USE JDK 17+ FOR DEVELOPMENT**
* `Version`:
* `Kotlin`: `1.8.22` -> `1.9.20`
* `Serialization`: `1.5.1` -> `1.6.0`
* `KorLibs`: `4.0.3` -> `4.0.10`
* `UUID`: `0.7.1` -> `0.8.1`
* `Ktor`: `2.3.4` -> `2.3.5`
* `MicroUtils`: `0.19.9` -> `0.20.12`
## 9.2.4
* `Utils`:
* New extensions `*.parseCommandsWithNamedArgs`
* `BehaviourBuilder`:
* In expectaters and triggers of `commands` add `*WithNamedArgs` variants
* In expectaters and triggers of `commands` add opportunity to use custom separator
## 9.2.3
* `Core`:
* Fix in `VoiceContent#createResend`
## 9.2.2
* `Core`:
* Fix of [#793](https://github.com/InsanusMokrassar/ktgbotapi/issues/793): Add `PreviewChat`
## 9.2.1
* `Version`:
* `Ktor`: `2.3.3` -> `2.3.4`
* `Core`:
* All `ChatMember` inheritors have fixes `status` field
## 9.2.0
**Add support of [Telegram Bots API 6.9](https://core.telegram.org/bots/api-changelog#september-22-2023)**
* Rename `ChatAdministratorRightsImpl` -> `ChatCommonAdministratorRights`
* All the request chat keyboards has changed their parameters `ChatAdministratorRights` to `ChatCommonAdministratorRights`
## 9.1.2
* `Core`:
* Fix of `MessageContent` serialization
## 9.1.1
* `Core`:
* Potential fix of incorrect parsing in `RawMessageEntity`
## 9.1.0
**This update contains adding of [Telegram Bot API 6.8](https://core.telegram.org/bots/api-changelog#august-18-2023) support**
* `Version`:
* `Coroutines`: `1.7.2` -> `1.7.3`
* `Ktor`: `2.3.2` -> `2.3.3`
* `MicroUtils`: `0.19.7` -> `0.19.9`
## 9.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES: USERNAMES OF BOTS NOW BECAME NULLABLE** **THIS UPDATE CONTAINS BREAKING CHANGES: USERNAMES OF BOTS NOW BECAME NULLABLE**
* `Version`:
* `Coroutines`: `1.6.4` -> `1.7.1`
* `Ktor`: `2.3.1` -> `2.3.2`
* `MicroUtils`: `0.19.4` -> `0.19.7`
* `Core`:
* **All bots now have nullable usernames just like common users ([#772](https://github.com/InsanusMokrassar/ktgbotapi/issues/772))**
* Decrease possible errors in updates handling by additional handling of update deserialization wrapping ([#773](https://github.com/InsanusMokrassar/ktgbotapi/issues/773))
* New interface `GetUpdatesRequest`. You may implement it to show default telegram bot ktor executor that this
request is an updates request and should be handled in a different way
* Now it is possible to get raw updates with `GetUpdatesRaw` request
* `Utils`: * `Utils`:
* Improve extension `Update.sourceChat` to add opportunity to select some chats by logic different with the default * Improve extension `Update.sourceChat` to add opportunity to select some chats by logic different with the default

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-7.4-blue)](https://core.telegram.org/bots/api-changelog#may-28-2024) # TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-6.7-blue)](https://core.telegram.org/bots/api-changelog#april-21-2023)
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) | | Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| |:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
@@ -118,5 +118,5 @@ suspend fun main() {
### More examples ### More examples
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and always welcome in our [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and
[chat](https://t.me/InMoTelegramBotAPIChat). [chat](https://t.me/InMoTelegramBotAPIChat).

View File

@@ -16,8 +16,6 @@ buildscript {
plugins { plugins {
alias(libs.plugins.kotlin.dokka) alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.versions)
alias(libs.plugins.validator)
} }
// 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
@@ -26,7 +24,7 @@ allprojects {
mavenLocal() mavenLocal()
mavenCentral() mavenCentral()
google() google()
maven { url "https://nexus.inmo.dev/repository/maven-releases/" } maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
} }
if (it != rootProject.findProject("docs")) { if (it != rootProject.findProject("docs")) {
tasks.whenTaskAdded { task -> tasks.whenTaskAdded { task ->
@@ -55,13 +53,13 @@ if (new File(projectDir, "secret.gradle").exists()) {
githubRelease { githubRelease {
token "${project.property('GITHUB_RELEASE_TOKEN')}" token "${project.property('GITHUB_RELEASE_TOKEN')}"
owner = "InsanusMokrassar" owner "InsanusMokrassar"
repo = "TelegramBotAPI" repo "TelegramBotAPI"
tagName = "v$library_version" tagName "v$library_version"
releaseName = "$library_version" releaseName "$library_version"
targetCommitish = "$library_version" targetCommitish "$library_version"
body = getCurrentVersionChangelog() body getCurrentVersionChangelog()
} }
} }

View File

@@ -54,8 +54,8 @@ Object callback = {
skipDeprecated.set(true) skipDeprecated.set(true)
sourceLink { sourceLink {
localDirectory.set(file("../")) localDirectory.set(file("./"))
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/ktgbotapi/tree/master")) remoteUrl.set(new URL("https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/"))
remoteLineSuffix.set("#L") remoteLineSuffix.set("#L")
} }
} }

View File

@@ -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=14.0.1 library_version=8.1.1

View File

@@ -1,27 +1,22 @@
[versions] [versions]
kotlin = "1.9.23" kotlin = "1.8.22"
kotlin-serialization = "1.6.3" kotlin-serialization = "1.5.1"
kotlin-coroutines = "1.8.0" kotlin-coroutines = "1.7.2"
javax-activation = "1.1.1" javax-activation = "1.1.1"
korlibs = "5.4.0" korlibs = "4.0.3"
uuid = "0.8.4" uuid = "0.7.1"
ktor = "2.3.10" ktor = "2.3.2"
ksp = "1.9.23-1.0.20" ksp = "1.8.22-1.0.11"
kotlin-poet = "1.16.0" kotlin-poet = "1.14.2"
microutils = "0.20.45" microutils = "0.19.7"
kslog = "1.3.3"
versions = "0.51.0" github-release-plugin = "2.4.1"
dokka = "1.8.20"
github-release-plugin = "2.5.2"
dokka = "1.9.20"
validator = "0.14.0"
[libraries] [libraries]
@@ -43,12 +38,11 @@ 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.korge:korlibs-time", version.ref = "korlibs" } korlibs-klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "korlibs" }
korlibs-krypto = { module = "com.soywiz.korge:korlibs-crypto", version.ref = "korlibs" } korlibs-krypto = { module = "com.soywiz.korlibs.krypto:krypto", 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" }
@@ -58,8 +52,6 @@ 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" }
@@ -79,5 +71,3 @@ 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" }
validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "validator" }

View File

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

View File

@@ -5,7 +5,7 @@ kotlin {
jvm { jvm {
compilations.main { compilations.main {
kotlinOptions { kotlinOptions {
jvmTarget = "17" jvmTarget = "1.8"
} }
} }
} }
@@ -15,7 +15,6 @@ kotlin {
} }
linuxX64() linuxX64()
mingwX64() mingwX64()
linuxArm64()
sourceSets { sourceSets {
commonMain { commonMain {
@@ -41,18 +40,10 @@ kotlin {
implementation libs.kotlin.test.junit implementation libs.kotlin.test.junit
} }
} }
all {
languageSettings {
optIn('dev.inmo.tgbotapi.utils.RiskFeature')
optIn('dev.inmo.tgbotapi.utils.PreviewFeature')
optIn('dev.inmo.micro_utils.common.Warning')
optIn('dev.inmo.micro_utils.common.PreviewFeature')
}
}
} }
} }
java { java {
sourceCompatibility = JavaVersion.VERSION_17 sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_1_8
} }

View File

@@ -1,7 +1,8 @@
apply plugin: 'maven-publish' apply plugin: 'maven-publish'
task javadocsJar(type: Jar) { task javadocsJar(type: Jar) {
archiveClassifier = 'javadoc' archiveClassifier.convention("javadoc")
archiveClassifier.set("javadoc")
} }
publishing { publishing {
@@ -19,22 +20,22 @@ publishing {
} }
developers { developers {
developer { developer {
id = "InsanusMokrassar" id = "InsanusMokrassar"
name = "Ovsiannikov Aleksei" name = "Ovsiannikov Aleksei"
email = "ovsyannikov.alexey95@gmail.com" email = "ovsyannikov.alexey95@gmail.com"
} }
} }
licenses { licenses {
license { license {
name = "Apache Software License 2.0" name = "Apache Software License 2.0"
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE" url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
} }
} }
} }
repositories { repositories {
@@ -42,77 +43,58 @@ publishing {
maven { maven {
name = "GithubPackages" name = "GithubPackages"
url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI") url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI")
credentials { credentials {
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER') username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD') password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
} }
} }
} }
if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) { if (project.hasProperty('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
maven { maven {
name = "InmoNexus" name = "Gitea"
url = uri("https://nexus.inmo.dev/repository/maven-releases/") url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
credentials { credentials(HttpHeaderCredentials) {
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER') name = "Authorization"
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD') value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
} }
authentication {
header(HttpHeaderAuthentication)
}
} }
} }
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) { if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
maven { maven {
name = "sonatype" name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials { credentials {
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER') username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD') password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
} }
} }
} }
} }
} }
} }
if (project.hasProperty("signing.gnupg.keyName")) { if (project.hasProperty("signing.gnupg.keyName")) {
apply plugin: 'signing' apply plugin: 'signing'
signing { signing {
useGpgCmd() useGpgCmd()
sign publishing.publications sign publishing.publications
} }
task signAll { task signAll {
tasks.withType(Sign).forEach { tasks.withType(Sign).forEach {
dependsOn(it) dependsOn(it)
} }
} }
// Workaround to make android sign operations depend on signing tasks
project.getTasks().withType(AbstractPublishToMaven.class).configureEach {
def signingTasks = project.getTasks().withType(Sign.class)
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)
}
}
} }

View File

@@ -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":"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"}}} {"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"}}}

File diff suppressed because it is too large Load Diff

View File

@@ -16,9 +16,6 @@ kotlin {
api project(":tgbotapi.core") api project(":tgbotapi.core")
} }
} }
configureEach {
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
}
} }
} }

View File

@@ -6,8 +6,9 @@ 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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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,
@@ -22,7 +23,7 @@ suspend fun TelegramBot.deleteMessage(
) = deleteMessage(chat.id, messageId) ) = deleteMessage(chat.id, messageId)
suspend fun TelegramBot.deleteMessage( suspend fun TelegramBot.deleteMessage(
message: AccessibleMessage message: Message
): Boolean { ): Boolean {
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>) val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
if (mediaGroupContent == null) { if (mediaGroupContent == null) {
@@ -45,9 +46,9 @@ suspend fun TelegramBot.delete(
) = deleteMessage(chat, messageId) ) = deleteMessage(chat, messageId)
suspend fun TelegramBot.delete( suspend fun TelegramBot.delete(
message: AccessibleMessage message: Message
) = deleteMessage(message) ) = deleteMessage(message)
suspend fun AccessibleMessage.delete( suspend fun Message.delete(
requestsExecutor: TelegramBot requestsExecutor: TelegramBot
) = requestsExecutor.deleteMessage(this) ) = requestsExecutor.deleteMessage(this)

View File

@@ -1,61 +0,0 @@
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
import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName
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(
messagesMetas: List<Message.MetaInfo>
) = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
deleteMessages(
chatId = chatId,
messageIds = messages.map { it.messageId }
)
}.all { it }
@JvmName("deleteMessagesWithMessages")
suspend fun TelegramBot.deleteMessages(
messages: List<AccessibleMessage>
) = deleteMessages(messages.map { it.metaInfo })
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(
messagesMetas: List<Message.MetaInfo>
) = deleteMessages(messagesMetas)
@JvmName("deleteWithMessages")
suspend fun TelegramBot.delete(
messages: List<AccessibleMessage>
) = deleteMessages(messages)

View File

@@ -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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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: AccessibleMessage, message: Message,
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: AccessibleMessage, message: Message,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false

View File

@@ -1,154 +0,0 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.send.copyMessages
import dev.inmo.tgbotapi.requests.ForwardMessages
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName
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,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
forwardMessages(
toChatId = toChatId,
fromChatId = chatId,
messageIds = messages.map { it.messageId },
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
}
@JvmName("forwardMessagesWithMessages")
suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo },
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,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
messagesMetas = messagesMetas,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
@JvmName("forwardWithMessages")
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
)

View File

@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
suspend fun TelegramBot.getUpdates( suspend fun TelegramBot.getUpdates(
offset: UpdateId? = null, offset: UpdateIdentifier? = null,
limit: Int = getUpdatesLimit.last, limit: Int = getUpdatesLimit.last,
timeout: Seconds? = null, timeout: Seconds? = null,
allowed_updates: List<String>? = ALL_UPDATES_LIST allowed_updates: List<String>? = ALL_UPDATES_LIST

View File

@@ -1,26 +0,0 @@
package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.GetUpdatesRaw
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.update.abstracts.Update
suspend fun TelegramBot.getRawUpdates(
offset: UpdateId? = null,
limit: Int = getUpdatesLimit.last,
timeout: Seconds? = null,
allowed_updates: List<String>? = ALL_UPDATES_LIST
) = execute(
GetUpdatesRaw(
offset, limit, timeout, allowed_updates
)
)
suspend fun TelegramBot.getRawUpdates(
lastUpdate: Update,
limit: Int = getUpdatesLimit.last,
timeout: Seconds? = null,
allowed_updates: List<String>? = ALL_UPDATES_LIST
) = getRawUpdates(
lastUpdate.updateId + 1, limit, timeout, allowed_updates
)

View File

@@ -1,6 +1,6 @@
package dev.inmo.tgbotapi.extensions.api.InternalUtils package dev.inmo.tgbotapi.extensions.api.InternalUtils
import dev.inmo.tgbotapi.types.MediaGroupId import dev.inmo.tgbotapi.types.MediaGroupIdentifier
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
import dev.inmo.tgbotapi.types.update.* import dev.inmo.tgbotapi.types.update.*
@@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.utils.extensions.asMediaGroupMessage
*/ */
internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> { internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
val resultUpdates = mutableListOf<Update>() val resultUpdates = mutableListOf<Update>()
val mediaGroups = mutableMapOf<MediaGroupId, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>() val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>()
for (update in this) { for (update in this) {
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let { val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {

View File

@@ -9,7 +9,6 @@ import dev.inmo.tgbotapi.extensions.api.edit.edit
import dev.inmo.tgbotapi.extensions.api.send.send import dev.inmo.tgbotapi.extensions.api.send.send
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
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.Location
@@ -43,60 +42,50 @@ suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<EditLiveLocationInfo>, locationsFlow: Flow<EditLiveLocationInfo>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) { ) {
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null var currentLiveLocationMessage: ContentMessage<LocationContent>? = null
val updateMessageJob = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { // do not launch refreshing of message for indefinite live locations val updateMessageJob = CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
null while (isActive) {
} else { delay(liveTimeMillis)
CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) { // Remove previous location message info to resend live location message
while (isActive) { currentLiveLocationMessage = null
delay(liveTimeMillis)
// Remove previous location message info to resend live location message
currentLiveLocationMessage = null
}
} }
} }
locationsFlow.collect { locationsFlow.collect {
val capturedLiveLocationMessage = currentLiveLocationMessage val capturedLiveLocationMessage = currentLiveLocationMessage
if (capturedLiveLocationMessage == null) { if (capturedLiveLocationMessage == null) {
updateMessageJob ?.start() updateMessageJob.start()
currentLiveLocationMessage = send( currentLiveLocationMessage = send(
chatId, chatId,
it.latitude, it.latitude,
it.longitude, it.longitude,
if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { ceil(liveTimeMillis.toDouble() / 1000).toInt(),
LiveLocation.INDEFINITE_LIVE_PERIOD
} else {
ceil(liveTimeMillis.toDouble() / 1000).toInt()
},
it.horizontalAccuracy, it.horizontalAccuracy,
it.heading, it.heading,
it.proximityAlertRadius, it.proximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
it.replyMarkup it.replyMarkup
).also { ).also {
sentMessageFlow ?.emit(it) sentMessageFlow ?.emit(it)
} }
} else { } else {
edit( edit(
message = capturedLiveLocationMessage, capturedLiveLocationMessage,
latitude = it.latitude, it.latitude,
longitude = it.longitude, it.longitude,
horizontalAccuracy = it.horizontalAccuracy, it.horizontalAccuracy,
heading = it.heading, it.heading,
proximityAlertRadius = it.proximityAlertRadius, it.proximityAlertRadius,
replyMarkup = it.replyMarkup it.replyMarkup
).also { ).also {
sentMessageFlow ?.emit(it) sentMessageFlow ?.emit(it)
} }
@@ -115,16 +104,15 @@ suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<Location>, locationsFlow: Flow<Location>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) { ) {
handleLiveLocation( handleLiveLocation(
chatId = chatId, chatId,
locationsFlow = locationsFlow.map { locationsFlow.map {
EditLiveLocationInfo( EditLiveLocationInfo(
it.latitude, it.latitude,
it.longitude, it.longitude,
@@ -134,14 +122,13 @@ suspend fun TelegramBot.handleLiveLocation(
(it as? WithReplyMarkup) ?.replyMarkup as? InlineKeyboardMarkup (it as? WithReplyMarkup) ?.replyMarkup as? InlineKeyboardMarkup
) )
}, },
liveTimeMillis = liveTimeMillis, liveTimeMillis,
threadId = threadId, threadId,
businessConnectionId = businessConnectionId, disableNotification,
disableNotification = disableNotification, protectContent,
protectContent = protectContent, replyToMessageId,
effectId = effectId, allowSendingWithoutReply,
replyParameters = replyParameters, sentMessageFlow
sentMessageFlow = sentMessageFlow
) )
} }
@@ -156,28 +143,26 @@ suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<Pair<Double, Double>>, locationsFlow: Flow<Pair<Double, Double>>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
) { ) {
handleLiveLocation( handleLiveLocation(
chatId = chatId, chatId,
locationsFlow = locationsFlow.map { (lat, long) -> locationsFlow.map { (lat, long) ->
EditLiveLocationInfo( EditLiveLocationInfo(
lat, lat,
long long
) )
}, },
liveTimeMillis = liveTimeMillis, liveTimeMillis,
threadId = threadId, threadId,
businessConnectionId = businessConnectionId, disableNotification,
disableNotification = disableNotification, protectContent,
protectContent = protectContent, replyToMessageId,
effectId = effectId, allowSendingWithoutReply,
replyParameters = replyParameters, sentMessageFlow
sentMessageFlow = sentMessageFlow
) )
} }

View File

@@ -2,29 +2,41 @@ 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.business_connection.BusinessConnectionId
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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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
const val indefiniteLivePeriodDelayMillis = LiveLocation.INDEFINITE_LIVE_PERIOD * 1000L val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
const val defaultLivePeriodDelayMillis = indefiniteLivePeriodDelayMillis
/** /**
* @see startLiveLocation * @see startLiveLocation
@@ -96,11 +108,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider { ): LiveLocationProvider {
val liveTimeAsDouble = liveTimeMillis.toDouble() val liveTimeAsDouble = liveTimeMillis.toDouble()
@@ -114,11 +125,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -145,11 +155,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope,
@@ -161,11 +170,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -182,11 +190,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope,
@@ -198,11 +205,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -219,11 +225,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope,
@@ -235,11 +240,10 @@ suspend fun TelegramBot.startLiveLocation(
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -248,7 +252,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: AccessibleMessage, to: Message,
scope: CoroutineScope, scope: CoroutineScope,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
@@ -257,10 +261,8 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull, threadId: MessageThreadId? = to.threadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = startLiveLocation( ) = startLiveLocation(
@@ -273,11 +275,10 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, to.messageId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -286,7 +287,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: AccessibleMessage, to: Message,
scope: CoroutineScope, scope: CoroutineScope,
location: StaticLocation, location: StaticLocation,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
@@ -294,10 +295,8 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull, threadId: MessageThreadId? = to.threadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = startLiveLocation( ) = startLiveLocation(
@@ -309,10 +308,9 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading, initHeading,
initProximityAlertRadius, initProximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, to.messageId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@@ -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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
/** /**
* @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: AccessibleMessage, message: Message,
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: AccessibleMessage, message: Message,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = stopPoll(chat.id, message.messageId, replyMarkup) ) = stopPoll(chat.id, message.messageId, replyMarkup)

View File

@@ -3,10 +3,10 @@ package dev.inmo.tgbotapi.extensions.api.answers
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
import dev.inmo.tgbotapi.types.CallbackQueryId import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
suspend fun TelegramBot.answerCallbackQuery( suspend fun TelegramBot.answerCallbackQuery(
callbackQueryId: CallbackQueryId, callbackQueryId: CallbackQueryIdentifier,
text: String? = null, text: String? = null,
showAlert: Boolean? = null, showAlert: Boolean? = null,
url: String? = null, url: String? = null,

View File

@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.answers.AnswerInlineQuery
import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
import dev.inmo.tgbotapi.types.InlineQueryId import dev.inmo.tgbotapi.types.InlineQueryIdentifier
suspend fun TelegramBot.answerInlineQuery( suspend fun TelegramBot.answerInlineQuery(
inlineQueryID: InlineQueryId, inlineQueryID: InlineQueryIdentifier,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
@@ -37,7 +37,7 @@ suspend fun TelegramBot.answer(
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button) ) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
suspend fun TelegramBot.answerInlineQuery( suspend fun TelegramBot.answerInlineQuery(
inlineQueryID: InlineQueryId, inlineQueryID: InlineQueryIdentifier,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
isPersonal: Boolean? = null, isPersonal: Boolean? = null,

View File

@@ -3,12 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.answers.payments
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryError import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryError
import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryOk import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryOk
import dev.inmo.tgbotapi.types.ShippingQueryId import dev.inmo.tgbotapi.types.ShippingQueryIdentifier
import dev.inmo.tgbotapi.types.payments.ShippingOption import dev.inmo.tgbotapi.types.payments.ShippingOption
import dev.inmo.tgbotapi.types.payments.ShippingQuery import dev.inmo.tgbotapi.types.payments.ShippingQuery
suspend fun TelegramBot.answerShippingQueryOk( suspend fun TelegramBot.answerShippingQueryOk(
id: ShippingQueryId, id: ShippingQueryIdentifier,
shippingOptions: List<ShippingOption> shippingOptions: List<ShippingOption>
) = execute(AnswerShippingQueryOk(id, shippingOptions)) ) = execute(AnswerShippingQueryOk(id, shippingOptions))
suspend fun TelegramBot.answerShippingQueryOk( suspend fun TelegramBot.answerShippingQueryOk(
@@ -17,7 +17,7 @@ suspend fun TelegramBot.answerShippingQueryOk(
) = answerShippingQueryOk(shippingQuery.id, shippingOptions) ) = answerShippingQueryOk(shippingQuery.id, shippingOptions)
suspend fun TelegramBot.answerShippingQueryError( suspend fun TelegramBot.answerShippingQueryError(
id: ShippingQueryId, id: ShippingQueryIdentifier,
error: String error: String
) = execute(AnswerShippingQueryError(id, error)) ) = execute(AnswerShippingQueryError(id, error))
suspend fun TelegramBot.answerShippingQueryError( suspend fun TelegramBot.answerShippingQueryError(

View File

@@ -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.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? languageCode: IetfLanguageCode?
) = 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(::IetfLang)) ) = deleteMyCommands(scope, languageCode ?.let(::IetfLanguageCode))

View File

@@ -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.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? = null languageCode: IetfLanguageCode? = 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(::IetfLang)) ) = getMyCommands(scope, languageCode ?.let(::IetfLanguageCode))

View File

@@ -1,13 +1,16 @@
package dev.inmo.tgbotapi.extensions.api.bot package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.micro_utils.language_codes.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? = null languageCode: IetfLanguageCode? = null
) = execute(GetMyDescription(languageCode)) ) = execute(GetMyDescription(languageCode))
suspend fun TelegramBot.getMyDescription( suspend fun TelegramBot.getMyDescription(
languageCode: String? languageCode: String?
) = getMyDescription(languageCode ?.let(::IetfLang)) ) = getMyDescription(languageCode ?.let(::IetfLanguageCode))

View File

@@ -1,13 +1,16 @@
package dev.inmo.tgbotapi.extensions.api.bot package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.micro_utils.language_codes.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? = null languageCode: IetfLanguageCode? = null
) = execute(GetMyName(languageCode)) ) = execute(GetMyName(languageCode))
suspend fun TelegramBot.getMyName( suspend fun TelegramBot.getMyName(
languageCode: String? languageCode: String?
) = getMyName(languageCode ?.let(::IetfLang)) ) = getMyName(languageCode ?.let(::IetfLanguageCode))

View File

@@ -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.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? = null languageCode: IetfLanguageCode? = null
) = execute(GetMyShortDescription(languageCode)) ) = execute(GetMyShortDescription(languageCode))
suspend fun TelegramBot.getMyShortDescription( suspend fun TelegramBot.getMyShortDescription(
languageCode: String? languageCode: String?
) = getMyShortDescription(languageCode ?.let(::IetfLang)) ) = getMyShortDescription(languageCode ?.let(::IetfLanguageCode))

View File

@@ -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.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? languageCode: IetfLanguageCode?
) = 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: IetfLang? languageCode: IetfLanguageCode?
) = 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(::IetfLang)) ) = setMyCommands(commands, scope, languageCode ?.let(::IetfLanguageCode))
suspend fun TelegramBot.setMyCommands( suspend fun TelegramBot.setMyCommands(
vararg commands: BotCommand, vararg commands: BotCommand,

View File

@@ -2,17 +2,17 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.SetMyDefaultAdministratorRights import dev.inmo.tgbotapi.requests.bot.SetMyDefaultAdministratorRights
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
suspend fun TelegramBot.setMyDefaultAdministratorRights( suspend fun TelegramBot.setMyDefaultAdministratorRights(
rights: ChatCommonAdministratorRights, rights: ChatAdministratorRightsImpl,
forChannels: Boolean? = null forChannels: Boolean? = null
) = execute(SetMyDefaultAdministratorRights(rights, forChannels)) ) = execute(SetMyDefaultAdministratorRights(rights, forChannels))
suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels( suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
rights: ChatCommonAdministratorRights rights: ChatAdministratorRightsImpl
) = setMyDefaultAdministratorRights(rights, forChannels = true) ) = setMyDefaultAdministratorRights(rights, forChannels = true)
suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups( suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
rights: ChatCommonAdministratorRights rights: ChatAdministratorRightsImpl
) = setMyDefaultAdministratorRights(rights, forChannels = false) ) = setMyDefaultAdministratorRights(rights, forChannels = false)

View File

@@ -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.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? = null languageCode: IetfLanguageCode? = 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(::IetfLang)) ) = setMyDescription(description, languageCode ?.let(::IetfLanguageCode))

View File

@@ -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.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? = null languageCode: IetfLanguageCode? = 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(::IetfLang)) ) = setMyName(name, languageCode ?.let(::IetfLanguageCode))

View File

@@ -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.IetfLang import dev.inmo.micro_utils.language_codes.IetfLanguageCode
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: IetfLang? = null languageCode: IetfLanguageCode? = 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(::IetfLang)) ) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLanguageCode))

View File

@@ -1,21 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.chat.forum
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.UnpinAllForumTopicMessages
import dev.inmo.tgbotapi.requests.chat.forum.UnpinAllGeneralForumTopicMessages
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
chatId: ChatIdentifier
) = execute(
UnpinAllGeneralForumTopicMessages(
chatId
)
)
suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
chat: Chat
) = unpinAllGeneralForumTopicMessages(chat.id)

View File

@@ -1,157 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.PromoteChannelAdministrator
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.promoteChannelAdministrator(
chatId: ChatIdentifier,
userId: UserId,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canPostMessages: Boolean? = null,
canEditMessages: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = execute(
PromoteChannelAdministrator(
chatId = chatId,
userId = userId,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canPostMessages = canPostMessages,
canEditMessages = canEditMessages,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
)
)
suspend fun TelegramBot.promoteChannelAdministrator(
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canPostMessages: Boolean? = null,
canEditMessages: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = promoteChannelAdministrator(
chat.id,
userId,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canPostMessages = canPostMessages,
canEditMessages = canEditMessages,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
)
suspend fun TelegramBot.promoteChannelAdministrator(
chatId: IdChatIdentifier,
user: User,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canPostMessages: Boolean? = null,
canEditMessages: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = promoteChannelAdministrator(
chatId,
user.id,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canPostMessages = canPostMessages,
canEditMessages = canEditMessages,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
)
suspend fun TelegramBot.promoteChannelAdministrator(
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canPostMessages: Boolean? = null,
canEditMessages: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = promoteChannelAdministrator(
chat.id,
user.id,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canPostMessages = canPostMessages,
canEditMessages = canEditMessages,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
)

View File

@@ -1,116 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.promoteChatAdministrator(
chatId: ChatIdentifier,
userId: UserId,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
) = execute(
PromoteChatMember(
chatId,
userId,
untilDate,
isAnonymous,
canChangeInfo,
canDeleteMessages,
canInviteUsers,
canRestrictMembers,
canPromoteMembers,
canManageVideoChats,
canManageChat
)
)
suspend fun TelegramBot.promoteChatAdministrator(
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
) = promoteChatAdministrator(
chat.id,
userId,
untilDate,
isAnonymous,
canChangeInfo,
canDeleteMessages,
canInviteUsers,
canRestrictMembers,
canPromoteMembers,
canManageVideoChats,
canManageChat
)
suspend fun TelegramBot.promoteChatAdministrator(
chatId: IdChatIdentifier,
user: User,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
) = promoteChatAdministrator(
chatId,
user.id,
untilDate,
isAnonymous,
canChangeInfo,
canDeleteMessages,
canInviteUsers,
canRestrictMembers,
canPromoteMembers,
canManageVideoChats,
canManageChat
)
suspend fun TelegramBot.promoteChatAdministrator(
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
) = promoteChatAdministrator(
chat.id,
user.id,
untilDate,
isAnonymous,
canChangeInfo,
canDeleteMessages,
canInviteUsers,
canRestrictMembers,
canPromoteMembers,
canManageVideoChats,
canManageChat
)

View File

@@ -1,13 +1,14 @@
package dev.inmo.tgbotapi.extensions.api.chat.members package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.micro_utils.common.Warning
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
@Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId, userId: UserId,
@@ -23,34 +24,27 @@ suspend fun TelegramBot.promoteChatMember(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = execute( ) = execute(
PromoteChatMember( PromoteChatMember(
chatId = chatId, chatId,
userId = userId, userId,
untilDate = untilDate, untilDate,
isAnonymous = isAnonymous, isAnonymous,
canChangeInfo = canChangeInfo, canChangeInfo,
canPostMessages = canPostMessages, canPostMessages,
canEditMessages = canEditMessages, canEditMessages,
canDeleteMessages = canDeleteMessages, canDeleteMessages,
canInviteUsers = canInviteUsers, canInviteUsers,
canRestrictMembers = canRestrictMembers, canRestrictMembers,
canPinMessages = canPinMessages, canPinMessages,
canPromoteMembers = canPromoteMembers, canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats,
canManageChat = canManageChat, canManageChat,
canManageTopics = canManageTopics, canManageTopics
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
) )
) )
@Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
@@ -66,32 +60,25 @@ suspend fun TelegramBot.promoteChatMember(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chat.id, chat.id,
userId, userId,
untilDate = untilDate, untilDate,
isAnonymous = isAnonymous, isAnonymous,
canChangeInfo = canChangeInfo, canChangeInfo,
canPostMessages = canPostMessages, canPostMessages,
canEditMessages = canEditMessages, canEditMessages,
canDeleteMessages = canDeleteMessages, canDeleteMessages,
canInviteUsers = canInviteUsers, canInviteUsers,
canRestrictMembers = canRestrictMembers, canRestrictMembers,
canPinMessages = canPinMessages, canPinMessages,
canPromoteMembers = canPromoteMembers, canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats,
canManageChat = canManageChat, canManageChat,
canManageTopics = canManageTopics, canManageTopics
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
) )
@Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
@@ -107,32 +94,25 @@ suspend fun TelegramBot.promoteChatMember(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chatId, chatId,
user.id, user.id,
untilDate = untilDate, untilDate,
isAnonymous = isAnonymous, isAnonymous,
canChangeInfo = canChangeInfo, canChangeInfo,
canPostMessages = canPostMessages, canPostMessages,
canEditMessages = canEditMessages, canEditMessages,
canDeleteMessages = canDeleteMessages, canDeleteMessages,
canInviteUsers = canInviteUsers, canInviteUsers,
canRestrictMembers = canRestrictMembers, canRestrictMembers,
canPinMessages = canPinMessages, canPinMessages,
canPromoteMembers = canPromoteMembers, canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats,
canManageChat = canManageChat, canManageChat,
canManageTopics = canManageTopics, canManageTopics
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
) )
@Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( suspend fun TelegramBot.promoteChatMember(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
@@ -148,27 +128,21 @@ suspend fun TelegramBot.promoteChatMember(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
) = promoteChatMember( ) = promoteChatMember(
chat.id, chat.id,
user.id, user.id,
untilDate = untilDate, untilDate,
isAnonymous = isAnonymous, isAnonymous,
canChangeInfo = canChangeInfo, canChangeInfo,
canPostMessages = canPostMessages, canPostMessages,
canEditMessages = canEditMessages, canEditMessages,
canDeleteMessages = canDeleteMessages, canDeleteMessages,
canInviteUsers = canInviteUsers, canInviteUsers,
canRestrictMembers = canRestrictMembers, canRestrictMembers,
canPinMessages = canPinMessages, canPinMessages,
canPromoteMembers = canPromoteMembers, canPromoteMembers,
canManageVideoChats = canManageVideoChats, canManageVideoChats,
canManageChat = canManageChat, canManageChat,
canManageTopics = canManageTopics, canManageTopics
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
) )

View File

@@ -1,133 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
import dev.inmo.tgbotapi.requests.chat.members.PromoteSupergroupAdministrator
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.promoteSupergroupAdministrator(
chatId: ChatIdentifier,
userId: UserId,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
) = execute(
PromoteSupergroupAdministrator(
chatId = chatId,
userId = userId,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPinMessages = canPinMessages,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
)
)
suspend fun TelegramBot.promoteSupergroupAdministrator(
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
) = promoteSupergroupAdministrator(
chat.id,
userId,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPinMessages = canPinMessages,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
)
suspend fun TelegramBot.promoteSupergroupAdministrator(
chatId: IdChatIdentifier,
user: User,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
) = promoteSupergroupAdministrator(
chatId,
user.id,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPinMessages = canPinMessages,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
)
suspend fun TelegramBot.promoteSupergroupAdministrator(
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null,
isAnonymous: Boolean? = null,
canChangeInfo: Boolean? = null,
canDeleteMessages: Boolean? = null,
canInviteUsers: Boolean? = null,
canRestrictMembers: Boolean? = null,
canPinMessages: Boolean? = null,
canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null,
canManageTopics: Boolean? = null,
) = promoteSupergroupAdministrator(
chat.id,
user.id,
untilDate = untilDate,
isAnonymous = isAnonymous,
canChangeInfo = canChangeInfo,
canDeleteMessages = canDeleteMessages,
canInviteUsers = canInviteUsers,
canRestrictMembers = canRestrictMembers,
canPinMessages = canPinMessages,
canPromoteMembers = canPromoteMembers,
canManageVideoChats = canManageVideoChats,
canManageChat = canManageChat,
canManageTopics = canManageTopics
)

View File

@@ -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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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: AccessibleMessage, message: Message,
disableNotification: Boolean = false disableNotification: Boolean = false
) = pinChatMessage(message.chat.id, message.messageId, disableNotification) ) = pinChatMessage(message.chat.id, message.messageId, disableNotification)

View File

@@ -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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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: AccessibleMessage message: Message
) = unpinChatMessage(message.chat.id, message.messageId) ) = unpinChatMessage(message.chat.id, message.messageId)

View File

@@ -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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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
@@ -29,10 +29,9 @@ suspend fun <T> TelegramBot.edit(
message: ContentMessage<T>, message: ContentMessage<T>,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent { ): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
return editMessageCaption(message, text, parseMode, showCaptionAboveMedia, replyMarkup) return editMessageCaption(message, text, parseMode, replyMarkup)
} }
/** /**
@@ -42,10 +41,9 @@ suspend fun <T> TelegramBot.edit(
suspend fun <T> TelegramBot.edit( suspend fun <T> TelegramBot.edit(
message: ContentMessage<T>, message: ContentMessage<T>,
entities: List<TextSource>, entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent { ): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
return editMessageCaption(message, entities, showCaptionAboveMedia, replyMarkup) return editMessageCaption(message, entities, replyMarkup)
} }
/** /**
@@ -57,12 +55,11 @@ suspend fun TelegramBot.edit(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chatId, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, 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]
@@ -73,12 +70,11 @@ suspend fun TelegramBot.edit(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(chat, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, 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]
@@ -88,12 +84,11 @@ suspend fun TelegramBot.edit(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(message, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, 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]
@@ -186,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: AccessibleMessage, message: Message,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(message, replyMarkup) ) = editMessageReplyMarkup(message, replyMarkup)
@@ -199,9 +194,9 @@ suspend fun TelegramBot.edit(
messageId: MessageId, messageId: MessageId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(chatId, messageId, text, parseMode, linkPreviewOptions, replyMarkup) ) = editMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, 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]
@@ -211,9 +206,9 @@ suspend fun TelegramBot.edit(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(chatId, messageId, entities, linkPreviewOptions, replyMarkup) ) = editMessageText(chatId, messageId, entities, disableWebPagePreview, 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]
@@ -223,10 +218,10 @@ suspend fun TelegramBot.edit(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -236,10 +231,10 @@ suspend fun TelegramBot.edit(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -249,9 +244,9 @@ suspend fun TelegramBot.edit(
message: ContentMessage<TextContent>, message: ContentMessage<TextContent>,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = edit(message.chat.id, message.messageId, text, parseMode, linkPreviewOptions, replyMarkup) ) = edit(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, 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]
@@ -260,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,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = edit(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup) ) = edit(message.chat.id, message.messageId, entities, disableWebPagePreview, 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]
@@ -271,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,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -283,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,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -295,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,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -307,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,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)

View File

@@ -1,15 +1,21 @@
package dev.inmo.tgbotapi.extensions.api.edit package dev.inmo.tgbotapi.extensions.api.edit
import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption
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.media.editMessageMedia import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia
import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
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.location.LiveLocation 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.Message
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
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
@@ -20,7 +26,7 @@ import dev.inmo.tgbotapi.utils.buildEntities
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
@@ -34,7 +40,7 @@ suspend fun TelegramBot.edit(
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation( ) = editLiveLocation(
@@ -46,7 +52,7 @@ suspend fun TelegramBot.edit(
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
media: TelegramMedia, media: TelegramMedia,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageMedia(messageId, media, replyMarkup) ) = editMessageMedia(messageId, media, replyMarkup)
@@ -56,7 +62,7 @@ suspend fun TelegramBot.edit(
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(messageId, replyMarkup) ) = editMessageReplyMarkup(messageId, replyMarkup)
@@ -65,48 +71,44 @@ suspend fun TelegramBot.edit(
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false, disableWebPagePreview: Boolean? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(messageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ) = editMessageText(messageId, text, parseMode, disableWebPagePreview, 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.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false, disableWebPagePreview: Boolean? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(messageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ) = editMessageText(messageId, entities, disableWebPagePreview, 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.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
showCaptionAboveMedia: Boolean = false,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ) = edit(messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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.edit( suspend fun TelegramBot.edit(
messageId: InlineMessageId, messageId: InlineMessageIdentifier,
separator: String, separator: String,
showCaptionAboveMedia: Boolean = false, disableWebPagePreview: Boolean? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = edit(messageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ) = edit(messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)

View File

@@ -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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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
@@ -24,10 +24,9 @@ suspend fun TelegramBot.editMessageCaption(
messageId: MessageId, messageId: MessageId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageCaption(chatId, messageId, text, parseMode, showCaptionAboveMedia, replyMarkup) EditChatMessageCaption(chatId, messageId, text, parseMode, replyMarkup)
) )
/** /**
@@ -39,9 +38,8 @@ suspend fun TelegramBot.editMessageCaption(
messageId: MessageId, messageId: MessageId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageCaption(chat.id, messageId, text, parseMode, showCaptionAboveMedia, replyMarkup) ) = editMessageCaption(chat.id, messageId, text, parseMode, 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]
@@ -51,11 +49,10 @@ suspend fun <T> TelegramBot.editMessageCaption(
message: ContentMessage<T>, message: ContentMessage<T>,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent { ): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, showCaptionAboveMedia, replyMarkup) as ContentMessage<T> return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup) as ContentMessage<T>
} }
/** /**
@@ -66,10 +63,9 @@ suspend fun TelegramBot.editMessageCaption(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageCaption(chatId, messageId, entities, showCaptionAboveMedia, replyMarkup) EditChatMessageCaption(chatId, messageId, entities, replyMarkup)
) )
/** /**
@@ -80,9 +76,8 @@ suspend fun TelegramBot.editMessageCaption(
chat: Chat, chat: Chat,
messageId: MessageId, messageId: MessageId,
entities: List<TextSource>, entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageCaption(chat.id, messageId, entities, showCaptionAboveMedia, replyMarkup) ) = editMessageCaption(chat.id, messageId, entities, 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]
@@ -91,11 +86,10 @@ suspend fun TelegramBot.editMessageCaption(
suspend fun <T> TelegramBot.editMessageCaption( suspend fun <T> TelegramBot.editMessageCaption(
message: ContentMessage<T>, message: ContentMessage<T>,
entities: List<TextSource>, entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent { ): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
return editMessageCaption(message.chat.id, message.messageId, entities, showCaptionAboveMedia, replyMarkup) as ContentMessage<T> return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup) as ContentMessage<T>
} }
/** /**
@@ -104,10 +98,9 @@ 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: AccessibleMessage, message: Message,
entities: List<TextSource>, entities: List<TextSource>,
showCaptionAboveMedia: Boolean = false,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent { ): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
return editMessageCaption(message.chat.id, message.messageId, entities, showCaptionAboveMedia, replyMarkup) return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup)
} }

View File

@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.caption
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption
import dev.inmo.tgbotapi.types.InlineMessageId import dev.inmo.tgbotapi.types.InlineMessageIdentifier
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
@@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.editMessageCaption( suspend fun TelegramBot.editMessageCaption(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
@@ -23,7 +23,7 @@ suspend fun TelegramBot.editMessageCaption(
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.editMessageCaption( suspend fun TelegramBot.editMessageCaption(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup)) ) = execute(EditInlineMessageCaption(inlineMessageId, entities, replyMarkup))

View File

@@ -18,14 +18,13 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageLiveLocation( EditChatMessageLiveLocation(
chatId, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup chatId, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup
) )
) )
@@ -38,12 +37,11 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageId, messageId: MessageId,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(chat.id, messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, 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]
@@ -53,12 +51,11 @@ suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
livePeriod: Seconds? = null,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup) ) = editLiveLocation(message.chat, message.messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, 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]
@@ -71,7 +68,7 @@ suspend fun TelegramBot.editLiveLocation(
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageLiveLocation( EditChatMessageLiveLocation(
chatId, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup chatId, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup
) )
) )
@@ -84,7 +81,7 @@ suspend fun TelegramBot.editLiveLocation(
messageId: MessageId, messageId: MessageId,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) ) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, 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]
@@ -94,4 +91,4 @@ suspend fun TelegramBot.editLiveLocation(
message: ContentMessage<LocationContent>, message: ContentMessage<LocationContent>,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.livePeriod, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) ) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.location.LiveLocation
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
horizontalAccuracy: Meters? = null, horizontalAccuracy: Meters? = null,
@@ -20,7 +20,7 @@ suspend fun TelegramBot.editLiveLocation(
) )
) )
suspend fun TelegramBot.editLiveLocation( suspend fun TelegramBot.editLiveLocation(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup) ) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)

View File

@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.location.live
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation
import dev.inmo.tgbotapi.types.InlineMessageId import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
/** /**
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.stopLiveLocation( suspend fun TelegramBot.stopLiveLocation(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
StopInlineMessageLiveLocation( StopInlineMessageLiveLocation(

View File

@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.media.EditInlineMessageMedia import dev.inmo.tgbotapi.requests.edit.media.EditInlineMessageMedia
import dev.inmo.tgbotapi.types.InlineMessageId import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.media.TelegramMedia import dev.inmo.tgbotapi.types.media.TelegramMedia
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.editMessageMedia( suspend fun TelegramBot.editMessageMedia(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
media: TelegramMedia, media: TelegramMedia,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup)) ) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))

View File

@@ -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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
/** /**
* @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: AccessibleMessage, message: Message,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup) ) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)

View File

@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup import dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup
import dev.inmo.tgbotapi.types.InlineMessageId import dev.inmo.tgbotapi.types.InlineMessageIdentifier
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
/** /**
@@ -10,6 +10,6 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.editMessageReplyMarkup( suspend fun TelegramBot.editMessageReplyMarkup(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup)) ) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))

View File

@@ -3,14 +3,13 @@ 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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
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.*
@@ -24,10 +23,10 @@ suspend fun TelegramBot.editMessageText(
messageId: MessageId, messageId: MessageId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageText(chatId, messageId, text, parseMode, linkPreviewOptions, replyMarkup) EditChatMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
) )
/** /**
@@ -39,9 +38,9 @@ suspend fun TelegramBot.editMessageText(
messageId: MessageId, messageId: MessageId,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(chat.id, messageId, text, parseMode, linkPreviewOptions, replyMarkup) ) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, 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]
@@ -51,9 +50,9 @@ suspend fun TelegramBot.editMessageText(
message: ContentMessage<TextContent>, message: ContentMessage<TextContent>,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(message.chat.id, message.messageId, text, parseMode, linkPreviewOptions, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, 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]
@@ -63,10 +62,10 @@ suspend fun TelegramBot.editMessageText(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
EditChatMessageText(chatId, messageId, entities, linkPreviewOptions, replyMarkup) EditChatMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
) )
/** /**
@@ -77,10 +76,10 @@ suspend fun TelegramBot.editMessageText(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -90,10 +89,10 @@ suspend fun TelegramBot.editMessageText(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -103,9 +102,9 @@ suspend fun TelegramBot.editMessageText(
chat: Chat, chat: Chat,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(chat.id, messageId, entities, linkPreviewOptions, replyMarkup) ) = editMessageText(chat.id, messageId, entities, disableWebPagePreview, 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]
@@ -115,10 +114,10 @@ suspend fun TelegramBot.editMessageText(
chat: Chat, chat: Chat,
messageId: MessageId, messageId: MessageId,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -128,10 +127,10 @@ suspend fun TelegramBot.editMessageText(
chat: Chat, chat: Chat,
messageId: MessageId, messageId: MessageId,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -140,9 +139,9 @@ suspend fun TelegramBot.editMessageText(
suspend fun TelegramBot.editMessageText( suspend fun TelegramBot.editMessageText(
message: ContentMessage<TextContent>, message: ContentMessage<TextContent>,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, 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]
@@ -151,10 +150,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,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -163,10 +162,10 @@ suspend fun TelegramBot.editMessageText(
suspend fun TelegramBot.editMessageText( suspend fun TelegramBot.editMessageText(
message: ContentMessage<TextContent>, message: ContentMessage<TextContent>,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -174,11 +173,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: AccessibleMessage, message: Message,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, 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]
@@ -186,12 +185,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: AccessibleMessage, message: Message,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, 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]
@@ -199,9 +198,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: AccessibleMessage, message: Message,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup) ) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)

View File

@@ -2,8 +2,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.InlineMessageId 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
@@ -16,48 +15,44 @@ import dev.inmo.tgbotapi.utils.buildEntities
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.editMessageText( suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false, disableWebPagePreview: Boolean? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)) ) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, 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.editMessageText( suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false, disableWebPagePreview: Boolean? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageText(inlineMessageId, entities, showCaptionAboveMedia, linkPreviewOptions, replyMarkup)) ) = execute(EditInlineMessageText(inlineMessageId, entities, disableWebPagePreview, 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.editMessageText( suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
separator: TextSource? = null, separator: TextSource? = null,
showCaptionAboveMedia: Boolean = false, disableWebPagePreview: Boolean? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, 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.editMessageText( suspend fun TelegramBot.editMessageText(
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
separator: String, separator: String,
showCaptionAboveMedia: Boolean = false, disableWebPagePreview: Boolean? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
replyMarkup: InlineKeyboardMarkup? = null, replyMarkup: InlineKeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), showCaptionAboveMedia, linkPreviewOptions, replyMarkup) ) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)

View File

@@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
suspend fun TelegramBot.getGameScore( suspend fun TelegramBot.getGameScore(
userId: UserId, userId: UserId,
inlineMessageId: InlineMessageId inlineMessageId: InlineMessageIdentifier
) = execute( ) = execute(
GetGameHighScoresByInlineMessageId( GetGameHighScoresByInlineMessageId(
userId, inlineMessageId userId, inlineMessageId
@@ -16,5 +16,5 @@ suspend fun TelegramBot.getGameScore(
suspend fun TelegramBot.getGameScore( suspend fun TelegramBot.getGameScore(
user: CommonUser, user: CommonUser,
inlineMessageId: InlineMessageId inlineMessageId: InlineMessageIdentifier
) = getGameScore(user.id, inlineMessageId) ) = getGameScore(user.id, inlineMessageId)

View File

@@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.CommonUser
suspend fun TelegramBot.setGameScore( suspend fun TelegramBot.setGameScore(
userId: UserId, userId: UserId,
score: Long, score: Long,
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
) = execute( ) = execute(
@@ -20,7 +20,7 @@ suspend fun TelegramBot.setGameScore(
suspend fun TelegramBot.setGameScore( suspend fun TelegramBot.setGameScore(
user: CommonUser, user: CommonUser,
score: Long, score: Long,
inlineMessageId: InlineMessageId, inlineMessageId: InlineMessageIdentifier,
force: Boolean = false, force: Boolean = false,
disableEditMessage: Boolean = false disableEditMessage: Boolean = false
) = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage) ) = setGameScore(user.id, score, inlineMessageId, force, disableEditMessage)

View File

@@ -1,17 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.get
import dev.inmo.micro_utils.common.Warning
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.get.GetBusinessConnection
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
suspend fun TelegramBot.getBusinessConnection(
id: BusinessConnectionId
) = execute(GetBusinessConnection(businessConnectionId = id))
@Warning("This method may lead to error due to raw String type usage")
suspend fun TelegramBot.getBusinessConnection(
id: String
) = getBusinessConnection(
BusinessConnectionId(id)
)

View File

@@ -2,21 +2,14 @@ package dev.inmo.tgbotapi.extensions.api.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.get.GetStickerSet import dev.inmo.tgbotapi.requests.get.GetStickerSet
import dev.inmo.tgbotapi.types.StickerSetName
import dev.inmo.tgbotapi.types.files.Sticker import dev.inmo.tgbotapi.types.files.Sticker
suspend fun TelegramBot.getStickerSet( suspend fun TelegramBot.getStickerSet(
name: StickerSetName name: String
) = execute( ) = execute(
GetStickerSet(name) GetStickerSet(name)
) )
suspend fun TelegramBot.getStickerSet(
name: String
) = getStickerSet(
StickerSetName(name)
)
suspend fun TelegramBot.getStickerSetOrNull( suspend fun TelegramBot.getStickerSetOrNull(
sticker: Sticker sticker: Sticker
) = sticker.stickerSetName ?.let { ) = sticker.stickerSetName ?.let {

View File

@@ -1,19 +0,0 @@
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)

View File

@@ -2,12 +2,15 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.CopyMessage import dev.inmo.tgbotapi.requests.send.CopyMessage
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
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.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.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.Message
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -19,11 +22,11 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
CopyMessage( CopyMessage(
@@ -32,11 +35,11 @@ suspend inline fun TelegramBot.copyMessage(
toChatId, toChatId,
text, text,
parseMode, parseMode,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -51,13 +54,13 @@ suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, 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
@@ -69,13 +72,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, 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
@@ -87,13 +90,13 @@ suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@@ -105,11 +108,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
CopyMessage( CopyMessage(
@@ -117,11 +120,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
toChatId, toChatId,
entities, entities,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -135,13 +138,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChatId, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChatId, entities, 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
@@ -152,13 +155,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChat: Chat, toChat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChatId, messageId, toChat.id, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(fromChatId, messageId, toChat.id, entities, 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
@@ -169,13 +172,13 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
toChat: Chat, toChat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(fromChat.id, messageId, toChat.id, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(fromChat.id, messageId, toChat.id, entities, 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
@@ -183,16 +186,16 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
message: AccessibleMessage, message: Message,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, 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
@@ -200,16 +203,16 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
message: AccessibleMessage, message: Message,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, 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
@@ -217,15 +220,15 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
message: AccessibleMessage, message: Message,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChatId, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChatId, entities, 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
@@ -233,15 +236,15 @@ suspend inline fun TelegramBot.copyMessage(
*/ */
suspend inline fun TelegramBot.copyMessage( suspend inline fun TelegramBot.copyMessage(
toChat: Chat, toChat: Chat,
message: AccessibleMessage, message: Message,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage(message.chat, message.messageId, toChat, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup) ) = copyMessage(message.chat, message.messageId, toChat, entities, 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
@@ -253,11 +256,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
CopyMessage( CopyMessage(
@@ -266,11 +269,11 @@ suspend inline fun TelegramBot.copyMessage(
toChatId, toChatId,
text, text,
parseMode, parseMode,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -285,11 +288,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage( ) = copyMessage(
toChatId, toChatId,
@@ -297,11 +300,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
text, text,
parseMode, parseMode,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -315,11 +318,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage( ) = copyMessage(
toChat.id, toChat.id,
@@ -327,11 +330,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
text, text,
parseMode, parseMode,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -345,11 +348,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId: MessageId, messageId: MessageId,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage( ) = copyMessage(
toChat.id, toChat.id,
@@ -357,11 +360,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
text, text,
parseMode, parseMode,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -375,11 +378,11 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
CopyMessage( CopyMessage(
@@ -387,11 +390,11 @@ suspend inline fun TelegramBot.copyMessage(
messageId, messageId,
toChatId, toChatId,
entities, entities,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -405,22 +408,22 @@ suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage( ) = copyMessage(
toChatId, toChatId,
fromChat.id, fromChat.id,
messageId, messageId,
entities, entities,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -433,22 +436,22 @@ suspend inline fun TelegramBot.copyMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage( ) = copyMessage(
toChat.id, toChat.id,
fromChatId, fromChatId,
messageId, messageId,
entities, entities,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -461,21 +464,21 @@ suspend inline fun TelegramBot.copyMessage(
fromChat: Chat, fromChat: Chat,
messageId: MessageId, messageId: MessageId,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = copyMessage( ) = copyMessage(
toChat.id, toChat.id,
fromChat.id, fromChat.id,
messageId, messageId,
entities, entities,
showCaptionAboveMedia,
threadId, threadId,
disableNotification, disableNotification,
protectContent, protectContent,
replyParameters, replyToMessageId,
allowSendingWithoutReply,
replyMarkup replyMarkup
) )

View File

@@ -1,153 +0,0 @@
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
import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName
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,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
copyMessages(
toChatId = toChatId,
fromChatId = chatId,
messageIds = messages.map { it.messageId },
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
}
@JvmName("copyMessagesWithMessages")
suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo },
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = messageIds,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
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,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
messagesMetas = messagesMetas,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
@JvmName("copyWithMessages")
suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = copyMessages(
toChatId = toChatId,
messages = messages,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)

View File

@@ -1,11 +1,14 @@
package dev.inmo.tgbotapi.extensions.api.send package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
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.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MessageContent import dev.inmo.tgbotapi.types.message.content.MessageContent
import dev.inmo.tgbotapi.types.threadId
/** /**
* This method will send [content] to the [chatId] as is * This method will send [content] to the [chatId] as is
@@ -16,8 +19,8 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chatId.threadId, messageThreadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
content.createResend( content.createResend(
@@ -25,14 +28,14 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId, messageThreadId = messageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
) as ContentMessage<T> ) as ContentMessage<T>
/** /**
* This method will send [content] to the [chat] as is * This method will send [content] to the [chatId] as is
*/ */
suspend inline fun <T : MessageContent> TelegramBot.resend( suspend inline fun <T : MessageContent> TelegramBot.resend(
chat: Chat, chat: Chat,
@@ -40,8 +43,8 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chat.id.threadId, messageThreadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = resend( ) = resend(
chatId = chat.id, chatId = chat.id,
@@ -49,8 +52,8 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId, messageThreadId = messageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -65,8 +68,8 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chatId.threadId, messageThreadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = resend( ) = resend(
chatId = chatId, chatId = chatId,
@@ -74,8 +77,8 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId, messageThreadId = messageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -90,8 +93,8 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId: MessageThreadId? = chat.id.threadId, messageThreadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = resend( ) = resend(
chatId = chat.id, chatId = chat.id,
@@ -99,7 +102,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
messageThreadId = messageThreadId, messageThreadId = messageThreadId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )

View File

@@ -5,152 +5,127 @@ import dev.inmo.tgbotapi.requests.send.SendAction
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.actions.* import dev.inmo.tgbotapi.types.actions.*
import dev.inmo.tgbotapi.types.businessConnectionId
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.threadId import dev.inmo.tgbotapi.types.threadId
suspend fun TelegramBot.sendBotAction( suspend fun TelegramBot.sendBotAction(
chatId: ChatIdentifier, chatId: ChatIdentifier,
action: BotAction, action: BotAction,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
) = execute( ) = execute(
SendAction(chatId, action, threadId, businessConnectionId) SendAction(chatId, action, threadId)
) )
suspend fun TelegramBot.sendBotAction( suspend fun TelegramBot.sendBotAction(
chat: Chat, chat: Chat,
action: BotAction, action: BotAction,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat.id, action, threadId)
) = sendBotAction(chat.id, action, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionTyping( suspend fun TelegramBot.sendActionTyping(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, TypingAction, threadId)
) = sendBotAction(chatId, TypingAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadPhoto( suspend fun TelegramBot.sendActionUploadPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, UploadPhotoAction, threadId)
) = sendBotAction(chatId, UploadPhotoAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionRecordVideo( suspend fun TelegramBot.sendActionRecordVideo(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, RecordVideoAction, threadId)
) = sendBotAction(chatId, RecordVideoAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadVideo( suspend fun TelegramBot.sendActionUploadVideo(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, UploadVideoAction, threadId)
) = sendBotAction(chatId, UploadVideoAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionRecordVoice( suspend fun TelegramBot.sendActionRecordVoice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, RecordVoiceAction, threadId)
) = sendBotAction(chatId, RecordVoiceAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadVoice( suspend fun TelegramBot.sendActionUploadVoice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, UploadVoiceAction, threadId)
) = sendBotAction(chatId, UploadVoiceAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadDocument( suspend fun TelegramBot.sendActionUploadDocument(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, UploadDocumentAction, threadId)
) = sendBotAction(chatId, UploadDocumentAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionFindLocation( suspend fun TelegramBot.sendActionFindLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, FindLocationAction, threadId)
) = sendBotAction(chatId, FindLocationAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionRecordVideoNote( suspend fun TelegramBot.sendActionRecordVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, RecordVideoNoteAction, threadId)
) = sendBotAction(chatId, RecordVideoNoteAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadVideoNote( suspend fun TelegramBot.sendActionUploadVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId ) = sendBotAction(chatId, UploadVideoNoteAction, threadId)
) = sendBotAction(chatId, UploadVideoNoteAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionTyping( suspend fun TelegramBot.sendActionTyping(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, TypingAction, threadId)
) = sendBotAction(chat, TypingAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadPhoto( suspend fun TelegramBot.sendActionUploadPhoto(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, UploadPhotoAction, threadId)
) = sendBotAction(chat, UploadPhotoAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionRecordVideo( suspend fun TelegramBot.sendActionRecordVideo(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, RecordVideoAction, threadId)
) = sendBotAction(chat, RecordVideoAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadVideo( suspend fun TelegramBot.sendActionUploadVideo(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, UploadVideoAction, threadId)
) = sendBotAction(chat, UploadVideoAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionRecordVoice( suspend fun TelegramBot.sendActionRecordVoice(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, RecordVoiceAction, threadId)
) = sendBotAction(chat, RecordVoiceAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadVoice( suspend fun TelegramBot.sendActionUploadVoice(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, UploadVoiceAction, threadId)
) = sendBotAction(chat, UploadVoiceAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadDocument( suspend fun TelegramBot.sendActionUploadDocument(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, UploadDocumentAction, threadId)
) = sendBotAction(chat, UploadDocumentAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionFindLocation( suspend fun TelegramBot.sendActionFindLocation(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, FindLocationAction, threadId)
) = sendBotAction(chat, FindLocationAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionRecordVideoNote( suspend fun TelegramBot.sendActionRecordVideoNote(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, RecordVideoNoteAction, threadId)
) = sendBotAction(chat, RecordVideoNoteAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionUploadVideoNote( suspend fun TelegramBot.sendActionUploadVideoNote(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, UploadVideoNoteAction, threadId)
) = sendBotAction(chat, UploadVideoNoteAction, threadId, businessConnectionId)
suspend fun TelegramBot.sendActionChooseStickerAction( suspend fun TelegramBot.sendActionChooseStickerAction(
chat: Chat, chat: Chat,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId ) = sendBotAction(chat, ChooseStickerAction, threadId)
) = sendBotAction(chat, ChooseStickerAction, threadId, businessConnectionId)

View File

@@ -6,7 +6,6 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendAction import dev.inmo.tgbotapi.requests.send.SendAction
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.actions.* import dev.inmo.tgbotapi.types.actions.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import kotlinx.coroutines.* import kotlinx.coroutines.*
import kotlin.contracts.* import kotlin.contracts.*
@@ -40,14 +39,13 @@ suspend fun <T> TelegramBot.withAction(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
action: BotAction, action: BotAction,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
block: TelegramBotActionCallback<T> block: TelegramBotActionCallback<T>
): T { ): T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction( return withAction(
SendAction(chatId, action, threadId, businessConnectionId), SendAction(chatId, action, threadId),
block block
) )
} }
@@ -57,7 +55,6 @@ suspend fun <T> TelegramBot.withAction(
chat: Chat, chat: Chat,
action: BotAction, action: BotAction,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
block: TelegramBotActionCallback<T> block: TelegramBotActionCallback<T>
): T { ): T {
contract { contract {
@@ -67,164 +64,163 @@ suspend fun <T> TelegramBot.withAction(
chat.id, chat.id,
action, action,
threadId, threadId,
businessConnectionId,
block block
) )
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withTypingAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withTypingAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, TypingAction, threadId, businessConnectionId, block) return withAction(chatId, TypingAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadPhotoAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadPhotoAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, UploadPhotoAction, threadId, businessConnectionId, block) return withAction(chatId, UploadPhotoAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withRecordVideoAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withRecordVideoAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, RecordVideoAction, threadId, businessConnectionId, block) return withAction(chatId, RecordVideoAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadVideoAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadVideoAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, UploadVideoAction, threadId, businessConnectionId, block) return withAction(chatId, UploadVideoAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withRecordVoiceAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withRecordVoiceAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, RecordVoiceAction, threadId, businessConnectionId, block) return withAction(chatId, RecordVoiceAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadVoiceAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadVoiceAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, UploadVoiceAction, threadId, businessConnectionId, block) return withAction(chatId, UploadVoiceAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadDocumentAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadDocumentAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, UploadDocumentAction, threadId, businessConnectionId, block) return withAction(chatId, UploadDocumentAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withFindLocationAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withFindLocationAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, FindLocationAction, threadId, businessConnectionId, block) return withAction(chatId, FindLocationAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withRecordVideoNoteAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, RecordVideoNoteAction, threadId, businessConnectionId, block) return withAction(chatId, RecordVideoNoteAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadVideoNoteAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, UploadVideoNoteAction, threadId, businessConnectionId, block) return withAction(chatId, UploadVideoNoteAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withChooseStickerAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId, businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withChooseStickerAction(chatId: IdChatIdentifier, threadId: MessageThreadId? = chatId.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chatId, ChooseStickerAction, threadId, businessConnectionId, block) return withAction(chatId, ChooseStickerAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withTypingAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withTypingAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, TypingAction, threadId, businessConnectionId, block) return withAction(chat, TypingAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadPhotoAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadPhotoAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, UploadPhotoAction, threadId, businessConnectionId, block) return withAction(chat, UploadPhotoAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withRecordVideoAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withRecordVideoAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, RecordVideoAction, threadId, businessConnectionId, block) return withAction(chat, RecordVideoAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadVideoAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadVideoAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, UploadVideoAction, threadId, businessConnectionId, block) return withAction(chat, UploadVideoAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withRecordVoiceAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withRecordVoiceAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, RecordVoiceAction, threadId, businessConnectionId, block) return withAction(chat, RecordVoiceAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadVoiceAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadVoiceAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, UploadVoiceAction, threadId, businessConnectionId, block) return withAction(chat, UploadVoiceAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadDocumentAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadDocumentAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, UploadDocumentAction, threadId, businessConnectionId, block) return withAction(chat, UploadDocumentAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withFindLocationAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withFindLocationAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, FindLocationAction, threadId, businessConnectionId, block) return withAction(chat, FindLocationAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withRecordVideoNoteAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withRecordVideoNoteAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, RecordVideoNoteAction, threadId, businessConnectionId, block) return withAction(chat, RecordVideoNoteAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withUploadVideoNoteAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withUploadVideoNoteAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, UploadVideoNoteAction, threadId, businessConnectionId, block) return withAction(chat, UploadVideoNoteAction, threadId, block)
} }
@OptIn(ExperimentalContracts::class) @OptIn(ExperimentalContracts::class)
suspend fun <T> TelegramBot.withChooseStickerAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId, businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId, block: TelegramBotActionCallback<T>) : T { suspend fun <T> TelegramBot.withChooseStickerAction(chat: Chat, threadId: MessageThreadId? = chat.id.threadId,block: TelegramBotActionCallback<T>) : T {
contract { contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE) callsInPlace(block, InvocationKind.EXACTLY_ONCE)
} }
return withAction(chat, ChooseStickerAction, threadId, businessConnectionId, block) return withAction(chat, ChooseStickerAction, threadId, block)
} }

View File

@@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendContact import dev.inmo.tgbotapi.requests.send.SendContact
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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
@@ -17,15 +16,14 @@ suspend fun TelegramBot.sendContact(
firstName: String, firstName: String,
lastName: String? = null, lastName: String? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendContact( SendContact(
chatId, phoneNumber, firstName, lastName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@@ -37,15 +35,14 @@ suspend fun TelegramBot.sendContact(
chatId: ChatIdentifier, chatId: ChatIdentifier,
contact: Contact, contact: Contact,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendContact( SendContact(
chatId, contact, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@@ -59,14 +56,13 @@ suspend fun TelegramBot.sendContact(
firstName: String, firstName: String,
lastName: String? = null, lastName: String? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
chat.id, phoneNumber, firstName, lastName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chat.id, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@@ -77,12 +73,11 @@ suspend fun TelegramBot.sendContact(
chat: Chat, chat: Chat,
contact: Contact, contact: Contact,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendContact( ) = sendContact(
chat.id, contact, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chat.id, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )

View File

@@ -2,11 +2,13 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendDice import dev.inmo.tgbotapi.requests.send.SendDice
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
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.dice.DiceAnimationType import dev.inmo.tgbotapi.types.dice.DiceAnimationType
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -16,14 +18,13 @@ suspend fun TelegramBot.sendDice(
chatId: ChatIdentifier, chatId: ChatIdentifier,
animationType: DiceAnimationType? = null, animationType: DiceAnimationType? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendDice(chatId, animationType, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) SendDice(chatId, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
@@ -34,10 +35,9 @@ suspend fun TelegramBot.sendDice(
chat: Chat, chat: Chat,
animationType: DiceAnimationType? = null, animationType: DiceAnimationType? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendDice(chat.id, animationType, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendDice(chat.id, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
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.business_connection.BusinessConnectionId
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.Location import dev.inmo.tgbotapi.types.location.Location
@@ -21,11 +20,10 @@ suspend fun TelegramBot.sendLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendLiveLocation( SendLiveLocation(
@@ -37,11 +35,10 @@ suspend fun TelegramBot.sendLocation(
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -58,11 +55,10 @@ suspend fun TelegramBot.sendLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation( ) = sendLocation(
chatId, chatId,
@@ -73,11 +69,10 @@ suspend fun TelegramBot.sendLocation(
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -94,11 +89,10 @@ suspend fun TelegramBot.sendLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation( ) = sendLocation(
chat.id, chat.id,
@@ -109,11 +103,10 @@ suspend fun TelegramBot.sendLocation(
heading, heading,
proximityAlertRadius, proximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
@@ -129,27 +122,25 @@ suspend fun TelegramBot.sendLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation( ) = sendLocation(
chatId = chat.id, chat.id,
latitude = location.latitude, location.latitude,
longitude = location.longitude, location.longitude,
livePeriod = livePeriod, livePeriod,
horizontalAccuracy = horizontalAccuracy, horizontalAccuracy,
heading = heading, heading,
proximityAlertRadius = proximityAlertRadius, proximityAlertRadius,
threadId = threadId, threadId,
businessConnectionId = businessConnectionId, disableNotification,
disableNotification = disableNotification, protectContent,
protectContent = protectContent, replyToMessageId,
effectId = effectId, allowSendingWithoutReply,
replyParameters = replyParameters, replyMarkup
replyMarkup = replyMarkup
) )
/** /**
@@ -165,13 +156,12 @@ suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, 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
@@ -185,13 +175,12 @@ suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, 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
@@ -206,13 +195,12 @@ suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, 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
@@ -226,10 +214,9 @@ suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null, heading: Degrees? = null,
proximityAlertRadius: Meters? = null, proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendTextMessage import dev.inmo.tgbotapi.requests.send.SendTextMessage
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
@@ -20,26 +19,24 @@ suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendTextMessage( SendTextMessage(
chatId, chatId,
text, text,
parseMode, parseMode,
linkPreviewOptions, disableWebPagePreview,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -52,16 +49,15 @@ suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage( ) = sendMessage(
chatId, text, parseMode, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@@ -72,15 +68,14 @@ suspend fun TelegramBot.sendTextMessage(
chat: Chat, chat: Chat,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@@ -91,15 +86,14 @@ suspend fun TelegramBot.sendMessage(
chat: Chat, chat: Chat,
text: String, text: String,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, 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
@@ -108,54 +102,51 @@ suspend fun TelegramBot.sendMessage(
suspend fun TelegramBot.sendMessage( suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendTextMessage(chatId, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) SendTextMessage(chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendMessage( suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendMessage( suspend fun TelegramBot.sendMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, 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
@@ -164,54 +155,51 @@ suspend fun TelegramBot.sendMessage(
suspend fun TelegramBot.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage( ) = sendMessage(
chatId, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, 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
@@ -220,52 +208,49 @@ suspend fun TelegramBot.sendTextMessage(
suspend fun TelegramBot.sendMessage( suspend fun TelegramBot.sendMessage(
chat: Chat, chat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendMessage(chat.id, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendMessage( suspend fun TelegramBot.sendMessage(
chat: Chat, chat: Chat,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendMessage( suspend fun TelegramBot.sendMessage(
chat: Chat, chat: Chat,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@@ -275,49 +260,46 @@ suspend fun TelegramBot.sendMessage(
suspend fun TelegramBot.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
chat: Chat, chat: Chat,
entities: TextSourcesList, entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendTextMessage(chat.id, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendTextMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
chat: Chat, chat: Chat,
separator: TextSource? = null, separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.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.sendTextMessage( suspend fun TelegramBot.sendTextMessage(
chat: Chat, chat: Chat,
separator: String, separator: String,
linkPreviewOptions: LinkPreviewOptions? = null, disableWebPagePreview: Boolean? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody builderBody: EntitiesBuilderBody
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -2,11 +2,13 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendStaticLocation import dev.inmo.tgbotapi.requests.send.SendStaticLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
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.Location import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -17,11 +19,10 @@ suspend fun TelegramBot.sendLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendStaticLocation( SendStaticLocation(
@@ -29,11 +30,10 @@ suspend fun TelegramBot.sendLocation(
latitude, latitude,
longitude, longitude,
threadId = threadId, threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, allowSendingWithoutReply = allowSendingWithoutReply,
replyParameters = replyParameters, replyToMessageId = replyToMessageId,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
) )
@@ -46,22 +46,20 @@ suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
location: Location, location: Location,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation( ) = sendLocation(
chatId, chatId,
location.latitude, location.latitude,
location.longitude, location.longitude,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, allowSendingWithoutReply,
replyParameters, replyToMessageId,
replyMarkup replyMarkup
) )
@@ -74,22 +72,20 @@ suspend fun TelegramBot.sendLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation( ) = sendLocation(
chat.id, chat.id,
latitude, latitude,
longitude, longitude,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, allowSendingWithoutReply,
replyParameters, replyToMessageId,
replyMarkup replyMarkup
) )
@@ -101,22 +97,20 @@ suspend fun TelegramBot.sendLocation(
chat: Chat, chat: Chat,
location: Location, location: Location,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation( ) = sendLocation(
chat.id, chat.id,
location.latitude, location.latitude,
location.longitude, location.longitude,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, allowSendingWithoutReply,
replyParameters, replyToMessageId,
replyMarkup replyMarkup
) )
@@ -129,13 +123,12 @@ suspend fun TelegramBot.sendStaticLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, 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
@@ -145,13 +138,12 @@ suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
location: Location, location: Location,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chatId, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chatId, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, 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
@@ -162,13 +154,12 @@ suspend fun TelegramBot.sendStaticLocation(
latitude: Double, latitude: Double,
longitude: Double, longitude: Double,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chat.id, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, 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
@@ -178,10 +169,9 @@ suspend fun TelegramBot.sendStaticLocation(
chat: Chat, chat: Chat,
location: Location, location: Location,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, allowSendingWithoutReply: Boolean? = null,
replyParameters: ReplyParameters? = null, replyToMessageId: MessageId? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendLocation(chat.id, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendLocation(chat.id, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)

View File

@@ -3,7 +3,6 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendVenue import dev.inmo.tgbotapi.requests.send.SendVenue
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.StaticLocation import dev.inmo.tgbotapi.types.location.StaticLocation
@@ -24,11 +23,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVenue( SendVenue(
@@ -42,11 +40,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId, threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
) )
@@ -66,11 +63,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chatId = chat.id, chatId = chat.id,
@@ -83,11 +79,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId, threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -105,11 +100,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chatId = chatId, chatId = chatId,
@@ -122,11 +116,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId, threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -144,11 +137,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null, googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null, googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chatId = chat.id, chatId = chat.id,
@@ -161,11 +153,10 @@ suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId, googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType, googlePlaceType = googlePlaceType,
threadId = threadId, threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
@@ -177,22 +168,20 @@ suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier, chatId: ChatIdentifier,
venue: Venue, venue: Venue,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVenue( SendVenue(
chatId = chatId, chatId = chatId,
venue = venue, venue = venue,
threadId = threadId, threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )
) )
@@ -205,20 +194,18 @@ suspend fun TelegramBot.sendVenue(
chat: Chat, chat: Chat,
venue: Venue, venue: Venue,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVenue( ) = sendVenue(
chatId = chat.id, chatId = chat.id,
venue = venue, venue = venue,
threadId = threadId, threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification, disableNotification = disableNotification,
protectContent = protectContent, protectContent = protectContent,
effectId = effectId, replyToMessageId = replyToMessageId,
replyParameters = replyParameters, allowSendingWithoutReply = allowSendingWithoutReply,
replyMarkup = replyMarkup replyMarkup = replyMarkup
) )

View File

@@ -1,121 +0,0 @@
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.message.abstracts.Message
import dev.inmo.tgbotapi.types.reactions.Reaction
import kotlin.jvm.JvmName
suspend fun TelegramBot.setMessageReactions(
chatId: ChatIdentifier,
messageId: MessageId,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = execute(
SetMessageReactions(chatId, messageId, reactions, big)
)
suspend fun TelegramBot.setMessageReaction(
chatId: ChatIdentifier,
messageId: MessageId,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReactions(chatId, messageId, listOfNotNull(reaction), big)
suspend fun TelegramBot.setMessageReactions(
chat: Chat,
messageId: MessageId,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = setMessageReactions(chat.id, messageId, reactions, big)
suspend fun TelegramBot.setMessageReaction(
chat: Chat,
messageId: MessageId,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReaction(chat.id, messageId, reaction, big)
suspend fun TelegramBot.setMessageReactions(
meta: Message.MetaInfo,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = setMessageReactions(meta.chatId, meta.messageId, reactions, big)
suspend fun TelegramBot.setMessageReaction(
meta: Message.MetaInfo,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReaction(meta.chatId, meta.messageId, reaction, big)
suspend fun TelegramBot.setMessageReactions(
message: AccessibleMessage,
reactions: List<Reaction> = emptyList(),
big: Boolean = false
) = setMessageReactions(message.metaInfo, reactions, big)
suspend fun TelegramBot.setMessageReaction(
message: AccessibleMessage,
reaction: Reaction? = null,
big: Boolean = false
) = setMessageReaction(message.metaInfo, reaction, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
chatId: ChatIdentifier,
messageId: MessageId,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(chatId, messageId, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
chatId: ChatIdentifier,
messageId: MessageId,
emoji: String?,
big: Boolean = false
) = setMessageReaction(chatId, messageId, emoji ?.let { Reaction.Emoji(it) }, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
chat: Chat,
messageId: MessageId,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(chat, messageId, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
chat: Chat,
messageId: MessageId,
emoji: String?,
big: Boolean = false
) = setMessageReaction(chat, messageId, emoji ?.let { Reaction.Emoji(it) }, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
meta: Message.MetaInfo,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(meta, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
meta: Message.MetaInfo,
emoji: String?,
big: Boolean = false
) = setMessageReaction(meta, emoji ?.let { Reaction.Emoji(it) }, big)
@JvmName("setMessageReactionsStrings")
suspend fun TelegramBot.setMessageReactions(
message: AccessibleMessage,
emojis: List<String>,
big: Boolean = false
) = setMessageReactions(message, emojis.map { Reaction.Emoji(it) }, big)
suspend fun TelegramBot.setMessageReaction(
message: AccessibleMessage,
emoji: String?,
big: Boolean = false
) = setMessageReaction(message, emoji ?.let { Reaction.Emoji(it) }, big)

View File

@@ -2,11 +2,13 @@ package dev.inmo.tgbotapi.extensions.api.send.games
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.games.SendGame import dev.inmo.tgbotapi.requests.send.games.SendGame
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
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.games.Game import dev.inmo.tgbotapi.types.games.Game
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -16,15 +18,14 @@ suspend fun TelegramBot.sendGame(
chatId: ChatIdentifier, chatId: ChatIdentifier,
gameShortName: String, gameShortName: String,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendGame( SendGame(
chatId, gameShortName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
) )
@@ -36,14 +37,13 @@ suspend fun TelegramBot.sendGame(
chat: Chat, chat: Chat,
gameShortName: String, gameShortName: String,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chat.id, gameShortName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chat.id, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@@ -54,14 +54,13 @@ suspend fun TelegramBot.sendGame(
chatId: ChatIdentifier, chatId: ChatIdentifier,
game: Game, game: Game,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chatId, game.title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@@ -72,12 +71,11 @@ suspend fun TelegramBot.sendGame(
chat: Chat, chat: Chat,
game: Game, game: Game,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendGame( ) = sendGame(
chat.id, game.title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chat.id, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )

View File

@@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendAnimation import dev.inmo.tgbotapi.requests.send.media.SendAnimation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.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.files.AnimationFile import dev.inmo.tgbotapi.types.files.AnimationFile
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -21,37 +23,33 @@ suspend fun TelegramBot.sendAnimation(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendAnimation( SendAnimation(
chatId = chatId, chatId,
animation = animation, animation,
thumbnail = thumb, thumb,
text = text, text,
parseMode = parseMode, parseMode,
showCaptionAboveMedia = showCaptionAboveMedia, spoilered,
spoilered = spoilered, duration,
duration = duration, width,
width = width, height,
height = height, threadId,
threadId = threadId, disableNotification,
businessConnectionId = businessConnectionId, protectContent,
disableNotification = disableNotification, replyToMessageId,
protectContent = protectContent, allowSendingWithoutReply,
effectId = effectId, replyMarkup
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
) )
@@ -64,36 +62,18 @@ suspend fun TelegramBot.sendAnimation(
animation: AnimationFile, animation: AnimationFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(
chatId = chatId, chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
animation = animation.fileId,
thumb = animation.thumbnail ?.fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
/** /**
@@ -106,37 +86,17 @@ suspend fun TelegramBot.sendAnimation(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(chat.id, animation, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
animation = animation,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -147,36 +107,17 @@ suspend fun TelegramBot.sendAnimation(
animation: AnimationFile, animation: AnimationFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(chat.id, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
animation = animation,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/** /**
@@ -188,36 +129,32 @@ suspend fun TelegramBot.sendAnimation(
animation: InputFile, animation: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendAnimation( SendAnimation(
chatId = chatId, chatId,
animation = animation, animation,
thumbnail = thumb, thumb,
entities = entities, entities,
showCaptionAboveMedia = showCaptionAboveMedia, spoilered,
spoilered = spoilered, duration,
duration = duration, width,
width = width, height,
height = height, threadId,
threadId = threadId, disableNotification,
businessConnectionId = businessConnectionId, protectContent,
disableNotification = disableNotification, replyToMessageId,
protectContent = protectContent, allowSendingWithoutReply,
effectId = effectId, replyMarkup
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
) )
@@ -229,35 +166,18 @@ suspend fun TelegramBot.sendAnimation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
animation: AnimationFile, animation: AnimationFile,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(
chatId = chatId, chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
animation = animation.fileId,
thumb = animation.thumbnail ?.fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
/** /**
@@ -269,36 +189,17 @@ suspend fun TelegramBot.sendAnimation(
animation: InputFile, animation: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(chat.id, animation, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
animation = animation,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -308,32 +209,14 @@ suspend fun TelegramBot.sendAnimation(
chat: Chat, chat: Chat,
animation: AnimationFile, animation: AnimationFile,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAnimation( ) = sendAnimation(chat.id, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
animation = animation,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendAudio import dev.inmo.tgbotapi.requests.send.media.SendAudio
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.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.files.AudioFile import dev.inmo.tgbotapi.types.files.AudioFile
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -25,11 +27,10 @@ suspend fun TelegramBot.sendAudio(
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendAudio( SendAudio(
@@ -42,11 +43,10 @@ suspend fun TelegramBot.sendAudio(
performer, performer,
title, title,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -65,13 +65,12 @@ suspend fun TelegramBot.sendAudio(
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, 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
@@ -84,13 +83,12 @@ suspend fun TelegramBot.sendAudio(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, 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
@@ -103,13 +101,12 @@ suspend fun TelegramBot.sendAudio(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, text, parseMode, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendAudio(chat.id, audio, text, parseMode, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@@ -125,11 +122,10 @@ suspend inline fun TelegramBot.sendAudio(
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendAudio( SendAudio(
@@ -141,11 +137,10 @@ suspend inline fun TelegramBot.sendAudio(
performer, performer,
title, title,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -163,13 +158,12 @@ suspend inline fun TelegramBot.sendAudio(
performer: String? = null, performer: String? = null,
title: String? = null, title: String? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, 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
@@ -181,13 +175,12 @@ suspend inline fun TelegramBot.sendAudio(
entities: TextSourcesList, entities: TextSourcesList,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, 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
@@ -199,10 +192,9 @@ suspend inline fun TelegramBot.sendAudio(
entities: TextSourcesList, entities: TextSourcesList,
title: String? = audio.title, title: String? = audio.title,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendAudio(chat.id, audio, entities, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendAudio(chat.id, audio, entities, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendDocument import dev.inmo.tgbotapi.requests.send.media.SendDocument
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.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.files.DocumentFile import dev.inmo.tgbotapi.types.files.DocumentFile
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -22,11 +24,10 @@ suspend fun TelegramBot.sendDocument(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = execute( ) = execute(
@@ -37,11 +38,10 @@ suspend fun TelegramBot.sendDocument(
text, text,
parseMode, parseMode,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup, replyMarkup,
disableContentTypeDetection disableContentTypeDetection
) )
@@ -58,14 +58,13 @@ suspend fun TelegramBot.sendDocument(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, thumb, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
/** /**
* @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
@@ -77,15 +76,14 @@ suspend fun TelegramBot.sendDocument(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument( ) = sendDocument(
chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
) )
/** /**
@@ -98,14 +96,13 @@ suspend fun TelegramBot.sendDocument(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
/** /**
* @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
@@ -117,11 +114,10 @@ suspend inline fun TelegramBot.sendDocument(
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = execute( ) = execute(
@@ -131,11 +127,10 @@ suspend inline fun TelegramBot.sendDocument(
thumb, thumb,
entities, entities,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup, replyMarkup,
disableContentTypeDetection disableContentTypeDetection
) )
@@ -151,14 +146,13 @@ suspend inline fun TelegramBot.sendDocument(
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, thumb, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, thumb, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -169,15 +163,14 @@ suspend inline fun TelegramBot.sendDocument(
document: DocumentFile, document: DocumentFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument( ) = sendDocument(
chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
) )
/** /**
@@ -189,11 +182,10 @@ suspend inline fun TelegramBot.sendDocument(
document: DocumentFile, document: DocumentFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null, replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null disableContentTypeDetection: Boolean? = null
) = sendDocument(chat.id, document, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection) ) = sendDocument(chat.id, document, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)

View File

@@ -2,14 +2,16 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.media.* import dev.inmo.tgbotapi.requests.send.media.*
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.media.* import dev.inmo.tgbotapi.types.media.*
import dev.inmo.tgbotapi.types.MessageId
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.content.MediaGroupPartContent import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent import dev.inmo.tgbotapi.types.message.content.VisualMediaGroupPartContent
import dev.inmo.tgbotapi.types.message.content.AudioContent import dev.inmo.tgbotapi.types.message.content.AudioContent
import dev.inmo.tgbotapi.types.message.content.DocumentContent import dev.inmo.tgbotapi.types.message.content.DocumentContent
import dev.inmo.tgbotapi.types.threadId
import dev.inmo.tgbotapi.utils.RiskFeature import dev.inmo.tgbotapi.utils.RiskFeature
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
@@ -21,14 +23,13 @@ suspend fun TelegramBot.sendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupMemberTelegramMedia>, media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendMediaGroup<MediaGroupPartContent>( SendMediaGroup<MediaGroupPartContent>(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@@ -40,13 +41,12 @@ suspend fun TelegramBot.sendMediaGroup(
chat: Chat, chat: Chat,
media: List<MediaGroupMemberTelegramMedia>, media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup( ) = sendMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -58,13 +58,12 @@ suspend fun TelegramBot.sendMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<MediaGroupPartContent>, media: List<MediaGroupPartContent>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup( ) = sendMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -76,13 +75,12 @@ suspend fun TelegramBot.sendMediaGroup(
chat: Chat, chat: Chat,
media: List<MediaGroupPartContent>, media: List<MediaGroupPartContent>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendMediaGroup( ) = sendMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -92,14 +90,13 @@ suspend fun TelegramBot.sendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberTelegramMedia>, media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendPlaylist( SendPlaylist(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@@ -110,13 +107,12 @@ suspend fun TelegramBot.sendPlaylist(
chat: Chat, chat: Chat,
media: List<AudioMediaGroupMemberTelegramMedia>, media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendPlaylist( ) = sendPlaylist(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -127,13 +123,12 @@ suspend fun TelegramBot.sendPlaylist(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<AudioContent>, media: List<AudioContent>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendPlaylist( ) = sendPlaylist(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -144,13 +139,12 @@ suspend fun TelegramBot.sendPlaylist(
chat: Chat, chat: Chat,
media: List<AudioContent>, media: List<AudioContent>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendPlaylist( ) = sendPlaylist(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -160,14 +154,13 @@ suspend fun TelegramBot.sendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberTelegramMedia>, media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendDocumentsGroup( SendDocumentsGroup(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@@ -178,13 +171,12 @@ suspend fun TelegramBot.sendDocumentsGroup(
chat: Chat, chat: Chat,
media: List<DocumentMediaGroupMemberTelegramMedia>, media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup( ) = sendDocumentsGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -195,13 +187,12 @@ suspend fun TelegramBot.sendDocumentsGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<DocumentContent>, media: List<DocumentContent>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup( ) = sendDocumentsGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -212,13 +203,12 @@ suspend fun TelegramBot.sendDocumentsGroup(
chat: Chat, chat: Chat,
media: List<DocumentContent>, media: List<DocumentContent>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendDocumentsGroup( ) = sendDocumentsGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -228,14 +218,13 @@ suspend fun TelegramBot.sendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberTelegramMedia>, media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = execute( ) = execute(
SendVisualMediaGroup( SendVisualMediaGroup(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
) )
@@ -246,13 +235,12 @@ suspend fun TelegramBot.sendVisualMediaGroup(
chat: Chat, chat: Chat,
media: List<VisualMediaGroupMemberTelegramMedia>, media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup( ) = sendVisualMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -263,13 +251,12 @@ suspend fun TelegramBot.sendVisualMediaGroup(
chatId: ChatIdentifier, chatId: ChatIdentifier,
media: List<VisualMediaGroupPartContent>, media: List<VisualMediaGroupPartContent>,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup( ) = sendVisualMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )
/** /**
@@ -280,11 +267,10 @@ suspend fun TelegramBot.sendVisualMediaGroup(
chat: Chat, chat: Chat,
media: List<VisualMediaGroupPartContent>, media: List<VisualMediaGroupPartContent>,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null allowSendingWithoutReply: Boolean? = null
) = sendVisualMediaGroup( ) = sendVisualMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
) )

View File

@@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendPhoto import dev.inmo.tgbotapi.requests.send.media.SendPhoto
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.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.files.* import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -20,30 +22,26 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile, fileId: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendPhoto( SendPhoto(
chatId = chatId, chatId,
photo = fileId, fileId,
text = text, text,
parseMode = parseMode, parseMode,
showCaptionAboveMedia = showCaptionAboveMedia, spoilered,
spoilered = spoilered, threadId,
threadId = threadId, disableNotification,
businessConnectionId = businessConnectionId, protectContent,
disableNotification = disableNotification, replyToMessageId,
protectContent = protectContent, allowSendingWithoutReply,
effectId = effectId, replyMarkup
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
) )
@@ -56,30 +54,14 @@ suspend fun TelegramBot.sendPhoto(
fileId: InputFile, fileId: InputFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chat.id, fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
fileId = fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -90,30 +72,14 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo, photo: Photo,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chatId,
fileId = photo.biggest() ?.fileId ?: error("Photo content must not be empty"),
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -124,30 +90,14 @@ suspend fun TelegramBot.sendPhoto(
photo: Photo, photo: Photo,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chat.id, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
photo = photo,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -158,30 +108,14 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize, photoSize: PhotoSize,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chatId, photoSize.fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chatId,
fileId = photoSize.fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -192,30 +126,14 @@ suspend fun TelegramBot.sendPhoto(
photoSize: PhotoSize, photoSize: PhotoSize,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chat.id, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
photoSize = photoSize,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/** /**
@@ -226,29 +144,25 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
fileId: InputFile, fileId: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendPhoto( SendPhoto(
chatId = chatId, chatId,
photo = fileId, fileId,
entities = entities, entities,
showCaptionAboveMedia = showCaptionAboveMedia, spoilered,
spoilered = spoilered, threadId,
threadId = threadId, disableNotification,
businessConnectionId = businessConnectionId, protectContent,
disableNotification = disableNotification, replyToMessageId,
protectContent = protectContent, allowSendingWithoutReply,
effectId = effectId, replyMarkup
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
) )
@@ -260,29 +174,14 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
fileId: InputFile, fileId: InputFile,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chat.id, fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
fileId = fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -292,29 +191,14 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
photo: Photo, photo: Photo,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chatId,
fileId = photo.biggest() ?.fileId ?: error("Photo content must not be empty"),
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -324,29 +208,14 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
photo: Photo, photo: Photo,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chat.id, photo, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
photo = photo,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -356,29 +225,14 @@ suspend inline fun TelegramBot.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,
photoSize: PhotoSize, photoSize: PhotoSize,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chatId, photoSize.fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chatId,
fileId = photoSize.fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -388,26 +242,11 @@ suspend inline fun TelegramBot.sendPhoto(
chat: Chat, chat: Chat,
photoSize: PhotoSize, photoSize: PhotoSize,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendPhoto( ) = sendPhoto(chat.id, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
photoSize = photoSize,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -3,11 +3,13 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendSticker import dev.inmo.tgbotapi.requests.send.media.SendSticker
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
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.files.Sticker import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -17,15 +19,14 @@ suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: InputFile, sticker: InputFile,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendSticker(chatId, sticker, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup) SendSticker(chatId, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
@@ -36,14 +37,13 @@ suspend fun TelegramBot.sendSticker(
chat: Chat, chat: Chat,
sticker: InputFile, sticker: InputFile,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat.id, sticker, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendSticker(chat.id, sticker, threadId, emoji, 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
@@ -53,14 +53,13 @@ suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,
sticker: Sticker, sticker: Sticker,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chatId, sticker.fileId, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendSticker(chatId, sticker.fileId, threadId, emoji, 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
@@ -70,11 +69,10 @@ suspend fun TelegramBot.sendSticker(
chat: Chat, chat: Chat,
sticker: Sticker, sticker: Sticker,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
emoji: String? = null, emoji: String? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat, sticker.fileId, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendSticker(chat, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVideo import dev.inmo.tgbotapi.requests.send.media.SendVideo
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.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.files.VideoFile import dev.inmo.tgbotapi.types.files.VideoFile
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -21,38 +23,34 @@ suspend fun TelegramBot.sendVideo(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVideo( SendVideo(
chatId = chatId, chatId,
video = video, video,
thumbnail = thumb, thumb,
text = text, text,
parseMode = parseMode, parseMode,
showCaptionAboveMedia = showCaptionAboveMedia, spoilered,
spoilered = spoilered, duration,
duration = duration, width,
width = width, height,
height = height, null,
supportStreaming = null, threadId,
threadId = threadId, disableNotification,
businessConnectionId = businessConnectionId, protectContent,
disableNotification = disableNotification, replyToMessageId,
protectContent = protectContent, allowSendingWithoutReply,
effectId = effectId, replyMarkup
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
) )
@@ -65,34 +63,14 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile, video: VideoFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo( ) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chatId,
video = video.fileId,
thumb = video.thumbnail ?.fileId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = video.duration,
width = video.width,
height = video.height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -104,37 +82,17 @@ suspend fun TelegramBot.sendVideo(
thumb: InputFile? = null, thumb: InputFile? = null,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo( ) = sendVideo(chat.id, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
video = video,
thumb = thumb,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/** /**
@@ -146,30 +104,14 @@ suspend fun TelegramBot.sendVideo(
video: VideoFile, video: VideoFile,
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo( ) = sendVideo(chat.id, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
video = video,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -180,37 +122,33 @@ suspend inline fun TelegramBot.sendVideo(
video: InputFile, video: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVideo( SendVideo(
chatId = chatId, chatId,
video = video, video,
thumbnail = thumb, thumb,
entities = entities, entities,
showCaptionAboveMedia = showCaptionAboveMedia, spoilered,
spoilered = spoilered, duration,
duration = duration, width,
width = width, height,
height = height, null,
supportStreaming = null, threadId,
threadId = threadId, disableNotification,
businessConnectionId = businessConnectionId, protectContent,
disableNotification = disableNotification, replyToMessageId,
protectContent = protectContent, allowSendingWithoutReply,
effectId = effectId, replyMarkup
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
) )
@@ -222,33 +160,14 @@ suspend inline fun TelegramBot.sendVideo(
chatId: ChatIdentifier, chatId: ChatIdentifier,
video: VideoFile, video: VideoFile,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo( ) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chatId,
video = video.fileId,
thumb = video.thumbnail ?.fileId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = video.duration,
width = video.width,
height = video.height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = 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
@@ -259,36 +178,17 @@ suspend inline fun TelegramBot.sendVideo(
video: InputFile, video: InputFile,
thumb: InputFile? = null, thumb: InputFile? = null,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
duration: Long? = null, duration: Long? = null,
width: Int? = null, width: Int? = null,
height: Int? = null, height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo( ) = sendVideo(chat.id, video, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
video = video,
thumb = thumb,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
duration = duration,
width = width,
height = height,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/** /**
@@ -299,26 +199,11 @@ suspend inline fun TelegramBot.sendVideo(
chat: Chat, chat: Chat,
video: VideoFile, video: VideoFile,
entities: TextSourcesList, entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false, spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideo( ) = sendVideo(chat.id, video, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
chatId = chat.id,
video = video,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -3,11 +3,13 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVideoNote import dev.inmo.tgbotapi.requests.send.media.SendVideoNote
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
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.files.VideoNoteFile import dev.inmo.tgbotapi.types.files.VideoNoteFile
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -20,11 +22,10 @@ suspend fun TelegramBot.sendVideoNote(
duration: Long? = null, duration: Long? = null,
size: Int? = null, size: Int? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVideoNote( SendVideoNote(
@@ -34,11 +35,10 @@ suspend fun TelegramBot.sendVideoNote(
duration, duration,
size, size,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -51,14 +51,13 @@ suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier, chatId: ChatIdentifier,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote( ) = sendVideoNote(
chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@@ -72,13 +71,12 @@ suspend fun TelegramBot.sendVideoNote(
duration: Long? = null, duration: Long? = null,
size: Int? = null, size: Int? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendVideoNote(chat.id, videoNote, thumb, duration, size, 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
@@ -88,10 +86,9 @@ suspend fun TelegramBot.sendVideoNote(
chat: Chat, chat: Chat,
videoNote: VideoNoteFile, videoNote: VideoNoteFile,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVideoNote(chat.id, videoNote, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendVideoNote(chat.id, videoNote, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -3,13 +3,15 @@ package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.send.media.SendVoice import dev.inmo.tgbotapi.requests.send.media.SendVoice
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
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.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.files.VoiceFile import dev.inmo.tgbotapi.types.files.VoiceFile
import dev.inmo.tgbotapi.types.threadId
/** /**
* @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
@@ -22,11 +24,10 @@ suspend fun TelegramBot.sendVoice(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVoice( SendVoice(
@@ -36,11 +37,10 @@ suspend fun TelegramBot.sendVoice(
parseMode, parseMode,
duration, duration,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
effectId, replyToMessageId,
replyParameters, allowSendingWithoutReply,
replyMarkup replyMarkup
) )
) )
@@ -56,13 +56,12 @@ suspend fun TelegramBot.sendVoice(
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendVoice(chat.id, voice, text, parseMode, duration, 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
@@ -74,14 +73,13 @@ suspend fun TelegramBot.sendVoice(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice( ) = sendVoice(
chatId, voice.fileId, text, parseMode, voice.duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, voice.fileId, text, parseMode, voice.duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
) )
/** /**
@@ -94,13 +92,12 @@ suspend fun TelegramBot.sendVoice(
text: String? = null, text: String? = null,
parseMode: ParseMode? = null, parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendVoice(chat.id, voice, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/** /**
@@ -113,25 +110,23 @@ suspend inline fun TelegramBot.sendVoice(
entities: TextSourcesList, entities: TextSourcesList,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = execute( ) = execute(
SendVoice( SendVoice(
chatId = chatId, chatId,
voice = voice, voice,
entities = entities, entities,
threadId = threadId, duration,
businessConnectionId = businessConnectionId, threadId,
duration = duration, disableNotification,
disableNotification = disableNotification, protectContent,
protectContent = protectContent, replyToMessageId,
effectId = effectId, allowSendingWithoutReply,
replyParameters = replyParameters, replyMarkup
replyMarkup = replyMarkup
) )
) )
@@ -145,13 +140,12 @@ suspend inline fun TelegramBot.sendVoice(
entities: TextSourcesList, entities: TextSourcesList,
duration: Long? = null, duration: Long? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendVoice(chat.id, voice, entities, duration, 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
@@ -162,14 +156,13 @@ suspend inline fun TelegramBot.sendVoice(
voice: VoiceFile, voice: VoiceFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice( ) = sendVoice(
chatId, voice.fileId, entities, voice.duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup chatId, voice.fileId, entities, voice.duration, 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
@@ -180,10 +173,9 @@ suspend inline fun TelegramBot.sendVoice(
voice: VoiceFile, voice: VoiceFile,
entities: TextSourcesList, entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = sendVoice(chat.id, voice, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendVoice(chat.id, voice, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)

View File

@@ -8,7 +8,6 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.chat.CommonUser
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
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
suspend fun TelegramBot.createInvoiceLink( suspend fun TelegramBot.createInvoiceLink(
title: String, title: String,
@@ -30,25 +29,3 @@ suspend fun TelegramBot.createInvoiceLink(
) = execute( ) = execute(
CreateInvoiceLink(title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress) CreateInvoiceLink(title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress)
) )
/**
* For links witn XTR currency and using of Telegram Stars
*/
suspend fun TelegramBot.createInvoiceLink(
title: String,
description: String,
payload: String,
prices: List<LabeledPrice>,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false
) = execute(
CreateInvoiceLink(title, description, payload, null, Currency.XTR, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress)
)

View File

@@ -1,17 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.send.payments
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.payments.RefundStarPayment
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.payments.SuccessfulPayment
import dev.inmo.tgbotapi.types.payments.abstracts.TelegramPaymentChargeId
suspend fun TelegramBot.refundStarPayment(
userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId
) = execute(RefundStarPayment(userId, telegramPaymentChargeId))
suspend fun TelegramBot.refundStarPayment(
userId: UserId,
successfulPayment: SuccessfulPayment
) = refundStarPayment(userId, successfulPayment.telegramPaymentChargeId)

View File

@@ -7,7 +7,6 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.chat.CommonUser
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
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
/** /**
* @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,11 +34,11 @@ suspend fun TelegramBot.sendInvoice(
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ) = execute(
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, effectId, replyParameters, replyMarkup) SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
) )
/** /**
@@ -67,63 +66,7 @@ suspend fun TelegramBot.sendInvoice(
priceDependOnShipAddress: Boolean = false, priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
effectId: EffectId? = null, replyToMessageId: MessageId? = null,
replyParameters: ReplyParameters? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, effectId, replyParameters, replyMarkup) ) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.sendInvoice(
chatId: IdChatIdentifier,
title: String,
description: String,
payload: String,
price: LabeledPrice,
startParameter: StartParameter? = null,
providerData: String? = null,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
SendInvoice(chatId, title, description, payload, price, startParameter, providerData, threadId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
suspend fun TelegramBot.sendInvoice(
user: CommonUser,
title: String,
description: String,
payload: String,
price: LabeledPrice,
startParameter: StartParameter? = null,
providerData: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(
chatId = user.id,
title = title,
description = description,
payload = payload,
price = price,
startParameter = startParameter,
providerData = providerData,
threadId = null,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -0,0 +1,301 @@
package dev.inmo.tgbotapi.extensions.api.send.polls
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll
import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.polls.*
import dev.inmo.tgbotapi.types.threadId
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendRegularPoll(
chatId: ChatIdentifier,
question: String,
options: List<String>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendRegularPoll(
chatId: ChatIdentifier,
poll: RegularPoll,
isClosed: Boolean = false,
question: String = poll.question,
options: List<String> = poll.options.map { it.text },
isAnonymous: Boolean = poll.isAnonymous,
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendRegularPoll(
chat: Chat,
question: String,
options: List<String>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendRegularPoll(
chat: Chat,
poll: RegularPoll,
isClosed: Boolean = false,
question: String = poll.question,
options: List<String> = poll.options.map { it.text },
isAnonymous: Boolean = poll.isAnonymous,
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
explanation: String? = null,
parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendQuizPoll(
chat: Chat,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
explanation: String? = null,
parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
explanation: String? = null,
parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend fun TelegramBot.sendQuizPoll(
chat: Chat,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
explanation: String? = null,
parseMode: ParseMode? = null,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.sendQuizPoll(
chat: Chat,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
suspend inline fun TelegramBot.sendQuizPoll(
chat: Chat,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
entities: TextSourcesList,
closeInfo: ScheduledCloseInfo? = null,
threadId: MessageThreadId? = chat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyToMessageId: MessageId? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
)

View File

@@ -1,325 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.send.polls
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.polls.InputPollOption
import dev.inmo.tgbotapi.types.polls.ScheduledCloseInfo
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<InputPollOption>,
correctOptionId: Int,
explanation: String?,
questionParseMode: ParseMode? = null,
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
explanation,
questionParseMode,
explanationParseMode,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
questionEntities: List<TextSource>,
options: List<InputPollOption>,
correctOptionId: Int,
explanation: String?,
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
explanation,
explanationParseMode,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<InputPollOption>,
correctOptionId: Int,
explanationTextSources: List<TextSource>? = null,
questionParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
questionParseMode,
explanationTextSources,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
questionEntities: List<TextSource>,
options: List<InputPollOption>,
correctOptionId: Int,
explanationTextSources: List<TextSource>? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
explanationTextSources,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<InputPollOption>,
correctOptionId: Int,
closeInfo: ScheduledCloseInfo?,
questionParseMode: ParseMode? = null,
explanation: String?,
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
closeInfo,
explanation,
questionParseMode,
explanationParseMode,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
questionEntities: List<TextSource>,
options: List<InputPollOption>,
correctOptionId: Int,
closeInfo: ScheduledCloseInfo?,
explanation: String?,
explanationParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
closeInfo,
explanation,
explanationParseMode,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<InputPollOption>,
correctOptionId: Int,
closeInfo: ScheduledCloseInfo?,
questionParseMode: ParseMode? = null,
explanationTextSources: List<TextSource>? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
closeInfo,
questionParseMode,
explanationTextSources,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendQuizPoll(
chatId: ChatIdentifier,
questionEntities: List<TextSource>,
options: List<InputPollOption>,
correctOptionId: Int,
closeInfo: ScheduledCloseInfo?,
explanationTextSources: List<TextSource>? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
closeInfo,
explanationTextSources,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)

View File

@@ -1,156 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.send.polls
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.polls.InputPollOption
import dev.inmo.tgbotapi.types.polls.ScheduledCloseInfo
suspend fun TelegramBot.sendRegularPoll(
chatId: ChatIdentifier,
question: String,
options: List<InputPollOption>,
questionParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId,
question,
options,
questionParseMode,
isAnonymous,
isClosed,
allowMultipleAnswers,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendRegularPoll(
chatId: ChatIdentifier,
questionEntities: List<TextSource>,
options: List<InputPollOption>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId,
questionEntities,
options,
isAnonymous,
isClosed,
allowMultipleAnswers,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendRegularPoll(
chatId: ChatIdentifier,
question: String,
options: List<InputPollOption>,
closeInfo: ScheduledCloseInfo?,
questionParseMode: ParseMode? = null,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId,
question,
options,
closeInfo,
questionParseMode,
isAnonymous,
isClosed,
allowMultipleAnswers,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)
suspend fun TelegramBot.sendRegularPoll(
chatId: ChatIdentifier,
questionEntities: List<TextSource>,
options: List<InputPollOption>,
closeInfo: ScheduledCloseInfo?,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId,
questionEntities,
options,
closeInfo,
isAnonymous,
isClosed,
allowMultipleAnswers,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
)
)

View File

@@ -4,8 +4,6 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.InputFile import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.stickers.AddStickerToSet import dev.inmo.tgbotapi.requests.stickers.AddStickerToSet
import dev.inmo.tgbotapi.requests.stickers.InputSticker import dev.inmo.tgbotapi.requests.stickers.InputSticker
import dev.inmo.tgbotapi.types.StickerFormat
import dev.inmo.tgbotapi.types.StickerSetName
import dev.inmo.tgbotapi.types.StickerType import dev.inmo.tgbotapi.types.StickerType
import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.UserId
@@ -14,18 +12,12 @@ import dev.inmo.tgbotapi.types.stickers.StickerSet
suspend fun TelegramBot.addStickerToSet( suspend fun TelegramBot.addStickerToSet(
userId: UserId, userId: UserId,
stickerSetName: StickerSetName, stickerSetName: String,
inputSticker: InputSticker inputSticker: InputSticker
) = execute( ) = execute(
AddStickerToSet(userId, stickerSetName, inputSticker) AddStickerToSet(userId, stickerSetName, inputSticker)
) )
suspend fun TelegramBot.addStickerToSet(
userId: UserId,
stickerSetName: String,
inputSticker: InputSticker
) = addStickerToSet(userId, StickerSetName(stickerSetName), inputSticker)
suspend fun TelegramBot.addStickerToSet( suspend fun TelegramBot.addStickerToSet(
userId: UserId, userId: UserId,
stickerSet: StickerSet, stickerSet: StickerSet,
@@ -40,7 +32,6 @@ suspend fun TelegramBot.addStickerToSet(
userId: UserId, userId: UserId,
stickerSet: StickerSet, stickerSet: StickerSet,
sticker: InputFile, sticker: InputFile,
format: StickerFormat,
emojis: List<String>, emojis: List<String>,
keywords: List<String> = emptyList() keywords: List<String> = emptyList()
) = addStickerToSet( ) = addStickerToSet(
@@ -49,18 +40,15 @@ suspend fun TelegramBot.addStickerToSet(
when (stickerSet.stickerType) { when (stickerSet.stickerType) {
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji( StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
sticker, sticker,
format,
emojis, emojis,
keywords keywords
) )
StickerType.Mask -> InputSticker.Mask( StickerType.Mask -> InputSticker.Mask(
sticker, sticker,
format,
emojis emojis
) )
StickerType.Regular -> InputSticker.WithKeywords.Regular( StickerType.Regular -> InputSticker.WithKeywords.Regular(
sticker, sticker,
format,
emojis, emojis,
keywords keywords
) )
@@ -72,7 +60,6 @@ suspend fun TelegramBot.addStickerToSet(
userId: UserId, userId: UserId,
stickerSet: StickerSet, stickerSet: StickerSet,
sticker: InputFile, sticker: InputFile,
format: StickerFormat,
emojis: List<String>, emojis: List<String>,
maskPosition: MaskPosition? = null maskPosition: MaskPosition? = null
) = addStickerToSet( ) = addStickerToSet(
@@ -81,19 +68,16 @@ suspend fun TelegramBot.addStickerToSet(
when (stickerSet.stickerType) { when (stickerSet.stickerType) {
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji( StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
sticker, sticker,
format,
emojis, emojis,
emptyList() emptyList()
) )
StickerType.Mask -> InputSticker.Mask( StickerType.Mask -> InputSticker.Mask(
sticker, sticker,
format,
emojis, emojis,
maskPosition maskPosition
) )
StickerType.Regular -> InputSticker.WithKeywords.Regular( StickerType.Regular -> InputSticker.WithKeywords.Regular(
sticker, sticker,
format,
emojis, emojis,
emptyList() emptyList()
) )
@@ -115,20 +99,18 @@ suspend fun TelegramBot.addStickerToSet(
user: CommonUser, user: CommonUser,
stickerSet: StickerSet, stickerSet: StickerSet,
sticker: InputFile, sticker: InputFile,
format: StickerFormat,
emojis: List<String>, emojis: List<String>,
keywords: List<String> = emptyList() keywords: List<String> = emptyList()
) = addStickerToSet( ) = addStickerToSet(
user.id, stickerSet, sticker, format, emojis, keywords user.id, stickerSet, sticker, emojis, keywords
) )
suspend fun TelegramBot.addStickerToSet( suspend fun TelegramBot.addStickerToSet(
user: CommonUser, user: CommonUser,
stickerSet: StickerSet, stickerSet: StickerSet,
sticker: InputFile, sticker: InputFile,
format: StickerFormat,
emojis: List<String>, emojis: List<String>,
maskPosition: MaskPosition? = null maskPosition: MaskPosition? = null
) = addStickerToSet( ) = addStickerToSet(
user.id, stickerSet, sticker, format, emojis, maskPosition user.id, stickerSet, sticker, emojis, maskPosition
) )

View File

@@ -11,10 +11,11 @@ suspend fun TelegramBot.createNewStickerSet(
userId: UserId, userId: UserId,
name: String, name: String,
title: String, title: String,
stickersFormat: StickerFormat,
stickers: List<InputSticker>, stickers: List<InputSticker>,
needsRepainting: Boolean = false needsRepainting: Boolean = false
) = execute( ) = execute(
CreateNewStickerSet(userId, name, title, stickers, needsRepainting) CreateNewStickerSet(userId, name, title, stickersFormat, stickers, needsRepainting)
) )
@@ -22,8 +23,9 @@ suspend fun TelegramBot.createNewStickerSet(
user: CommonUser, user: CommonUser,
name: String, name: String,
title: String, title: String,
stickersFormat: StickerFormat,
stickers: List<InputSticker>, stickers: List<InputSticker>,
needsRepainting: Boolean = false, needsRepainting: Boolean = false,
) = createNewStickerSet( ) = createNewStickerSet(
user.id, name, title, stickers, needsRepainting user.id, name, title, stickersFormat, stickers, needsRepainting
) )

View File

@@ -1,148 +0,0 @@
package dev.inmo.tgbotapi.extensions.api.stickers
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.FileId
import dev.inmo.tgbotapi.requests.abstracts.InputFile
import dev.inmo.tgbotapi.requests.stickers.AddStickerToSet
import dev.inmo.tgbotapi.requests.stickers.InputSticker
import dev.inmo.tgbotapi.requests.stickers.ReplaceStickerInSet
import dev.inmo.tgbotapi.types.StickerFormat
import dev.inmo.tgbotapi.types.StickerSetName
import dev.inmo.tgbotapi.types.StickerType
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.stickers.MaskPosition
import dev.inmo.tgbotapi.types.stickers.StickerSet
suspend fun TelegramBot.replaceStickerInSet(
userId: UserId,
stickerSetName: StickerSetName,
oldSticker: FileId,
newSticker: InputSticker
) = execute(
ReplaceStickerInSet(userId, stickerSetName, oldSticker, newSticker)
)
suspend fun TelegramBot.replaceStickerInSet(
userId: UserId,
stickerSetName: String,
oldSticker: FileId,
newSticker: InputSticker
) = replaceStickerInSet(userId, StickerSetName(stickerSetName), oldSticker, newSticker)
suspend fun TelegramBot.replaceStickerInSet(
userId: UserId,
stickerSet: StickerSet,
oldSticker: FileId,
newSticker: InputSticker
) = replaceStickerInSet(
userId,
stickerSet.name,
oldSticker,
newSticker
)
suspend fun TelegramBot.replaceStickerInSet(
userId: UserId,
stickerSet: StickerSet,
oldSticker: FileId,
sticker: InputFile,
format: StickerFormat,
emojis: List<String>,
keywords: List<String> = emptyList()
) = replaceStickerInSet(
userId,
stickerSet,
oldSticker,
when (stickerSet.stickerType) {
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
sticker,
format,
emojis,
keywords
)
StickerType.Mask -> InputSticker.Mask(
sticker,
format,
emojis
)
StickerType.Regular -> InputSticker.WithKeywords.Regular(
sticker,
format,
emojis,
keywords
)
is StickerType.Unknown -> error("Unable to create sticker to the set with type ${stickerSet.stickerType}")
}
)
suspend fun TelegramBot.replaceStickerInSet(
userId: UserId,
stickerSet: StickerSet,
oldSticker: FileId,
sticker: InputFile,
format: StickerFormat,
emojis: List<String>,
maskPosition: MaskPosition? = null
) = replaceStickerInSet(
userId,
stickerSet.name,
oldSticker,
when (stickerSet.stickerType) {
StickerType.CustomEmoji -> InputSticker.WithKeywords.CustomEmoji(
sticker,
format,
emojis,
emptyList()
)
StickerType.Mask -> InputSticker.Mask(
sticker,
format,
emojis,
maskPosition
)
StickerType.Regular -> InputSticker.WithKeywords.Regular(
sticker,
format,
emojis,
emptyList()
)
is StickerType.Unknown -> error("Unable to create sticker to the set with type ${stickerSet.stickerType}")
}
)
suspend fun TelegramBot.replaceStickerInSet(
user: CommonUser,
stickerSet: StickerSet,
oldSticker: FileId,
newSticker: InputSticker
) = replaceStickerInSet(
user.id,
stickerSet.name,
oldSticker,
newSticker
)
suspend fun TelegramBot.replaceStickerInSet(
user: CommonUser,
stickerSet: StickerSet,
oldSticker: FileId,
sticker: InputFile,
format: StickerFormat,
emojis: List<String>,
keywords: List<String> = emptyList()
) = replaceStickerInSet(
user.id, stickerSet, oldSticker, sticker, format, emojis, keywords
)
suspend fun TelegramBot.replaceStickerInSet(
user: CommonUser,
stickerSet: StickerSet,
oldSticker: FileId,
sticker: InputFile,
format: StickerFormat,
emojis: List<String>,
maskPosition: MaskPosition? = null
) = replaceStickerInSet(
user.id, stickerSet, oldSticker, sticker, format, emojis, maskPosition
)

View File

@@ -4,7 +4,6 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.requests.abstracts.FileId
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail import dev.inmo.tgbotapi.requests.stickers.SetStickerSetThumbnail
import dev.inmo.tgbotapi.types.StickerFormat
import dev.inmo.tgbotapi.types.StickerSetName import dev.inmo.tgbotapi.types.StickerSetName
import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.UserId
@@ -13,71 +12,63 @@ import dev.inmo.tgbotapi.types.stickers.StickerSet
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
userId: UserId, userId: UserId,
stickerSetName: StickerSetName, stickerSetName: StickerSetName,
format: StickerFormat,
thumbnail: FileId thumbnail: FileId
) = execute( ) = execute(
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail) SetStickerSetThumbnail(userId, stickerSetName, thumbnail)
) )
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
userId: UserId, userId: UserId,
stickerSetName: StickerSetName, stickerSetName: StickerSetName,
format: StickerFormat,
thumbnail: MultipartFile thumbnail: MultipartFile
) = execute( ) = execute(
SetStickerSetThumbnail(userId, stickerSetName, format, thumbnail) SetStickerSetThumbnail(userId, stickerSetName, thumbnail)
) )
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
user: CommonUser, user: CommonUser,
stickerSetName: StickerSetName, stickerSetName: StickerSetName,
format: StickerFormat,
thumbnail: FileId thumbnail: FileId
) = setStickerSetThumbnail( ) = setStickerSetThumbnail(
user.id, stickerSetName, format, thumbnail user.id, stickerSetName, thumbnail
) )
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
user: CommonUser, user: CommonUser,
stickerSetName: StickerSetName, stickerSetName: StickerSetName,
format: StickerFormat,
thumbnail: MultipartFile thumbnail: MultipartFile
) = setStickerSetThumbnail( ) = setStickerSetThumbnail(
user.id, stickerSetName, format, thumbnail user.id, stickerSetName, thumbnail
) )
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
userId: UserId, userId: UserId,
stickerSet: StickerSet, stickerSet: StickerSet,
format: StickerFormat,
thumbnail: FileId thumbnail: FileId
) = setStickerSetThumbnail( ) = setStickerSetThumbnail(
userId, stickerSet.name, format, thumbnail userId, stickerSet.name, thumbnail
) )
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
userId: UserId, userId: UserId,
stickerSet: StickerSet, stickerSet: StickerSet,
format: StickerFormat,
thumbnail: MultipartFile thumbnail: MultipartFile
) = setStickerSetThumbnail( ) = setStickerSetThumbnail(
userId, stickerSet.name, format, thumbnail userId, stickerSet.name, thumbnail
) )
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
user: CommonUser, user: CommonUser,
stickerSet: StickerSet, stickerSet: StickerSet,
format: StickerFormat,
thumbnail: FileId thumbnail: FileId
) = setStickerSetThumbnail( ) = setStickerSetThumbnail(
user.id, stickerSet, format, thumbnail user.id, stickerSet.name, thumbnail
) )
suspend fun TelegramBot.setStickerSetThumbnail( suspend fun TelegramBot.setStickerSetThumbnail(
user: CommonUser, user: CommonUser,
stickerSet: StickerSet, stickerSet: StickerSet,
format: StickerFormat,
thumbnail: MultipartFile thumbnail: MultipartFile
) = setStickerSetThumbnail( ) = setStickerSetThumbnail(
user.id, stickerSet, format, thumbnail user.id, stickerSet.name, thumbnail
) )

View File

@@ -13,8 +13,6 @@ 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
} }

File diff suppressed because it is too large Load Diff

View File

@@ -13,8 +13,7 @@ kotlin {
sourceSets { sourceSets {
commonMain { commonMain {
dependencies { dependencies {
api project(path: ':tgbotapi.core') api project(":tgbotapi.utils")
api project(path: ':tgbotapi.utils')
} }
} }
} }

Some files were not shown because too many files have changed in this diff Show More