mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 12:00:18 +00:00
Compare commits
309 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ebaef0789 | |||
| 51bb0a021f | |||
| b7c1692efa | |||
| bce5fb658c | |||
| b9bc40187f | |||
| 3da4ee4808 | |||
| 6571e8f592 | |||
| 5c13047a0b | |||
| 4908bb2cfe | |||
| a01ca43837 | |||
| a9a01e3154 | |||
| 468c54a30f | |||
| 9177e01910 | |||
| 417f72af4a | |||
| df6d70b20d | |||
| 0b12df14db | |||
| 1590e1eef2 | |||
| 6896bc0772 | |||
| ce1abb0ae2 | |||
| ac63d52b14 | |||
| e902f85b36 | |||
| 225fedde3a | |||
| 66e31e5d0c | |||
| 852065ad38 | |||
| d88fc2c9c0 | |||
| 4d92588390 | |||
| 89524290c5 | |||
| 86c86dfb8a | |||
| bdae774c62 | |||
| d70c7fdbdf | |||
| f14885a541 | |||
| 0013e91f6e | |||
| aa315f6fec | |||
| 9425380002 | |||
| 0f5bce592b | |||
| 294f80032c | |||
| a4064a15ec | |||
| 7e5064ba3c | |||
| eac45b86a6 | |||
| f0448485c8 | |||
| f2308f0312 | |||
| 76a2cfd1a0 | |||
|
|
edca5494d4 | ||
| d480c9efd6 | |||
| a106068af4 | |||
| d55253a81b | |||
| adede330fb | |||
| f2f370e40e | |||
| 86bb87bb37 | |||
| bb80eb43fd | |||
| a692ed65f3 | |||
| 60e50f9492 | |||
| e28f3492ef | |||
| f637b480b1 | |||
| 955e9ca871 | |||
| 8df72edd52 | |||
| f3b05bbffd | |||
| 95011e2b3e | |||
| cad0bf8a95 | |||
| f760e60089 | |||
| 6c76e1c47a | |||
| b5f4219635 | |||
| 5190f7b856 | |||
| 14756fd6e8 | |||
| e66537ee32 | |||
| 825ecc1d73 | |||
| 05bfbfe381 | |||
| 430240a6ad | |||
| 860e35258c | |||
| d9c39d7a26 | |||
| 52fd55eea5 | |||
| cb11532b58 | |||
| dce63713f9 | |||
| fb9ff653ef | |||
| 57f53813c8 | |||
| fc183bfd2f | |||
| c025a027c6 | |||
| db2101d85c | |||
| a01a9910b5 | |||
| 4e1ecc0e34 | |||
| 90225a9380 | |||
| 3026c8708d | |||
| 63975cc88e | |||
| a622c4d6fa | |||
| e124bb18df | |||
| 152728afca | |||
| 38d672b665 | |||
| d2c299301a | |||
| 25fb6b2b46 | |||
| 5b5de5253c | |||
| 9a7dd6ec9a | |||
| 4085f721be | |||
| ffc915cae1 | |||
| a6c90b3df5 | |||
| a6d9fa6ce3 | |||
| 7fd2442f8b | |||
| 8b37ecea9e | |||
| 35fc9f60df | |||
| 68e89dc1ad | |||
| 129fb31b74 | |||
| a2c353ca41 | |||
| cb74abfce5 | |||
| ca7314923e | |||
| 74f625a53a | |||
| 3a5fed3dd9 | |||
| 6158143220 | |||
| f8182ddb85 | |||
| b7c3f9f607 | |||
| 8763ea23fa | |||
| b412e7b3b7 | |||
| 98e5d182bb | |||
| ffc0f5abb7 | |||
| 816cf00dac | |||
| e34bc7453e | |||
| 3b2ccbf33b | |||
| 6ecfbdf56d | |||
| b49e1c50f5 | |||
| d7389dfcfe | |||
| cf5cee3e53 | |||
| 8593263506 | |||
| 4422a4d09b | |||
| 9ecb50e377 | |||
| 8a4b40c6ec | |||
| bba667db30 | |||
| ca0d256bbb | |||
| dc2fd07632 | |||
| 32fe008eef | |||
| 2b938903b6 | |||
| 080db09d2c | |||
| 0efa52fe00 | |||
| c4214798e3 | |||
| fdf510153d | |||
| edb16d7107 | |||
| c49f400201 | |||
| db7de6edf8 | |||
| a0b14233e0 | |||
| 1a479706e2 | |||
| 2719e166a8 | |||
| 051684db23 | |||
| 805cec76ce | |||
| 899c195fd5 | |||
| f5937fc4d6 | |||
| 8cf7b349df | |||
| bf8f8b9e6f | |||
| edc0b1c492 | |||
| a85d58aac1 | |||
| 10860e1bb2 | |||
| 46e6eeca9d | |||
| 80be86454d | |||
| d5f5a0e30b | |||
| 826c27874d | |||
| 4e917e8cf8 | |||
| 051210caf5 | |||
| 284fe58848 | |||
| 38c9732da5 | |||
| dee13c03ae | |||
| 6103b70a47 | |||
| 96ffae2062 | |||
| 4180721aed | |||
| 4ab0845333 | |||
| 3f9a4e95a3 | |||
| 834d60ff16 | |||
| 650d96974f | |||
| 7f5cd0567b | |||
| af159b89b6 | |||
| efe286c181 | |||
| 821bb5b45c | |||
| c92ed92f7c | |||
| 88f6b349ea | |||
| 6c4afac8f8 | |||
| 6273990b00 | |||
| 1a1fd926dd | |||
| affa2a3a57 | |||
| 73a748d8b3 | |||
| fa4d264df4 | |||
| 1b1da33882 | |||
| ccfb774f33 | |||
| 5215e8a315 | |||
| 97a3901cb9 | |||
| 034e87a8ef | |||
| 156fbd72d4 | |||
| 8ec3e01737 | |||
| 1655bedabe | |||
| ac6b580a7e | |||
| c6692c2509 | |||
| 12846a68b9 | |||
| 21f5808b12 | |||
| 64244a60fe | |||
| 4cd7fdb436 | |||
| 6daf98d47d | |||
| c260597799 | |||
| d59e204002 | |||
| 117d891ff2 | |||
| 1e451af508 | |||
| 051f5e22e7 | |||
| 6873c23309 | |||
| a65971be00 | |||
| 4b5baaff8c | |||
| 0840d2e083 | |||
| 085a225eb4 | |||
| b575871a8e | |||
| c96e162845 | |||
| c471d59b3c | |||
| 187f340e88 | |||
| 77ea1f741e | |||
| bff2713bbd | |||
| cf666aad11 | |||
| 93e72230a1 | |||
| b81308da8b | |||
| 0441b53da2 | |||
| 4853a5b3ad | |||
| 40a0d2c37d | |||
| 2e815a4c37 | |||
| 81ed820602 | |||
| b3a657b7d6 | |||
| 8247e7c69c | |||
| 67b7472868 | |||
| 13e4740d0a | |||
| 48db305541 | |||
| 6f512a144c | |||
| cf46139bef | |||
| 14a583e154 | |||
| 5b6753c484 | |||
| f153b31464 | |||
| 6f60ecbf2e | |||
| 9c57ba4da7 | |||
| d84d982eb4 | |||
|
|
2f6f40362a | ||
| e15b18fbcf | |||
| ad5cc6ade6 | |||
| 6b94215a7c | |||
| 9c98411bcb | |||
| b235ab1c28 | |||
| d4e11494e8 | |||
| e6dbf2bde9 | |||
| 5aa0284f28 | |||
| 8b2a50a21f | |||
| a7839df748 | |||
| 3155969954 | |||
| 067a0bf229 | |||
| 009991fa88 | |||
| ffbe8fc5e0 | |||
| 610ed95296 | |||
| d3f4a895ff | |||
| 51c7c376d7 | |||
| 393197eca1 | |||
| 67096f8e0e | |||
| c312a05d6b | |||
| b575695f90 | |||
| 65bcf83517 | |||
| f07a179448 | |||
| ed2c447730 | |||
| cb4c48d025 | |||
| 1a21fa85ac | |||
| 191fa5406d | |||
| 6959dacfc4 | |||
| ced11ab336 | |||
| 6686aef4fa | |||
| 9ede545e56 | |||
| a74066cf62 | |||
| 0a7e99bbb3 | |||
| 913f584469 | |||
| 20278804bf | |||
| 631f1b9427 | |||
| 5e0106beb5 | |||
| d37e01f93e | |||
|
|
d4492ec7ac | ||
| 60d24259f4 | |||
| 8e6b3b7260 | |||
| e2cbd5ee0b | |||
| 1e87677ea7 | |||
| cb3494cb39 | |||
| ce81be9dcb | |||
| 2cc02c8c85 | |||
| f5b2ee79d6 | |||
| 0ba6ebb20f | |||
| 3d2df4e255 | |||
| 33b6ff1c1e | |||
| 2859f8ca2f | |||
| f1aa67ceda | |||
| 1c66d1e2fc | |||
| 44e6d7adbc | |||
| 61a6d4a880 | |||
| e37237cb71 | |||
| 9a5a196e41 | |||
| 68f6d8553c | |||
| 6fe8e73fca | |||
| 241545c0cb | |||
| 3b2310ece1 | |||
| e1adde0978 | |||
| 3b17bce71a | |||
| 999efc64eb | |||
| 05c99642cb | |||
| cd6f4831ae | |||
| 2778315aed | |||
| ff8d67a780 | |||
| 2a5f9a629d | |||
| 75b27858dd | |||
| 034e2d7ff3 | |||
| 1f69c16f2a | |||
| 8d24512413 | |||
| 09009003e3 | |||
| 048486146c | |||
| b688fa570a | |||
| 0eba0c4e15 | |||
| f8bbfa2b1e | |||
| fec2715dc1 | |||
|
|
941a25b116 | ||
| 741d808db2 |
3
.github/workflows/greetings.yml
vendored
3
.github/workflows/greetings.yml
vendored
@@ -5,6 +5,9 @@ on: [pull_request, issues]
|
|||||||
jobs:
|
jobs:
|
||||||
greeting:
|
greeting:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/first-interaction@v1
|
- uses: actions/first-interaction@v1
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/kdocs.yml
vendored
2
.github/workflows/kdocs.yml
vendored
@@ -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: 11
|
java-version: 17
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew dokkaHtmlMultiModule
|
run: ./gradlew dokkaHtmlMultiModule
|
||||||
- name: Publish KDocs
|
- name: Publish KDocs
|
||||||
|
|||||||
11
.github/workflows/packages_publishing.yml
vendored
11
.github/workflows/packages_publishing.yml
vendored
@@ -7,20 +7,25 @@ jobs:
|
|||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: actions/setup-java@v1
|
- uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 17
|
||||||
|
- name: Setup LibCurl
|
||||||
|
run: sudo apt update && 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 "[^/]*$"`"
|
||||||
cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
||||||
rm gradle.properties
|
rm gradle.properties
|
||||||
mv gradle.properties.tmp gradle.properties
|
mv gradle.properties.tmp gradle.properties
|
||||||
|
- name: KotlinSymbolProcessing execution
|
||||||
|
run: ./gradlew ksp
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
- name: Publish to Gitea
|
- name: Publish to Gitea
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToGiteaRepository
|
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
INMONEXUS_USER: ${{ secrets.INMONEXUS_USER }}
|
||||||
|
INMONEXUS_PASSWORD: ${{ secrets.INMONEXUS_PASSWORD }}
|
||||||
- name: Publish to GithubPackages
|
- name: Publish to GithubPackages
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
||||||
|
|||||||
250
CHANGELOG.md
250
CHANGELOG.md
@@ -1,5 +1,255 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 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**
|
||||||
|
|
||||||
|
* `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`:
|
||||||
|
* Improve extension `Update.sourceChat` to add opportunity to select some chats by logic different with the default
|
||||||
|
|
||||||
|
## 8.1.0
|
||||||
|
|
||||||
|
**PARTIALLY BREAKING CHANGES: Exclude `.*Impl` classcasts from `ClassCastsNew`**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.19.2` -> `0.19.4`
|
||||||
|
* `Utils`:
|
||||||
|
* Add deep links formatting for internal `tg://` prefix (thanks to [@klimatov](https://github.com/klimatov))
|
||||||
|
* Exclude `.*Impl` classcasts from `ClassCastsNew`
|
||||||
|
|
||||||
|
## 8.0.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `UUID`: `0.7.0` -> `0.7.1`
|
||||||
|
* `Ktor`: `2.3.0` -> `2.3.1`
|
||||||
|
* `MicroUtils`: `0.19.1` -> `0.19.2`
|
||||||
|
|
||||||
|
## 8.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
**ALL PROJECT DEPRECATIONS HAVE BEEN REMOVED**
|
||||||
|
|
||||||
|
**IN THIS UPDATE KORLIBS HAVE BEEN UPDATED TO VERSION `4.0.2`. SINCE THAT VERSION A LOT OF PACKAGES HAVE BEEN RENAMED.
|
||||||
|
MIGRATIONS USED IN THIS LIB:**
|
||||||
|
|
||||||
|
* `com.soywiz.klock` -> `korlibs.time`
|
||||||
|
* `com.soywiz.krypto` -> `korlibs.crypto`
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Korlibs`: `3.4.0` -> `4.0.3`
|
||||||
|
* `MicroUtils`: `0.18.4` -> `0.19.1`
|
||||||
|
|
||||||
|
## 7.1.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Serialization`: `1.5.0` -> `1.5.1`
|
||||||
|
* `MicroUtils`: `0.18.1` -> `0.18.4`
|
||||||
|
* `Core`:
|
||||||
|
* Actualize kdocs in `InputFile`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Now it is possible to use `waitMediaContent`/`waitMediaContentMessage`/`onMediaContent`
|
||||||
|
* Add `onMention`/`waitMention` functionality
|
||||||
|
* Add opportunity to map content with extensions to `Flow`
|
||||||
|
|
||||||
|
## 7.1.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.18.0` -> `0.18.1`
|
||||||
|
* `Core`:
|
||||||
|
* Now it is possible to serialize `Sticker`s
|
||||||
|
|
||||||
|
## 7.1.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.8.20` -> `1.8.21`
|
||||||
|
* `MicroUtils`: `0.17.8` -> `0.18.0`
|
||||||
|
* `Utils`:
|
||||||
|
* Fixes in `makeLinkToMessage`
|
||||||
|
|
||||||
|
## 7.1.0
|
||||||
|
|
||||||
|
**This update contains changes according to the [Telegram Bot API 6.7](https://core.telegram.org/bots/api-changelog#april-21-2023)**
|
||||||
|
|
||||||
|
* `API`:
|
||||||
|
* Rename `editMessageCaption` to `editMessageMedia` due to wrong old naming
|
||||||
|
* Add `edit` extensions for `InlineMessageIdentifier`s
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* `BehaviourContext` extensions `onDeepLink` and `waitDeepLinks` now can be used with `Regex` or `String` as first parameters
|
||||||
|
|
||||||
|
## 7.0.2
|
||||||
|
|
||||||
|
_This update brings experimental support of `linuxX64` and `mingwX64` platforms_
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.8.10` -> `1.8.20`
|
||||||
|
* `MicroUtils`: `0.17.5` -> `0.17.8`
|
||||||
|
* `Ktor`: `2.2.4` -> `2.3.0`
|
||||||
|
* `Core`:
|
||||||
|
* New `RequestsExecutor` - `MultipleClientKtorRequestsExecutor`
|
||||||
|
* Old `KtorRequestsExecutor` has been renamed to `DefaultKtorRequestsExecutor`
|
||||||
|
* `KtorRequestsExecutor` now is `expect class`
|
||||||
|
* On `JS`, `JVM` and `MinGWX64` platforms it is `DefaultKtorRequestsExecutor`
|
||||||
|
* On `LinuxX64` platform it is `MultipleClientKtorRequestsExecutor`
|
||||||
|
|
||||||
|
## 7.0.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* New interface `WithChat` which contains `chat` field
|
||||||
|
* `Message` now inherits `WithChat`
|
||||||
|
* `ChatMemberUpdated` now inherits `WithChat`
|
||||||
|
* `Utils`:
|
||||||
|
* Improvements in `same`-notations
|
||||||
|
|
||||||
## 7.0.0
|
## 7.0.0
|
||||||
|
|
||||||
This update contains support of [Telegram Bot API 6.6](https://core.telegram.org/bots/api-changelog#march-9-2023)
|
This update contains support of [Telegram Bot API 6.6](https://core.telegram.org/bots/api-changelog#march-9-2023)
|
||||||
|
|||||||
14
README.md
14
README.md
@@ -1,9 +1,11 @@
|
|||||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#march-9-2023)
|
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#february-16-2024)
|
||||||
|
|
||||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||||
|:---:|:---:|
|
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||||
| Useful repos | [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) |
|
| Useful repos | [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) |
|
||||||
| Misc | [](https://github.com/KotlinBy/awesome-kotlin) [](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) |
|
| Misc | [](https://github.com/KotlinBy/awesome-kotlin) [](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) |
|
||||||
|
| Platforms |   |
|
||||||
|
| Experimental Platforms | [](https://kotlinlang.org/docs/native-target-support.html#tier-1) [](https://kotlinlang.org/docs/native-target-support.html#tier-1) |
|
||||||
|
|
||||||
<!--- [](https://t.me/ktgbotapi) --->
|
<!--- [](https://t.me/ktgbotapi) --->
|
||||||
|
|
||||||
@@ -116,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 [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and
|
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
|
||||||
[chat](https://t.me/InMoTelegramBotAPIChat).
|
[chat](https://t.me/InMoTelegramBotAPIChat).
|
||||||
|
|||||||
15
build.gradle
15
build.gradle
@@ -16,6 +16,7 @@ buildscript {
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
alias(libs.plugins.kotlin.dokka)
|
alias(libs.plugins.kotlin.dokka)
|
||||||
|
alias(libs.plugins.versions)
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
||||||
@@ -24,7 +25,7 @@ allprojects {
|
|||||||
mavenLocal()
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
|
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
||||||
}
|
}
|
||||||
if (it != rootProject.findProject("docs")) {
|
if (it != rootProject.findProject("docs")) {
|
||||||
tasks.whenTaskAdded { task ->
|
tasks.whenTaskAdded { task ->
|
||||||
@@ -53,13 +54,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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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/TelegramBotAPI/blob/master/"))
|
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/ktgbotapi/tree/master"))
|
||||||
remoteLineSuffix.set("#L")
|
remoteLineSuffix.set("#L")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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=7.0.0
|
library_version=10.1.1
|
||||||
|
|||||||
@@ -1,22 +1,25 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "1.8.10"
|
kotlin = "1.9.22"
|
||||||
kotlin-serialization = "1.5.0"
|
kotlin-serialization = "1.6.3"
|
||||||
kotlin-coroutines = "1.6.4"
|
kotlin-coroutines = "1.8.0"
|
||||||
|
|
||||||
javax-activation = "1.1.1"
|
javax-activation = "1.1.1"
|
||||||
|
|
||||||
korlibs = "3.4.0"
|
korlibs = "5.3.2"
|
||||||
uuid = "0.7.0"
|
uuid = "0.8.2"
|
||||||
ktor = "2.2.4"
|
ktor = "2.3.8"
|
||||||
|
|
||||||
ksp = "1.8.10-1.0.9"
|
ksp = "1.9.22-1.0.18"
|
||||||
kotlin-poet = "1.12.0"
|
kotlin-poet = "1.16.0"
|
||||||
|
|
||||||
microutils = "0.17.5"
|
microutils = "0.20.37"
|
||||||
|
kslog = "1.3.2"
|
||||||
|
|
||||||
github-release-plugin = "2.4.1"
|
versions = "0.51.0"
|
||||||
dokka = "1.8.10"
|
|
||||||
|
github-release-plugin = "2.5.2"
|
||||||
|
dokka = "1.9.10"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
@@ -31,16 +34,19 @@ kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref =
|
|||||||
|
|
||||||
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||||
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
|
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
|
||||||
|
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
|
||||||
|
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
|
||||||
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
|
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
|
||||||
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
|
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
|
||||||
|
|
||||||
javax-activation = { module = "javax.activation:activation", version.ref = "javax-activation" }
|
javax-activation = { module = "javax.activation:activation", version.ref = "javax-activation" }
|
||||||
|
|
||||||
korlibs-klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "korlibs" }
|
korlibs-klock = { module = "com.soywiz.korge:korlibs-time", version.ref = "korlibs" }
|
||||||
korlibs-krypto = { module = "com.soywiz.korlibs.krypto:krypto", version.ref = "korlibs" }
|
korlibs-krypto = { module = "com.soywiz.korge:korlibs-crypto", version.ref = "korlibs" }
|
||||||
|
|
||||||
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
|
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
|
||||||
|
|
||||||
|
microutils-colors-common = { module = "dev.inmo:micro_utils.colors.common", version.ref = "microutils" }
|
||||||
microutils-coroutines = { module = "dev.inmo:micro_utils.coroutines", version.ref = "microutils" }
|
microutils-coroutines = { module = "dev.inmo:micro_utils.coroutines", version.ref = "microutils" }
|
||||||
microutils-serialization-base64 = { module = "dev.inmo:micro_utils.serialization.base64", version.ref = "microutils" }
|
microutils-serialization-base64 = { module = "dev.inmo:micro_utils.serialization.base64", version.ref = "microutils" }
|
||||||
microutils-serialization-encapsulator = { module = "dev.inmo:micro_utils.serialization.encapsulator", version.ref = "microutils" }
|
microutils-serialization-encapsulator = { module = "dev.inmo:micro_utils.serialization.encapsulator", version.ref = "microutils" }
|
||||||
@@ -50,6 +56,8 @@ microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", ver
|
|||||||
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
|
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
|
||||||
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
||||||
|
|
||||||
|
kslog = { module = "dev.inmo:kslog", version.ref = "kslog" }
|
||||||
|
|
||||||
# ksp dependencies
|
# ksp dependencies
|
||||||
|
|
||||||
kotlin-poet = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlin-poet" }
|
kotlin-poet = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlin-poet" }
|
||||||
@@ -69,3 +77,4 @@ kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|||||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||||
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
|
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ kotlin {
|
|||||||
jvm {
|
jvm {
|
||||||
compilations.main {
|
compilations.main {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = "1.8"
|
jvmTarget = "17"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -13,6 +13,9 @@ kotlin {
|
|||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
}
|
}
|
||||||
|
linuxX64()
|
||||||
|
mingwX64()
|
||||||
|
linuxArm64()
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
@@ -38,10 +41,18 @@ 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_1_8
|
sourceCompatibility = JavaVersion.VERSION_17
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_17
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
archiveClassifier.convention("javadoc")
|
archiveClassifier = 'javadoc'
|
||||||
archiveClassifier.set("javadoc")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
@@ -20,22 +19,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 {
|
||||||
@@ -43,58 +42,77 @@ 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('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
|
if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) {
|
||||||
maven {
|
maven {
|
||||||
name = "Gitea"
|
name = "InmoNexus"
|
||||||
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
|
||||||
|
|
||||||
credentials(HttpHeaderCredentials) {
|
credentials {
|
||||||
name = "Authorization"
|
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
|
||||||
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
authentication {
|
|
||||||
header(HttpHeaderAuthentication)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
@@ -16,6 +16,9 @@ kotlin {
|
|||||||
api project(":tgbotapi.core")
|
api project(":tgbotapi.core")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
configureEach {
|
||||||
|
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -23,7 +22,7 @@ suspend fun TelegramBot.deleteMessage(
|
|||||||
) = deleteMessage(chat.id, messageId)
|
) = deleteMessage(chat.id, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
message: Message
|
message: AccessibleMessage
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
||||||
if (mediaGroupContent == null) {
|
if (mediaGroupContent == null) {
|
||||||
@@ -46,9 +45,9 @@ suspend fun TelegramBot.delete(
|
|||||||
) = deleteMessage(chat, messageId)
|
) = deleteMessage(chat, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.delete(
|
suspend fun TelegramBot.delete(
|
||||||
message: Message
|
message: AccessibleMessage
|
||||||
) = deleteMessage(message)
|
) = deleteMessage(message)
|
||||||
|
|
||||||
suspend fun Message.delete(
|
suspend fun AccessibleMessage.delete(
|
||||||
requestsExecutor: TelegramBot
|
requestsExecutor: TelegramBot
|
||||||
) = requestsExecutor.deleteMessage(this)
|
) = requestsExecutor.deleteMessage(this)
|
||||||
|
|||||||
@@ -0,0 +1,78 @@
|
|||||||
|
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(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId
|
||||||
|
) = deleteMessages(
|
||||||
|
chatId = chatId,
|
||||||
|
messageIds = (listOf(firstMessageId) + 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(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
secondMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId
|
||||||
|
) = deleteMessages(chatId = chatId, messageIds = (listOf(firstMessageId, secondMessageId) + messageIds.toList()))
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
messagesMetas: List<Message.MetaInfo>
|
||||||
|
) = deleteMessages(messagesMetas)
|
||||||
|
|
||||||
|
@JvmName("deleteWithMessages")
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
messages: List<AccessibleMessage>
|
||||||
|
) = deleteMessages(messages)
|
||||||
@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.threadId
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
@@ -49,7 +49,7 @@ suspend fun TelegramBot.forwardMessage(
|
|||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
@@ -57,7 +57,7 @@ suspend fun TelegramBot.forwardMessage(
|
|||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
|
|||||||
@@ -0,0 +1,193 @@
|
|||||||
|
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,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = (listOf(firstMessageId) + messageIds.toList()),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forwardMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
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,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = forwardMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
firstMessageId = firstMessageId,
|
||||||
|
messageIds = *messageIds,
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.forward(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
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
|
||||||
|
)
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.GetUpdates
|
||||||
|
import dev.inmo.tgbotapi.requests.GetUpdatesRaw
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getRawUpdates(
|
||||||
|
offset: UpdateIdentifier? = 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
|
||||||
|
)
|
||||||
@@ -44,8 +44,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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
|
||||||
@@ -71,8 +70,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
it.replyMarkup
|
it.replyMarkup
|
||||||
).also {
|
).also {
|
||||||
sentMessageFlow ?.emit(it)
|
sentMessageFlow ?.emit(it)
|
||||||
@@ -106,8 +104,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
handleLiveLocation(
|
handleLiveLocation(
|
||||||
@@ -126,8 +123,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
sentMessageFlow
|
sentMessageFlow
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -145,8 +141,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
handleLiveLocation(
|
handleLiveLocation(
|
||||||
@@ -161,8 +156,7 @@ suspend fun TelegramBot.handleLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
sentMessageFlow
|
sentMessageFlow
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,25 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import korlibs.time.DateTime
|
||||||
import com.soywiz.klock.TimeSpan
|
import korlibs.time.TimeSpan
|
||||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
|
||||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
|
||||||
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
|
||||||
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
import io.ktor.utils.io.core.Closeable
|
import io.ktor.utils.io.core.Closeable
|
||||||
|
import korlibs.time.millisecondsLong
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.CoroutineStart
|
|
||||||
import kotlinx.coroutines.currentCoroutineContext
|
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.flow.Flow
|
|
||||||
import kotlinx.coroutines.flow.map
|
|
||||||
import kotlinx.coroutines.isActive
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.js.JsName
|
|
||||||
import kotlin.jvm.JvmName
|
|
||||||
import kotlin.math.ceil
|
import kotlin.math.ceil
|
||||||
|
|
||||||
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
||||||
@@ -110,8 +96,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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()
|
||||||
@@ -127,8 +112,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -157,8 +141,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
scope,
|
scope,
|
||||||
@@ -172,8 +155,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -192,8 +174,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
scope,
|
scope,
|
||||||
@@ -207,8 +188,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -227,8 +207,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
scope,
|
scope,
|
||||||
@@ -242,8 +221,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -252,7 +230,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
@@ -277,8 +255,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -287,7 +264,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||||
to: Message,
|
to: AccessibleMessage,
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
@@ -310,7 +287,6 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.StopPoll
|
|||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -35,7 +35,7 @@ suspend fun TelegramBot.stopPoll(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
suspend fun TelegramBot.stopPoll(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chatId, message.messageId, replyMarkup)
|
) = stopPoll(chatId, message.messageId, replyMarkup)
|
||||||
|
|
||||||
@@ -45,6 +45,6 @@ suspend fun TelegramBot.stopPoll(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
suspend fun TelegramBot.stopPoll(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ 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.AnswerInlineQuery
|
import dev.inmo.tgbotapi.requests.answers.AnswerInlineQuery
|
||||||
|
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.InlineQueryIdentifier
|
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||||
@@ -12,8 +13,37 @@ suspend fun TelegramBot.answerInlineQuery(
|
|||||||
cachedTime: Int? = null,
|
cachedTime: Int? = null,
|
||||||
isPersonal: Boolean? = null,
|
isPersonal: Boolean? = null,
|
||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
switchPmText: String? = null,
|
button: InlineQueryResultsButton? = null
|
||||||
switchPmParameter: String? = null
|
) = execute(
|
||||||
|
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.answerInlineQuery(
|
||||||
|
inlineQuery: InlineQuery,
|
||||||
|
results: List<InlineQueryResult> = emptyList(),
|
||||||
|
cachedTime: Int? = null,
|
||||||
|
isPersonal: Boolean? = null,
|
||||||
|
nextOffset: String? = null,
|
||||||
|
button: InlineQueryResultsButton? = null
|
||||||
|
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.answer(
|
||||||
|
inlineQuery: InlineQuery,
|
||||||
|
results: List<InlineQueryResult> = emptyList(),
|
||||||
|
cachedTime: Int? = null,
|
||||||
|
isPersonal: Boolean? = null,
|
||||||
|
nextOffset: String? = null,
|
||||||
|
button: InlineQueryResultsButton? = null
|
||||||
|
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.answerInlineQuery(
|
||||||
|
inlineQueryID: InlineQueryIdentifier,
|
||||||
|
results: List<InlineQueryResult> = emptyList(),
|
||||||
|
cachedTime: Int? = null,
|
||||||
|
isPersonal: Boolean? = null,
|
||||||
|
nextOffset: String? = null,
|
||||||
|
switchPmText: String?,
|
||||||
|
switchPmParameter: String?
|
||||||
) = execute(
|
) = execute(
|
||||||
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
)
|
)
|
||||||
@@ -24,8 +54,8 @@ suspend fun TelegramBot.answerInlineQuery(
|
|||||||
cachedTime: Int? = null,
|
cachedTime: Int? = null,
|
||||||
isPersonal: Boolean? = null,
|
isPersonal: Boolean? = null,
|
||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
switchPmText: String? = null,
|
switchPmText: String?,
|
||||||
switchPmParameter: String? = null
|
switchPmParameter: String?
|
||||||
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
|
|
||||||
suspend fun TelegramBot.answer(
|
suspend fun TelegramBot.answer(
|
||||||
@@ -34,6 +64,6 @@ suspend fun TelegramBot.answer(
|
|||||||
cachedTime: Int? = null,
|
cachedTime: Int? = null,
|
||||||
isPersonal: Boolean? = null,
|
isPersonal: Boolean? = null,
|
||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
switchPmText: String? = null,
|
switchPmText: String?,
|
||||||
switchPmParameter: String? = null
|
switchPmParameter: String?
|
||||||
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
|
import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||||
@@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
|
|
||||||
suspend fun TelegramBot.deleteMyCommands(
|
suspend fun TelegramBot.deleteMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode?
|
languageCode: IetfLang?
|
||||||
) = execute(DeleteMyCommands(scope, languageCode))
|
) = execute(DeleteMyCommands(scope, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMyCommands(
|
suspend fun TelegramBot.deleteMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String? = null
|
languageCode: String? = null
|
||||||
) = deleteMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
) = deleteMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||||
@@ -8,10 +8,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
|
|
||||||
suspend fun TelegramBot.getMyCommands(
|
suspend fun TelegramBot.getMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(GetMyCommands(scope, languageCode))
|
) = execute(GetMyCommands(scope, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyCommands(
|
suspend fun TelegramBot.getMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = getMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
) = getMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,16 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
|
||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyDescription(
|
suspend fun TelegramBot.getMyDescription(
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(GetMyDescription(languageCode))
|
) = execute(GetMyDescription(languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyDescription(
|
suspend fun TelegramBot.getMyDescription(
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = getMyDescription(languageCode ?.let(::IetfLanguageCode))
|
) = getMyDescription(languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getMyName(
|
||||||
|
languageCode: IetfLang? = null
|
||||||
|
) = execute(GetMyName(languageCode))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getMyName(
|
||||||
|
languageCode: String?
|
||||||
|
) = getMyName(languageCode ?.let(::IetfLang))
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
|
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
|
||||||
@@ -8,9 +8,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
|||||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyShortDescription(
|
suspend fun TelegramBot.getMyShortDescription(
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(GetMyShortDescription(languageCode))
|
) = execute(GetMyShortDescription(languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.getMyShortDescription(
|
suspend fun TelegramBot.getMyShortDescription(
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = getMyShortDescription(languageCode ?.let(::IetfLanguageCode))
|
) = getMyShortDescription(languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.tgbotapi.types.BotCommand
|
||||||
@@ -10,20 +10,20 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
commands: List<BotCommand>,
|
commands: List<BotCommand>,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode?
|
languageCode: IetfLang?
|
||||||
) = execute(SetMyCommands(commands, scope, languageCode))
|
) = execute(SetMyCommands(commands, scope, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
vararg commands: BotCommand,
|
vararg commands: BotCommand,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLanguageCode?
|
languageCode: IetfLang?
|
||||||
) = setMyCommands(commands.toList(), scope, languageCode)
|
) = setMyCommands(commands.toList(), scope, languageCode)
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
commands: List<BotCommand>,
|
commands: List<BotCommand>,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String? = null
|
languageCode: String? = null
|
||||||
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLanguageCode))
|
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyCommands(
|
suspend fun TelegramBot.setMyCommands(
|
||||||
vararg commands: BotCommand,
|
vararg commands: BotCommand,
|
||||||
|
|||||||
@@ -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.ChatAdministratorRightsImpl
|
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
||||||
rights: ChatAdministratorRightsImpl,
|
rights: ChatCommonAdministratorRights,
|
||||||
forChannels: Boolean? = null
|
forChannels: Boolean? = null
|
||||||
) = execute(SetMyDefaultAdministratorRights(rights, forChannels))
|
) = execute(SetMyDefaultAdministratorRights(rights, forChannels))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
|
suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
|
||||||
rights: ChatAdministratorRightsImpl
|
rights: ChatCommonAdministratorRights
|
||||||
) = setMyDefaultAdministratorRights(rights, forChannels = true)
|
) = setMyDefaultAdministratorRights(rights, forChannels = true)
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
|
suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
|
||||||
rights: ChatAdministratorRightsImpl
|
rights: ChatCommonAdministratorRights
|
||||||
) = setMyDefaultAdministratorRights(rights, forChannels = false)
|
) = setMyDefaultAdministratorRights(rights, forChannels = false)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||||
@@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
|
|
||||||
suspend fun TelegramBot.setMyDescription(
|
suspend fun TelegramBot.setMyDescription(
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(SetMyDescription(description, languageCode))
|
) = execute(SetMyDescription(description, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyDescription(
|
suspend fun TelegramBot.setMyDescription(
|
||||||
description: String?,
|
description: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = setMyDescription(description, languageCode ?.let(::IetfLanguageCode))
|
) = setMyDescription(description, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
|
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.SetMyName
|
||||||
|
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||||
|
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMyName(
|
||||||
|
name: String? = null,
|
||||||
|
languageCode: IetfLang? = null
|
||||||
|
) = execute(SetMyName(name, languageCode))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.setMyName(
|
||||||
|
name: String?,
|
||||||
|
languageCode: String?
|
||||||
|
) = setMyName(name, languageCode ?.let(::IetfLang))
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.bot
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyShortDescription(
|
suspend fun TelegramBot.setMyShortDescription(
|
||||||
shortDescription: String? = null,
|
shortDescription: String? = null,
|
||||||
languageCode: IetfLanguageCode? = null
|
languageCode: IetfLang? = null
|
||||||
) = execute(SetMyShortDescription(shortDescription, languageCode))
|
) = execute(SetMyShortDescription(shortDescription, languageCode))
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyShortDescription(
|
suspend fun TelegramBot.setMyShortDescription(
|
||||||
shortDescription: String?,
|
shortDescription: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLanguageCode))
|
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
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)
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import korlibs.time.DateTime
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink
|
import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import korlibs.time.DateTime
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink
|
import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
|||||||
@@ -0,0 +1,157 @@
|
|||||||
|
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
|
||||||
|
)
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
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
|
||||||
|
)
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
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.IdChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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,
|
||||||
@@ -24,27 +23,34 @@ 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,
|
||||||
@@ -60,25 +66,32 @@ 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,
|
||||||
@@ -94,25 +107,32 @@ 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,
|
||||||
@@ -128,21 +148,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
|
||||||
) = 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
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,133 @@
|
|||||||
|
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
|
||||||
|
)
|
||||||
@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.PinChatMessage
|
|||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
suspend fun TelegramBot.pinChatMessage(
|
suspend fun TelegramBot.pinChatMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -20,6 +20,6 @@ suspend fun TelegramBot.pinChatMessage(
|
|||||||
) = pinChatMessage(chat.id, messageId, disableNotification)
|
) = pinChatMessage(chat.id, messageId, disableNotification)
|
||||||
|
|
||||||
suspend fun TelegramBot.pinChatMessage(
|
suspend fun TelegramBot.pinChatMessage(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
) = pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
) = pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage
|
|||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -18,5 +18,5 @@ suspend fun TelegramBot.unpinChatMessage(
|
|||||||
) = unpinChatMessage(chat.id, messageId)
|
) = unpinChatMessage(chat.id, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
message: Message
|
message: AccessibleMessage
|
||||||
) = unpinChatMessage(message.chat.id, message.messageId)
|
) = unpinChatMessage(message.chat.id, message.messageId)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import dev.inmo.tgbotapi.types.location.LiveLocation
|
|||||||
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
@@ -181,7 +181,7 @@ suspend fun TelegramBot.edit(
|
|||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageReplyMarkup(message, replyMarkup)
|
) = editMessageReplyMarkup(message, replyMarkup)
|
||||||
|
|
||||||
@@ -194,9 +194,9 @@ suspend fun TelegramBot.edit(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -206,9 +206,9 @@ suspend fun TelegramBot.edit(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -218,10 +218,10 @@ suspend fun TelegramBot.edit(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -231,10 +231,10 @@ suspend fun TelegramBot.edit(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -244,9 +244,9 @@ suspend fun TelegramBot.edit(
|
|||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = edit(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = edit(message.chat.id, message.messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -255,9 +255,9 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = edit(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
) = edit(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -266,10 +266,10 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -278,10 +278,10 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.edit(
|
suspend fun TelegramBot.edit(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -290,10 +290,10 @@ suspend fun TelegramBot.edit(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -302,7 +302,7 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = edit(message, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.edit
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
|
||||||
|
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.media.editMessageMedia
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
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.media.TelegramMedia
|
||||||
|
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.TextSourcesList
|
||||||
|
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
|
||||||
|
import dev.inmo.tgbotapi.utils.buildEntities
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
horizontalAccuracy: Meters? = null,
|
||||||
|
heading: Degrees? = null,
|
||||||
|
proximityAlertRadius: Meters? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(messageId, latitude, longitude, horizontalAccuracy, heading, proximityAlertRadius, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
location: LiveLocation,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(
|
||||||
|
messageId, location, replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
media: TelegramMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageMedia(messageId, media, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageReplyMarkup(messageId, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageText(messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageText(messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
messageId: InlineMessageIdentifier,
|
||||||
|
separator: String,
|
||||||
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
@@ -11,7 +11,7 @@ import dev.inmo.tgbotapi.types.message.ParseMode
|
|||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ suspend fun <T> TelegramBot.editMessageCaption(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not media message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not media message this method will throw an exception")
|
||||||
suspend fun <T> TelegramBot.editMessageCaption(
|
suspend fun <T> TelegramBot.editMessageCaption(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: List<TextSource>,
|
entities: List<TextSource>,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
|||||||
* @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.editMessageCaption(
|
suspend fun TelegramBot.editMessageMedia(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
media: TelegramMedia,
|
media: TelegramMedia,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
|||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -35,7 +35,7 @@ suspend fun TelegramBot.editMessageReplyMarkup(
|
|||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageReplyMarkup(
|
suspend fun TelegramBot.editMessageReplyMarkup(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
||||||
|
|
||||||
|
|||||||
@@ -3,13 +3,14 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText
|
import dev.inmo.tgbotapi.requests.edit.text.EditChatMessageText
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.LinkPreviewOptions
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.utils.*
|
import dev.inmo.tgbotapi.utils.*
|
||||||
@@ -23,10 +24,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
EditChatMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
EditChatMessageText(chatId, messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,9 +39,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -50,9 +51,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, text, parseMode, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -62,10 +63,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
EditChatMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
|
EditChatMessageText(chatId, messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -76,10 +77,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -89,10 +90,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -102,9 +103,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chat.id, messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -114,10 +115,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -127,10 +128,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -139,9 +140,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -150,10 +151,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -162,10 +163,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: ContentMessage<TextContent>,
|
message: ContentMessage<TextContent>,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -173,11 +174,11 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, entities, linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -185,12 +186,12 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -198,9 +199,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
@RiskFeature("This method is unsafe due to absence of any guaranties about the type of message. In case if message is not text message this method will throw an exception")
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.text
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
|
import dev.inmo.tgbotapi.requests.edit.text.EditInlineMessageText
|
||||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.LinkPreviewOptions
|
||||||
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.message.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
@@ -18,9 +19,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, replyMarkup))
|
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, linkPreviewOptions, replyMarkup))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -29,9 +30,9 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(EditInlineMessageText(inlineMessageId, entities, disableWebPagePreview, replyMarkup))
|
) = execute(EditInlineMessageText(inlineMessageId, entities, linkPreviewOptions, replyMarkup))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -40,10 +41,10 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -52,7 +53,7 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null,
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), linkPreviewOptions, replyMarkup)
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.get
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.get.GetUserChatBoosts
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getUserChatBoosts(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId
|
||||||
|
) = execute(
|
||||||
|
GetUserChatBoosts(chatId = chatId, userId = userId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getUserChatBoosts(
|
||||||
|
chat: Chat,
|
||||||
|
userId: UserId
|
||||||
|
) = getUserChatBoosts(chatId = chat.id, userId = userId)
|
||||||
@@ -2,15 +2,12 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
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,8 +22,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(
|
CopyMessage(
|
||||||
@@ -38,8 +34,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -57,10 +52,9 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -75,10 +69,9 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -93,10 +86,9 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,8 +103,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(
|
CopyMessage(
|
||||||
@@ -123,8 +114,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -141,10 +131,9 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChatId, entities, threadId, disableNotification, protectContent, replyParameters, 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,10 +147,9 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChatId, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChatId, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -175,10 +163,9 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -186,16 +173,15 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -203,16 +189,15 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, threadId, disableNotification, protectContent, replyParameters, 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,15 +205,14 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, message.messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, message.messageId, toChatId, entities, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -236,15 +220,14 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: AccessibleMessage,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, message.messageId, toChat, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, message.messageId, toChat, entities, threadId, disableNotification, protectContent, replyParameters, 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,8 +242,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(
|
CopyMessage(
|
||||||
@@ -272,8 +254,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -291,8 +272,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(
|
) = copyMessage(
|
||||||
toChatId,
|
toChatId,
|
||||||
@@ -303,8 +283,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -321,8 +300,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(
|
) = copyMessage(
|
||||||
toChat.id,
|
toChat.id,
|
||||||
@@ -333,8 +311,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -351,8 +328,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(
|
) = copyMessage(
|
||||||
toChat.id,
|
toChat.id,
|
||||||
@@ -363,8 +339,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -381,8 +356,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(
|
CopyMessage(
|
||||||
@@ -393,8 +367,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -411,8 +384,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(
|
) = copyMessage(
|
||||||
toChatId,
|
toChatId,
|
||||||
@@ -422,8 +394,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -439,8 +410,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(
|
) = copyMessage(
|
||||||
toChat.id,
|
toChat.id,
|
||||||
@@ -450,8 +420,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -467,8 +436,7 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(
|
) = copyMessage(
|
||||||
toChat.id,
|
toChat.id,
|
||||||
@@ -478,7 +446,6 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,192 @@
|
|||||||
|
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,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = copyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
messageIds = (listOf(firstMessageId) + messageIds.toList()),
|
||||||
|
threadId = threadId,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
removeCaption = removeCaption
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.copyMessages(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
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,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
firstMessageId: MessageId,
|
||||||
|
vararg messageIds: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
removeCaption: Boolean = false
|
||||||
|
) = copyMessages(
|
||||||
|
toChatId = toChatId,
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
firstMessageId = firstMessageId,
|
||||||
|
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
|
||||||
|
)
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,11 @@
|
|||||||
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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -19,8 +16,7 @@ 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,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
content.createResend(
|
content.createResend(
|
||||||
@@ -28,8 +24,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
|
|||||||
messageThreadId = messageThreadId,
|
messageThreadId = messageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
) as ContentMessage<T>
|
) as ContentMessage<T>
|
||||||
@@ -43,8 +38,7 @@ 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,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = resend(
|
) = resend(
|
||||||
chatId = chat.id,
|
chatId = chat.id,
|
||||||
@@ -52,8 +46,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
|
|||||||
messageThreadId = messageThreadId,
|
messageThreadId = messageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -68,8 +61,7 @@ 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,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = resend(
|
) = resend(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
@@ -77,8 +69,7 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
|
|||||||
messageThreadId = messageThreadId,
|
messageThreadId = messageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -93,8 +84,7 @@ 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,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = resend(
|
) = resend(
|
||||||
chatId = chat.id,
|
chatId = chat.id,
|
||||||
@@ -102,7 +92,6 @@ suspend inline fun <T : MessageContent> TelegramBot.resend(
|
|||||||
messageThreadId = messageThreadId,
|
messageThreadId = messageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -18,12 +18,11 @@ suspend fun TelegramBot.sendContact(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendContact(
|
SendContact(
|
||||||
chatId, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -37,12 +36,11 @@ suspend fun TelegramBot.sendContact(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendContact(
|
SendContact(
|
||||||
chatId, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, contact, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -58,11 +56,10 @@ suspend fun TelegramBot.sendContact(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendContact(
|
) = sendContact(
|
||||||
chat.id, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, phoneNumber, firstName, lastName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,9 +72,8 @@ suspend fun TelegramBot.sendContact(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendContact(
|
) = sendContact(
|
||||||
chat.id, contact, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, contact, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,13 +2,10 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -20,11 +17,10 @@ suspend fun TelegramBot.sendDice(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendDice(chatId, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendDice(chatId, animationType, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,7 +33,6 @@ suspend fun TelegramBot.sendDice(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendDice(chat.id, animationType, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendDice(chat.id, animationType, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -22,8 +22,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendLiveLocation(
|
SendLiveLocation(
|
||||||
@@ -37,8 +36,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -57,8 +55,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
chatId,
|
chatId,
|
||||||
@@ -71,8 +68,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -91,8 +87,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
chat.id,
|
chat.id,
|
||||||
@@ -105,8 +100,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -124,8 +118,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
chat.id,
|
chat.id,
|
||||||
@@ -138,8 +131,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -158,10 +150,9 @@ suspend fun TelegramBot.sendLiveLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -177,10 +168,9 @@ suspend fun TelegramBot.sendLiveLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -197,10 +187,9 @@ suspend fun TelegramBot.sendLiveLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -216,7 +205,6 @@ suspend fun TelegramBot.sendLiveLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -19,24 +19,22 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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,
|
||||||
disableWebPagePreview,
|
linkPreviewOptions,
|
||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -49,15 +47,14 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(
|
) = sendMessage(
|
||||||
chatId, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -68,14 +65,13 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,14 +82,13 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -102,15 +97,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendTextMessage(chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendTextMessage(chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,15 +114,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,15 +131,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -155,15 +147,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(
|
) = sendMessage(
|
||||||
chatId, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -173,15 +164,14 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -191,15 +181,14 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chatId, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -208,14 +197,13 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -224,15 +212,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -242,15 +229,14 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendMessage(
|
suspend fun TelegramBot.sendMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -260,14 +246,13 @@ suspend fun TelegramBot.sendMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendTextMessage(chat.id, entities, disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat.id, entities, linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -276,15 +261,14 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: TextSource? = null,
|
separator: TextSource? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -294,12 +278,11 @@ suspend fun TelegramBot.sendTextMessage(
|
|||||||
suspend fun TelegramBot.sendTextMessage(
|
suspend fun TelegramBot.sendTextMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
separator: String,
|
separator: String,
|
||||||
disableWebPagePreview: Boolean? = null,
|
linkPreviewOptions: LinkPreviewOptions? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
builderBody: EntitiesBuilderBody
|
builderBody: EntitiesBuilderBody
|
||||||
) = sendTextMessage(chat, buildEntities(separator, builderBody), disableWebPagePreview, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -2,13 +2,10 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -21,8 +18,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendStaticLocation(
|
SendStaticLocation(
|
||||||
@@ -32,8 +28,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
replyParameters = replyParameters,
|
||||||
replyToMessageId = replyToMessageId,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -48,8 +43,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
chatId,
|
chatId,
|
||||||
@@ -58,8 +52,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
allowSendingWithoutReply,
|
replyParameters,
|
||||||
replyToMessageId,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,8 +67,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
chat.id,
|
chat.id,
|
||||||
@@ -84,8 +76,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
allowSendingWithoutReply,
|
replyParameters,
|
||||||
replyToMessageId,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -99,8 +90,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
chat.id,
|
chat.id,
|
||||||
@@ -109,8 +99,7 @@ suspend fun TelegramBot.sendLocation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
allowSendingWithoutReply,
|
replyParameters,
|
||||||
replyToMessageId,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -125,10 +114,9 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
|
) = sendLocation(chatId, latitude, longitude, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -140,10 +128,9 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chatId, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
|
) = sendLocation(chatId, location.latitude, location.longitude, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -156,10 +143,9 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chat.id, latitude, longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
|
) = sendLocation(chat.id, latitude, longitude, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -171,7 +157,6 @@ suspend fun TelegramBot.sendStaticLocation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyToMessageId: MessageId? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendLocation(chat.id, location.latitude, location.longitude, threadId, disableNotification, protectContent, allowSendingWithoutReply, replyToMessageId, replyMarkup)
|
) = sendLocation(chat.id, location.latitude, location.longitude, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVenue(
|
SendVenue(
|
||||||
@@ -42,8 +41,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -65,8 +63,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
chatId = chat.id,
|
chatId = chat.id,
|
||||||
@@ -81,8 +78,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -102,8 +98,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
@@ -118,8 +113,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -139,8 +133,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
chatId = chat.id,
|
chatId = chat.id,
|
||||||
@@ -155,8 +148,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -170,8 +162,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVenue(
|
SendVenue(
|
||||||
@@ -180,8 +171,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -196,8 +186,7 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
chatId = chat.id,
|
chatId = chat.id,
|
||||||
@@ -205,7 +194,6 @@ suspend fun TelegramBot.sendVenue(
|
|||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = replyToMessageId,
|
replyParameters = replyParameters,
|
||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,122 @@
|
|||||||
|
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.js.JsName
|
||||||
|
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)
|
||||||
@@ -2,13 +2,10 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -20,12 +17,11 @@ suspend fun TelegramBot.sendGame(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendGame(
|
SendGame(
|
||||||
chatId, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, gameShortName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -39,11 +35,10 @@ suspend fun TelegramBot.sendGame(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
chat.id, gameShortName, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, gameShortName, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,11 +51,10 @@ suspend fun TelegramBot.sendGame(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
chatId, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, game.title, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,9 +67,8 @@ suspend fun TelegramBot.sendGame(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
chat.id, game.title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, game.title, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -30,8 +27,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendAnimation(
|
SendAnimation(
|
||||||
@@ -47,8 +43,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -69,11 +64,10 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(
|
) = sendAnimation(
|
||||||
chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, animation.fileId, animation.thumbnail ?.fileId, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,10 +87,9 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -114,10 +107,9 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,8 +128,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendAnimation(
|
SendAnimation(
|
||||||
@@ -152,8 +143,7 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -173,11 +163,10 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(
|
) = sendAnimation(
|
||||||
chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, animation.fileId, animation.thumbnail ?.fileId, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -196,10 +185,9 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -216,7 +204,6 @@ suspend fun TelegramBot.sendAnimation(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(chat.id, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(chat.id, animation, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -29,8 +26,7 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendAudio(
|
SendAudio(
|
||||||
@@ -45,8 +41,7 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -67,10 +62,9 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -85,10 +79,9 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyParameters, 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,10 +96,9 @@ suspend fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, text, parseMode, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, text, parseMode, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,8 +116,7 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendAudio(
|
SendAudio(
|
||||||
@@ -139,8 +130,7 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -160,10 +150,9 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -177,10 +166,9 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -194,7 +182,6 @@ suspend inline fun TelegramBot.sendAudio(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(chat.id, audio, entities, title, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(chat.id, audio, entities, title, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -26,8 +23,7 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
@@ -40,8 +36,7 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
disableContentTypeDetection
|
disableContentTypeDetection
|
||||||
)
|
)
|
||||||
@@ -60,11 +55,10 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, thumb, text, parseMode, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -78,12 +72,11 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,11 +91,10 @@ suspend fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, text, parseMode, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -116,8 +108,7 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
@@ -129,8 +120,7 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup,
|
replyMarkup,
|
||||||
disableContentTypeDetection
|
disableContentTypeDetection
|
||||||
)
|
)
|
||||||
@@ -148,11 +138,10 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, thumb, entities, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -165,12 +154,11 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection
|
chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -184,8 +172,7 @@ suspend inline fun TelegramBot.sendDocument(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(chat.id, document, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(chat.id, document, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup, disableContentTypeDetection)
|
||||||
|
|||||||
@@ -2,16 +2,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.send.media.*
|
import dev.inmo.tgbotapi.requests.send.media.*
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
|
|
||||||
@@ -25,11 +22,10 @@ suspend fun TelegramBot.sendMediaGroup(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = execute(
|
) = execute(
|
||||||
SendMediaGroup<MediaGroupPartContent>(
|
SendMediaGroup<MediaGroupPartContent>(
|
||||||
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -43,10 +39,9 @@ suspend fun TelegramBot.sendMediaGroup(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendMediaGroup(
|
) = sendMediaGroup(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,10 +55,9 @@ suspend fun TelegramBot.sendMediaGroup(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendMediaGroup(
|
) = sendMediaGroup(
|
||||||
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -77,10 +71,9 @@ suspend fun TelegramBot.sendMediaGroup(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendMediaGroup(
|
) = sendMediaGroup(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,11 +85,10 @@ suspend fun TelegramBot.sendPlaylist(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = execute(
|
) = execute(
|
||||||
SendPlaylist(
|
SendPlaylist(
|
||||||
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -109,10 +101,9 @@ suspend fun TelegramBot.sendPlaylist(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendPlaylist(
|
) = sendPlaylist(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,10 +116,9 @@ suspend fun TelegramBot.sendPlaylist(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendPlaylist(
|
) = sendPlaylist(
|
||||||
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,10 +131,9 @@ suspend fun TelegramBot.sendPlaylist(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendPlaylist(
|
) = sendPlaylist(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -156,11 +145,10 @@ suspend fun TelegramBot.sendDocumentsGroup(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = execute(
|
) = execute(
|
||||||
SendDocumentsGroup(
|
SendDocumentsGroup(
|
||||||
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -173,10 +161,9 @@ suspend fun TelegramBot.sendDocumentsGroup(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendDocumentsGroup(
|
) = sendDocumentsGroup(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -189,10 +176,9 @@ suspend fun TelegramBot.sendDocumentsGroup(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendDocumentsGroup(
|
) = sendDocumentsGroup(
|
||||||
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,10 +191,9 @@ suspend fun TelegramBot.sendDocumentsGroup(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendDocumentsGroup(
|
) = sendDocumentsGroup(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -220,11 +205,10 @@ suspend fun TelegramBot.sendVisualMediaGroup(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVisualMediaGroup(
|
SendVisualMediaGroup(
|
||||||
chatId, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -237,10 +221,9 @@ suspend fun TelegramBot.sendVisualMediaGroup(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendVisualMediaGroup(
|
) = sendVisualMediaGroup(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -253,10 +236,9 @@ suspend fun TelegramBot.sendVisualMediaGroup(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendVisualMediaGroup(
|
) = sendVisualMediaGroup(
|
||||||
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,8 +251,7 @@ suspend fun TelegramBot.sendVisualMediaGroup(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = sendVisualMediaGroup(
|
) = sendVisualMediaGroup(
|
||||||
chat.id, media, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply
|
chat.id, media, threadId, disableNotification, protectContent, replyParameters
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -26,8 +23,7 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendPhoto(
|
SendPhoto(
|
||||||
@@ -39,8 +35,7 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -58,10 +53,9 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -76,10 +70,9 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -94,10 +87,9 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, photo, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -112,10 +104,9 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chatId, photoSize.fileId, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -130,10 +121,9 @@ suspend fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, photoSize, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,8 +138,7 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendPhoto(
|
SendPhoto(
|
||||||
@@ -160,8 +149,7 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -178,10 +166,9 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, fileId, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -195,10 +182,9 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chatId, photo.biggest() ?.fileId ?: error("Photo content must not be empty"), entities, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -212,10 +198,9 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, photo, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, photo, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -229,10 +214,9 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chatId, photoSize.fileId, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chatId, photoSize.fileId, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -246,7 +230,6 @@ suspend inline fun TelegramBot.sendPhoto(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(chat.id, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(chat.id, photoSize, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -22,11 +19,10 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
emoji: String? = null,
|
emoji: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendSticker(chatId, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendSticker(chatId, sticker, threadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,10 +36,9 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
emoji: String? = null,
|
emoji: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(chat.id, sticker, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(chat.id, sticker, threadId, emoji, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -56,10 +51,9 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
emoji: String? = null,
|
emoji: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(chatId, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(chatId, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -72,7 +66,6 @@ suspend fun TelegramBot.sendSticker(
|
|||||||
emoji: String? = null,
|
emoji: String? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(chat, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(chat, sticker.fileId, threadId, emoji, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -30,8 +27,7 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVideo(
|
SendVideo(
|
||||||
@@ -48,8 +44,7 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -67,10 +62,9 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, text, parseMode, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -89,10 +83,9 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, thumb, text, parseMode, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -108,10 +101,9 @@ suspend fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, text, parseMode, spoilered, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -129,8 +121,7 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVideo(
|
SendVideo(
|
||||||
@@ -146,8 +137,7 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -164,10 +154,9 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chatId, video.fileId, video.thumbnail ?.fileId, entities, spoilered, video.duration, video.width, video.height, threadId, disableNotification, protectContent, replyParameters, 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,10 +174,9 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, thumb, entities, spoilered, duration, width, height, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -203,7 +191,6 @@ suspend inline fun TelegramBot.sendVideo(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(chat.id, video, entities, spoilered, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(chat.id, video, entities, spoilered, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -3,13 +3,10 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -24,8 +21,7 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVideoNote(
|
SendVideoNote(
|
||||||
@@ -37,8 +33,7 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -53,11 +48,10 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,10 +67,9 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(chat.id, videoNote, thumb, duration, size, threadId, disableNotification, protectContent, replyParameters, 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,7 +81,6 @@ suspend fun TelegramBot.sendVideoNote(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(chat.id, videoNote, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(chat.id, videoNote, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ 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.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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
|
||||||
@@ -26,8 +23,7 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVoice(
|
SendVoice(
|
||||||
@@ -39,8 +35,7 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -58,10 +53,9 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, text, parseMode, duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, text, parseMode, duration, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -75,11 +69,10 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, voice.fileId, text, parseMode, voice.duration, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,10 +87,9 @@ suspend fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, text, parseMode, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,8 +104,7 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendVoice(
|
SendVoice(
|
||||||
@@ -124,8 +115,7 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
threadId,
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyParameters,
|
||||||
allowSendingWithoutReply,
|
|
||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -142,10 +132,9 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, entities, duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, entities, duration, threadId, disableNotification, protectContent, replyParameters, 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,11 +147,10 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(
|
) = sendVoice(
|
||||||
chatId, voice.fileId, entities, voice.duration, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, voice.fileId, entities, voice.duration, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -175,7 +163,6 @@ suspend inline fun TelegramBot.sendVoice(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(chat.id, voice, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(chat.id, voice, entities, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -34,11 +34,10 @@ suspend fun TelegramBot.sendInvoice(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,7 +65,6 @@ suspend fun TelegramBot.sendInvoice(
|
|||||||
priceDependOnShipAddress: Boolean = false,
|
priceDependOnShipAddress: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
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, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, replyParameters, replyMarkup)
|
||||||
|
|||||||
@@ -3,15 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.send.polls
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll
|
import dev.inmo.tgbotapi.requests.send.polls.SendQuizPoll
|
||||||
import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
|
import dev.inmo.tgbotapi.requests.send.polls.SendRegularPoll
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.*
|
||||||
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.polls.*
|
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
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -28,12 +25,11 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendRegularPoll(
|
SendRegularPoll(
|
||||||
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
/**
|
/**
|
||||||
@@ -52,10 +48,9 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, 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
|
||||||
@@ -72,11 +67,10 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(
|
) = sendRegularPoll(
|
||||||
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -95,11 +89,10 @@ suspend fun TelegramBot.sendRegularPoll(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(
|
) = sendRegularPoll(
|
||||||
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -120,12 +113,11 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendQuizPoll(
|
SendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -146,11 +138,10 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -171,11 +162,10 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -196,11 +186,10 @@ suspend fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -220,12 +209,11 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
SendQuizPoll(
|
SendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -245,11 +233,10 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -269,11 +256,10 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chatId, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -293,9 +279,8 @@ suspend inline fun TelegramBot.sendQuizPoll(
|
|||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageId? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(
|
) = sendQuizPoll(
|
||||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup
|
chat.id, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, threadId, disableNotification, protectContent, replyParameters, replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -72,76 +72,3 @@ suspend fun TelegramBot.setStickerSetThumbnail(
|
|||||||
) = setStickerSetThumbnail(
|
) = setStickerSetThumbnail(
|
||||||
user.id, stickerSet.name, thumbnail
|
user.id, stickerSet.name, thumbnail
|
||||||
)
|
)
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
userId: UserId,
|
|
||||||
thumbSetName: String,
|
|
||||||
thumb: FileId
|
|
||||||
) = execute(
|
|
||||||
SetStickerSetThumbnail(userId, thumbSetName, thumb)
|
|
||||||
)
|
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
userId: UserId,
|
|
||||||
thumbSetName: String,
|
|
||||||
thumb: MultipartFile
|
|
||||||
) = execute(
|
|
||||||
SetStickerSetThumbnail(userId, thumbSetName, thumb)
|
|
||||||
)
|
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
user: CommonUser,
|
|
||||||
thumbSetName: String,
|
|
||||||
thumb: FileId
|
|
||||||
) = setStickerSetThumb(
|
|
||||||
user.id, thumbSetName, thumb
|
|
||||||
)
|
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSetName, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
user: CommonUser,
|
|
||||||
thumbSetName: String,
|
|
||||||
thumb: MultipartFile
|
|
||||||
) = setStickerSetThumb(
|
|
||||||
user.id, thumbSetName, thumb
|
|
||||||
)
|
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
userId: UserId,
|
|
||||||
thumbSet: StickerSet,
|
|
||||||
thumb: FileId
|
|
||||||
) = setStickerSetThumb(
|
|
||||||
userId, thumbSet.name, thumb
|
|
||||||
)
|
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(userId, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
userId: UserId,
|
|
||||||
thumbSet: StickerSet,
|
|
||||||
thumb: MultipartFile
|
|
||||||
) = setStickerSetThumb(
|
|
||||||
userId, thumbSet.name, thumb
|
|
||||||
)
|
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
user: CommonUser,
|
|
||||||
thumbSet: StickerSet,
|
|
||||||
thumb: FileId
|
|
||||||
) = setStickerSetThumb(
|
|
||||||
user.id, thumbSet.name, thumb
|
|
||||||
)
|
|
||||||
|
|
||||||
@Deprecated("Renamed in telegram bot api", ReplaceWith("setStickerSetThumbnail(user, thumbSet, thumb)", "dev.inmo.tgbotapi.extensions.api.thumbs.setStickerSetThumbnail"))
|
|
||||||
suspend fun TelegramBot.setStickerSetThumb(
|
|
||||||
user: CommonUser,
|
|
||||||
thumbSet: StickerSet,
|
|
||||||
thumb: MultipartFile
|
|
||||||
) = setStickerSetThumb(
|
|
||||||
user.id, thumbSet.name, thumb
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ kotlin {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
|
api project(":tgbotapi.core")
|
||||||
|
api project(":tgbotapi.utils")
|
||||||
api project(":tgbotapi.behaviour_builder")
|
api project(":tgbotapi.behaviour_builder")
|
||||||
api libs.microutils.fsm.common
|
api libs.microutils.fsm.common
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,8 +93,9 @@ interface BehaviourContextWithFSM<T : State> : BehaviourContext, StatesMachine<T
|
|||||||
behaviourContext: BehaviourContext,
|
behaviourContext: BehaviourContext,
|
||||||
handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>,
|
handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>,
|
||||||
statesManager: StatesManager<T>,
|
statesManager: StatesManager<T>,
|
||||||
|
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()
|
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()
|
||||||
) = DefaultBehaviourContextWithFSM<T>(behaviourContext, statesManager, handlers, onStateHandlingErrorHandler)
|
) = DefaultBehaviourContextWithFSM<T>(behaviourContext, statesManager, handlers, fallbackHandler, onStateHandlingErrorHandler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -129,11 +130,12 @@ class DefaultBehaviourContextWithFSM<T : State>(
|
|||||||
private val behaviourContext: BehaviourContext,
|
private val behaviourContext: BehaviourContext,
|
||||||
private val statesManager: StatesManager<T>,
|
private val statesManager: StatesManager<T>,
|
||||||
private val handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>,
|
private val handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>,
|
||||||
|
private val fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
private val onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()
|
private val onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()
|
||||||
) : BehaviourContext by behaviourContext, BehaviourContextWithFSM<T> {
|
) : BehaviourContext by behaviourContext, BehaviourContextWithFSM<T> {
|
||||||
private val updatesFlows = mutableMapOf<Any, DefaultBehaviourContextWithFSM<T>>()
|
private val updatesFlows = mutableMapOf<Any, DefaultBehaviourContextWithFSM<T>>()
|
||||||
private val additionalHandlers = mutableListOf<BehaviourWithFSMStateHandlerHolder<*, T>>()
|
private val additionalHandlers = mutableListOf<BehaviourWithFSMStateHandlerHolder<*, T>>()
|
||||||
private var actualHandlersList = additionalHandlers + handlers
|
private var actualHandlersList = additionalHandlers + handlers + listOfNotNull(fallbackHandler)
|
||||||
|
|
||||||
protected val statesJobs = mutableMapOf<T, Job>()
|
protected val statesJobs = mutableMapOf<T, Job>()
|
||||||
protected val statesJobsMutex = Mutex()
|
protected val statesJobsMutex = Mutex()
|
||||||
@@ -250,6 +252,7 @@ class DefaultBehaviourContextWithFSM<T : State>(
|
|||||||
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, triggersHolder),
|
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, triggersHolder),
|
||||||
handlers,
|
handlers,
|
||||||
statesManager,
|
statesManager,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler
|
onStateHandlingErrorHandler
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -265,6 +268,7 @@ class DefaultBehaviourContextWithFSM<T : State>(
|
|||||||
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, triggersHolder),
|
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, triggersHolder),
|
||||||
handlers,
|
handlers,
|
||||||
statesManager,
|
statesManager,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler
|
onStateHandlingErrorHandler
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
|
|||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
||||||
|
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
||||||
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
|
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
|
||||||
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
|
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
|
||||||
@@ -41,6 +42,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
|
|||||||
),
|
),
|
||||||
presetHandlers,
|
presetHandlers,
|
||||||
statesManager,
|
statesManager,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler
|
onStateHandlingErrorHandler
|
||||||
).apply { block() }
|
).apply { block() }
|
||||||
|
|
||||||
@@ -59,6 +61,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
|||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
||||||
|
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
||||||
timeoutSeconds: Seconds = 30,
|
timeoutSeconds: Seconds = 30,
|
||||||
autoDisableWebhooks: Boolean = true,
|
autoDisableWebhooks: Boolean = true,
|
||||||
@@ -71,6 +74,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
|||||||
defaultExceptionsHandler,
|
defaultExceptionsHandler,
|
||||||
statesManager,
|
statesManager,
|
||||||
presetHandlers,
|
presetHandlers,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler,
|
onStateHandlingErrorHandler,
|
||||||
block
|
block
|
||||||
).run {
|
).run {
|
||||||
@@ -104,6 +108,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
|
|||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
||||||
|
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
||||||
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
|
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
|
||||||
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
|
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
|
||||||
@@ -114,6 +119,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
|
|||||||
),
|
),
|
||||||
presetHandlers,
|
presetHandlers,
|
||||||
statesManager,
|
statesManager,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler
|
onStateHandlingErrorHandler
|
||||||
).apply { block() }
|
).apply { block() }
|
||||||
|
|
||||||
@@ -137,6 +143,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
|||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
||||||
|
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
||||||
timeoutSeconds: Seconds = 30,
|
timeoutSeconds: Seconds = 30,
|
||||||
autoDisableWebhooks: Boolean = true,
|
autoDisableWebhooks: Boolean = true,
|
||||||
@@ -150,6 +157,7 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
|
|||||||
defaultExceptionsHandler,
|
defaultExceptionsHandler,
|
||||||
statesManager,
|
statesManager,
|
||||||
presetHandlers,
|
presetHandlers,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler,
|
onStateHandlingErrorHandler,
|
||||||
block
|
block
|
||||||
).run {
|
).run {
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ suspend fun <T : State> telegramBotWithBehaviourAndFSM(
|
|||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
||||||
|
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
||||||
timeoutSeconds: Seconds = 30,
|
timeoutSeconds: Seconds = 30,
|
||||||
@@ -65,6 +66,7 @@ suspend fun <T : State> telegramBotWithBehaviourAndFSM(
|
|||||||
defaultExceptionsHandler,
|
defaultExceptionsHandler,
|
||||||
statesManager,
|
statesManager,
|
||||||
presetHandlers,
|
presetHandlers,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler,
|
onStateHandlingErrorHandler,
|
||||||
timeoutSeconds,
|
timeoutSeconds,
|
||||||
autoDisableWebhooks,
|
autoDisableWebhooks,
|
||||||
@@ -97,6 +99,7 @@ suspend fun <T : State> telegramBotWithBehaviourAndFSMAndStartLongPolling(
|
|||||||
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
defaultExceptionsHandler: ExceptionHandler<Unit>? = null,
|
||||||
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
statesManager: StatesManager<T> = DefaultStatesManager(InMemoryDefaultStatesManagerRepo()),
|
||||||
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
|
||||||
|
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
|
||||||
timeoutSeconds: Seconds = 30,
|
timeoutSeconds: Seconds = 30,
|
||||||
@@ -116,6 +119,7 @@ suspend fun <T : State> telegramBotWithBehaviourAndFSMAndStartLongPolling(
|
|||||||
defaultExceptionsHandler,
|
defaultExceptionsHandler,
|
||||||
statesManager,
|
statesManager,
|
||||||
presetHandlers,
|
presetHandlers,
|
||||||
|
fallbackHandler,
|
||||||
onStateHandlingErrorHandler,
|
onStateHandlingErrorHandler,
|
||||||
timeoutSeconds,
|
timeoutSeconds,
|
||||||
autoDisableWebhooks,
|
autoDisableWebhooks,
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ kotlin {
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(":tgbotapi.utils")
|
api project(path: ':tgbotapi.core')
|
||||||
|
api project(path: ':tgbotapi.utils')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder
|
|||||||
import dev.inmo.micro_utils.coroutines.*
|
import dev.inmo.micro_utils.coroutines.*
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.TriggersHolder
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.TriggersHolder
|
||||||
|
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
import dev.inmo.tgbotapi.updateshandlers.*
|
import dev.inmo.tgbotapi.updateshandlers.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
@@ -71,9 +72,17 @@ class DefaultBehaviourContext(
|
|||||||
private val additionalUpdatesSharedFlow = MutableSharedFlow<Update>(0, broadcastChannelsSize, onBufferOverflow)
|
private val additionalUpdatesSharedFlow = MutableSharedFlow<Update>(0, broadcastChannelsSize, onBufferOverflow)
|
||||||
override val allUpdatesFlow: Flow<Update> = (additionalUpdatesSharedFlow.asSharedFlow()).let {
|
override val allUpdatesFlow: Flow<Update> = (additionalUpdatesSharedFlow.asSharedFlow()).let {
|
||||||
if (upstreamUpdatesFlow != null) {
|
if (upstreamUpdatesFlow != null) {
|
||||||
var lastHandledUpdate = -1L
|
val handledUpdates = mutableSetOf<UpdateIdentifier>()
|
||||||
(it + upstreamUpdatesFlow).filter {
|
(it + upstreamUpdatesFlow).filter {
|
||||||
(it.updateId > lastHandledUpdate).also { passed -> if (passed) { lastHandledUpdate = it.updateId } }
|
val passed = handledUpdates.add(it.updateId)
|
||||||
|
(passed).also { passed ->
|
||||||
|
val needToDropCount = handledUpdates.size - broadcastChannelsSize
|
||||||
|
if (needToDropCount > 0) {
|
||||||
|
handledUpdates.removeAll(
|
||||||
|
handledUpdates.take(needToDropCount).ifEmpty { return@also }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
it
|
it
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatBoostRemovedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostRemoved
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostRemoved(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<ChatBoostRemoved> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
it.chatBoostRemovedUpdateOrNull() ?.data.let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatBoostUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.boosts.ChatBoostUpdated
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostUpdated(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<ChatBoostUpdated> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
it.chatBoostUpdatedUpdateOrNull() ?.data.let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
@RiskFeature(lowLevelRiskFeatureMessage)
|
||||||
|
suspend inline fun <reified O : ChatMessageReactionUpdated> BehaviourContext.waitChatMessageReactionUpdated(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<O> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
(it.chatMessageReactionUpdatedUpdateOrNull() ?.data as? O).let(::listOfNotNull)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatMessageReactionUpdatedByUser(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitChatMessageReactionUpdated<ChatMessageReactionUpdated.ByUser>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatMessageReactionUpdatedByChat(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitChatMessageReactionUpdated<ChatMessageReactionUpdated.ByChat>(initRequest, errorFactory)
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.chatMessageReactionsCountUpdatedUpdateOrNull
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionUpdated
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatMessageReactionsCountUpdated
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
|
||||||
|
suspend inline fun BehaviourContext.waitChatMessageReactionsCountUpdated(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
): Flow<ChatMessageReactionsCountUpdated> = expectFlow(
|
||||||
|
initRequest,
|
||||||
|
errorFactory
|
||||||
|
) {
|
||||||
|
(it.chatMessageReactionsCountUpdatedUpdateOrNull() ?.data).let(::listOfNotNull)
|
||||||
|
}
|
||||||
@@ -3,6 +3,10 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
|||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.doWithRegistration
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.doWithRegistration
|
||||||
import dev.inmo.tgbotapi.extensions.utils.*
|
import dev.inmo.tgbotapi.extensions.utils.*
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.extensions.TelegramBotCommandsDefaults
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithArgs
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithArgsSources
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.extensions.parseCommandsWithNamedArgs
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.types.BotCommand
|
import dev.inmo.tgbotapi.types.BotCommand
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
@@ -79,35 +83,54 @@ fun Flow<CommonMessage<TextContent>>.requireCommandsWithoutParams() = filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map the commands with their arguments and source messages
|
* Uses [parseCommandsWithArgsSources] on incoming text sources and map them with [CommonMessage]
|
||||||
*/
|
*/
|
||||||
fun Flow<CommonMessage<TextContent>>.commandsWithParams(): Flow<Pair<CommonMessage<TextContent>, List<Pair<BotCommandTextSource, Array<TextSource>>>>> = mapNotNull {
|
fun Flow<CommonMessage<TextContent>>.commandsWithParams(): Flow<Pair<CommonMessage<TextContent>, List<Pair<BotCommandTextSource, Array<TextSource>>>>> = mapNotNull {
|
||||||
var currentCommandTextSource: BotCommandTextSource? = null
|
it to it.content.textSources.parseCommandsWithArgsSources().toList()
|
||||||
val currentArgs = mutableListOf<TextSource>()
|
|
||||||
val result = mutableListOf<Pair<BotCommandTextSource, Array<TextSource>>>()
|
|
||||||
|
|
||||||
fun addCurrentCommandToResult() {
|
|
||||||
currentCommandTextSource ?.let {
|
|
||||||
result.add(it to currentArgs.toTypedArray())
|
|
||||||
currentArgs.clear()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
it.content.textSources.forEach {
|
|
||||||
it.ifBotCommandTextSource {
|
|
||||||
addCurrentCommandToResult()
|
|
||||||
currentCommandTextSource = it
|
|
||||||
return@forEach
|
|
||||||
}
|
|
||||||
currentArgs.add(it)
|
|
||||||
}
|
|
||||||
addCurrentCommandToResult()
|
|
||||||
|
|
||||||
result.toList().takeIf { it.isNotEmpty() } ?.let { result ->
|
|
||||||
it to result
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [parseCommandsWithArgs] on incoming text sources and map them with [CommonMessage]
|
||||||
|
*/
|
||||||
|
fun Flow<CommonMessage<TextContent>>.commandsWithArgs(
|
||||||
|
argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex
|
||||||
|
): Flow<Pair<CommonMessage<TextContent>, List<Pair<String, Array<String>>>>> = mapNotNull {
|
||||||
|
val commandsWithArgs = it.content.textSources.parseCommandsWithArgs(argsSeparator).toList().ifEmpty {
|
||||||
|
return@mapNotNull null
|
||||||
|
}
|
||||||
|
|
||||||
|
it to commandsWithArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [parseCommandsWithArgs] on incoming text sources and map them with [CommonMessage]
|
||||||
|
*/
|
||||||
|
fun Flow<CommonMessage<TextContent>>.commandsWithArgs(
|
||||||
|
argsSeparator: String
|
||||||
|
): Flow<Pair<CommonMessage<TextContent>, List<Pair<String, Array<String>>>>> = commandsWithArgs(Regex(argsSeparator))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [parseCommandsWithNamedArgs] on incoming text sources and map them with [CommonMessage]
|
||||||
|
*/
|
||||||
|
fun Flow<CommonMessage<TextContent>>.commandsWithNamedArgs(
|
||||||
|
argsSeparator: Regex = TelegramBotCommandsDefaults.defaultArgsSeparatorRegex,
|
||||||
|
nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex,
|
||||||
|
): Flow<Pair<CommonMessage<TextContent>, List<Pair<String, List<Pair<String, String>>>>>> = mapNotNull {
|
||||||
|
val commandsWithArgs = it.content.textSources.parseCommandsWithNamedArgs(argsSeparator, nameArgSeparator).toList().ifEmpty {
|
||||||
|
return@mapNotNull null
|
||||||
|
}
|
||||||
|
|
||||||
|
it to commandsWithArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [parseCommandsWithNamedArgs] on incoming text sources and map them with [CommonMessage]
|
||||||
|
*/
|
||||||
|
fun Flow<CommonMessage<TextContent>>.commandsWithNamedArgs(
|
||||||
|
argsSeparator: String,
|
||||||
|
nameArgSeparator: Regex = TelegramBotCommandsDefaults.defaultNamesArgsSeparatorRegex,
|
||||||
|
): Flow<Pair<CommonMessage<TextContent>, List<Pair<String, List<Pair<String, String>>>>>> = commandsWithNamedArgs(Regex(argsSeparator), nameArgSeparator)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flat [commandsWithParams]. Each [Pair] of [BotCommandTextSource] and its [Array] of arg text sources will
|
* Flat [commandsWithParams]. Each [Pair] of [BotCommandTextSource] and its [Array] of arg text sources will
|
||||||
* be associated with its source message
|
* be associated with its source message
|
||||||
|
|||||||
@@ -10,117 +10,141 @@ import dev.inmo.tgbotapi.utils.RiskFeature
|
|||||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
|
import kotlinx.coroutines.flow.mapNotNull
|
||||||
|
|
||||||
typealias CommonMessageToContentMapper<T> = suspend CommonMessage<T>.() -> T?
|
typealias CommonMessageToContentMapper<T> = suspend CommonMessage<T>.() -> T?
|
||||||
|
|
||||||
@RiskFeature(lowLevelRiskFeatureMessage)
|
@RiskFeature(lowLevelRiskFeatureMessage)
|
||||||
suspend inline fun <reified O : MessageContent> BehaviourContext.waitContent(
|
suspend inline fun BehaviourContext.waitContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
): Flow<O> = waitContentMessage<O>(initRequest, errorFactory).map { it.content }
|
): Flow<MessageContent> = waitContentMessage(initRequest, errorFactory).map { it.content }
|
||||||
|
|
||||||
|
inline fun <reified T : MessageContent> Flow<MessageContent>.mapContent() = mapNotNull { it as? T }
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitAnyContent(
|
suspend fun BehaviourContext.waitAnyContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<MessageContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitTextedContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<TextedContent>()
|
||||||
suspend fun BehaviourContext.waitContact(
|
suspend fun BehaviourContext.waitContact(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<ContactContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<ContactContent>()
|
||||||
suspend fun BehaviourContext.waitDice(
|
suspend fun BehaviourContext.waitDice(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<DiceContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<DiceContent>()
|
||||||
suspend fun BehaviourContext.waitGame(
|
suspend fun BehaviourContext.waitGame(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<GameContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<GameContent>()
|
||||||
suspend fun BehaviourContext.waitLocation(
|
suspend fun BehaviourContext.waitLocation(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<LocationContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<LocationContent>()
|
||||||
suspend fun BehaviourContext.waitLiveLocation(
|
suspend fun BehaviourContext.waitLiveLocation(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<LiveLocationContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<LiveLocationContent>()
|
||||||
suspend fun BehaviourContext.waitStaticLocation(
|
suspend fun BehaviourContext.waitStaticLocation(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<StaticLocationContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<StaticLocationContent>()
|
||||||
suspend fun BehaviourContext.waitPoll(
|
suspend fun BehaviourContext.waitPoll(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<PollContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<PollContent>()
|
||||||
suspend fun BehaviourContext.waitText(
|
suspend fun BehaviourContext.waitText(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<TextContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<TextContent>()
|
||||||
|
suspend fun BehaviourContext.waitStory(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<StoryContent>()
|
||||||
suspend fun BehaviourContext.waitVenue(
|
suspend fun BehaviourContext.waitVenue(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<VenueContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<VenueContent>()
|
||||||
suspend fun BehaviourContext.waitAudioMediaGroupContent(
|
suspend fun BehaviourContext.waitAudioMediaGroupContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContent<AudioMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<AudioMediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitDocumentMediaGroupContent(
|
suspend fun BehaviourContext.waitDocumentMediaGroupContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<DocumentMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<DocumentMediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitMedia(
|
suspend fun BehaviourContext.waitMedia(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<MediaContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<MediaContent>()
|
||||||
suspend fun BehaviourContext.waitAnyMediaGroupContent(
|
suspend fun BehaviourContext.waitAnyMediaGroupContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContent<MediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<MediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitVisualMediaGroupContent(
|
suspend fun BehaviourContext.waitVisualMediaGroupContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<VisualMediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitTextedMediaContent(
|
suspend fun BehaviourContext.waitTextedMediaContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContent<TextedMediaContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<TextedMediaContent>()
|
||||||
suspend fun BehaviourContext.waitAnimation(
|
suspend fun BehaviourContext.waitAnimation(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<AnimationContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<AnimationContent>()
|
||||||
suspend fun BehaviourContext.waitAudio(
|
suspend fun BehaviourContext.waitAudio(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContent<AudioContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<AudioContent>()
|
||||||
suspend fun BehaviourContext.waitDocument(
|
suspend fun BehaviourContext.waitDocument(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContent<DocumentContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<DocumentContent>()
|
||||||
suspend fun BehaviourContext.waitPhoto(
|
suspend fun BehaviourContext.waitPhoto(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContent<PhotoContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<PhotoContent>()
|
||||||
suspend fun BehaviourContext.waitSticker(
|
suspend fun BehaviourContext.waitSticker(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<StickerContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<StickerContent>()
|
||||||
suspend fun BehaviourContext.waitVideo(
|
suspend fun BehaviourContext.waitVideo(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<VideoContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<VideoContent>()
|
||||||
suspend fun BehaviourContext.waitVideoNote(
|
suspend fun BehaviourContext.waitVideoNote(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<VideoNoteContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<VideoNoteContent>()
|
||||||
suspend fun BehaviourContext.waitVoice(
|
suspend fun BehaviourContext.waitVoice(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<VoiceContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<VoiceContent>()
|
||||||
suspend fun BehaviourContext.waitInvoice(
|
suspend fun BehaviourContext.waitInvoice(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<InvoiceContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<InvoiceContent>()
|
||||||
suspend fun BehaviourContext.waitVisualContent(
|
suspend fun BehaviourContext.waitVisualContent(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContent<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContent(initRequest, errorFactory).mapContent<VisualMediaGroupPartContent>()
|
||||||
|
suspend fun BehaviourContext.waitMediaContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<MediaContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitGiveawayContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<GiveawayContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitGiveawayPublicResultsContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<GiveawayPublicResultsContent>()
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
import dev.inmo.tgbotapi.extensions.utils.withContent
|
import dev.inmo.tgbotapi.extensions.utils.withContentOrNull
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
@@ -12,142 +11,151 @@ import dev.inmo.tgbotapi.types.update.abstracts.BaseSentMessageUpdate
|
|||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.mapNotNull
|
||||||
|
|
||||||
typealias CommonMessageToCommonMessageMapper<T> = suspend CommonMessage<T>.() -> CommonMessage<T>?
|
typealias CommonMessageToCommonMessageMapper<T> = suspend CommonMessage<T>.() -> CommonMessage<T>?
|
||||||
|
|
||||||
@RiskFeature(lowLevelRiskFeatureMessage)
|
@RiskFeature(lowLevelRiskFeatureMessage)
|
||||||
suspend inline fun <reified O : MessageContent> BehaviourContext.waitContentMessage(
|
suspend inline fun BehaviourContext.waitContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
noinline errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
): Flow<CommonMessage<O>> = expectFlow(
|
): Flow<CommonMessage<MessageContent>> = expectFlow(
|
||||||
initRequest,
|
initRequest,
|
||||||
errorFactory
|
errorFactory
|
||||||
) {
|
) {
|
||||||
if (it !is BaseSentMessageUpdate) {
|
if (it !is BaseSentMessageUpdate) {
|
||||||
return@expectFlow emptyList()
|
return@expectFlow emptyList()
|
||||||
}
|
}
|
||||||
listOfNotNull((it.data as? CommonMessage<*>) ?.withContent<O>())
|
listOfNotNull((it.data as? CommonMessage<*>))
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun <reified T : MessageContent> contentMessageConverter(
|
inline fun <reified T : MessageContent> Flow<CommonMessage<MessageContent>>.mapWithContent() = mapNotNull { it.withContentOrNull<T>() }
|
||||||
noinline mapper: CommonMessageToCommonMessageMapper<T>? = null
|
|
||||||
): suspend CommonMessage<MessageContent>.() -> CommonMessage<T>? = mapper ?.let {
|
|
||||||
{
|
|
||||||
if (content is T) {
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
val message = (this as CommonMessage<T>)
|
|
||||||
safelyWithoutExceptions { mapper(message) }
|
|
||||||
} else {
|
|
||||||
null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} ?: {
|
|
||||||
@Suppress("UNCHECKED_CAST")
|
|
||||||
if (content is T) this as CommonMessage<T> else null
|
|
||||||
}
|
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitAnyContentMessage(
|
suspend fun BehaviourContext.waitAnyContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null },
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
) = waitContentMessage<MessageContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitTextedContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<TextedContent>()
|
||||||
suspend fun BehaviourContext.waitContactMessage(
|
suspend fun BehaviourContext.waitContactMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<ContactContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<ContactContent>()
|
||||||
suspend fun BehaviourContext.waitDiceMessage(
|
suspend fun BehaviourContext.waitDiceMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<DiceContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<DiceContent>()
|
||||||
suspend fun BehaviourContext.waitGameMessage(
|
suspend fun BehaviourContext.waitGameMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<GameContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<GameContent>()
|
||||||
suspend fun BehaviourContext.waitLocationMessage(
|
suspend fun BehaviourContext.waitLocationMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<LocationContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<LocationContent>()
|
||||||
suspend fun BehaviourContext.waitLiveLocationMessage(
|
suspend fun BehaviourContext.waitLiveLocationMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<LiveLocationContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<LiveLocationContent>()
|
||||||
suspend fun BehaviourContext.waitStaticLocationMessage(
|
suspend fun BehaviourContext.waitStaticLocationMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<StaticLocationContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<StaticLocationContent>()
|
||||||
suspend fun BehaviourContext.waitPollMessage(
|
suspend fun BehaviourContext.waitPollMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<PollContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<PollContent>()
|
||||||
suspend fun BehaviourContext.waitTextMessage(
|
suspend fun BehaviourContext.waitTextMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<TextContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<TextContent>()
|
||||||
|
suspend fun BehaviourContext.waitStoryMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<StoryContent>()
|
||||||
suspend fun BehaviourContext.waitVenueMessage(
|
suspend fun BehaviourContext.waitVenueMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<VenueContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<VenueContent>()
|
||||||
suspend fun BehaviourContext.waitAudioMediaGroupContentMessage(
|
suspend fun BehaviourContext.waitAudioMediaGroupContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<AudioMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<AudioMediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitDocumentMediaGroupContentMessage(
|
suspend fun BehaviourContext.waitDocumentMediaGroupContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<DocumentMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<DocumentMediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitMediaMessage(
|
suspend fun BehaviourContext.waitMediaMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<MediaContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<MediaContent>()
|
||||||
suspend fun BehaviourContext.waitAnyMediaGroupContentMessage(
|
suspend fun BehaviourContext.waitAnyMediaGroupContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<MediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<MediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitVisualMediaGroupContentMessage(
|
suspend fun BehaviourContext.waitVisualMediaGroupContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<VisualMediaGroupPartContent>()
|
||||||
suspend fun BehaviourContext.waitTextedMediaContentMessage(
|
suspend fun BehaviourContext.waitTextedMediaContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<TextedMediaContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<TextedMediaContent>()
|
||||||
suspend fun BehaviourContext.waitAnimationMessage(
|
suspend fun BehaviourContext.waitAnimationMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<AnimationContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<AnimationContent>()
|
||||||
suspend fun BehaviourContext.waitAudioMessage(
|
suspend fun BehaviourContext.waitAudioMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<AudioContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<AudioContent>()
|
||||||
suspend fun BehaviourContext.waitDocumentMessage(
|
suspend fun BehaviourContext.waitDocumentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<DocumentContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<DocumentContent>()
|
||||||
suspend fun BehaviourContext.waitPhotoMessage(
|
suspend fun BehaviourContext.waitPhotoMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<PhotoContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<PhotoContent>()
|
||||||
suspend fun BehaviourContext.waitStickerMessage(
|
suspend fun BehaviourContext.waitStickerMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<StickerContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<StickerContent>()
|
||||||
suspend fun BehaviourContext.waitVideoMessage(
|
suspend fun BehaviourContext.waitVideoMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<VideoContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<VideoContent>()
|
||||||
suspend fun BehaviourContext.waitVideoNoteMessage(
|
suspend fun BehaviourContext.waitVideoNoteMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<VideoNoteContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<VideoNoteContent>()
|
||||||
suspend fun BehaviourContext.waitVoiceMessage(
|
suspend fun BehaviourContext.waitVoiceMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<VoiceContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<VoiceContent>()
|
||||||
suspend fun BehaviourContext.waitInvoiceMessage(
|
suspend fun BehaviourContext.waitInvoiceMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<InvoiceContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<InvoiceContent>()
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitVisualContentMessage(
|
suspend fun BehaviourContext.waitVisualContentMessage(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitContentMessage<VisualMediaGroupPartContent>(initRequest, errorFactory)
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<VisualMediaGroupPartContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitMediaContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<MediaContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitGiveawayContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<GiveawayContent>()
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitGiveawayPublicResultsContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<GiveawayPublicResultsContent>()
|
||||||
|
|||||||
@@ -21,3 +21,17 @@ suspend fun BehaviourContext.waitDeepLinks(
|
|||||||
.flattenCommandsWithParams().mapNotNull {
|
.flattenCommandsWithParams().mapNotNull {
|
||||||
it.first to (it.second.second.singleOrNull() ?.regularTextSourceOrNull() ?.source ?.removePrefix(" ") ?: return@mapNotNull null)
|
it.first to (it.second.second.singleOrNull() ?.regularTextSourceOrNull() ?.source ?.removePrefix(" ") ?: return@mapNotNull null)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitDeepLinks(
|
||||||
|
regex: Regex,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
): Flow<Pair<CommonMessage<TextContent>, String>> = waitDeepLinks(initRequest, errorFactory).filter {
|
||||||
|
regex.matches(it.second)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitDeepLinks(
|
||||||
|
deepLink: String,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null },
|
||||||
|
): Flow<Pair<CommonMessage<TextContent>, String>> = waitDeepLinks(Regex("^$deepLink$"), initRequest, errorFactory)
|
||||||
|
|||||||
@@ -130,3 +130,14 @@ suspend fun BehaviourContext.waitEditedInvoice(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
|
) = waitEditedContent<InvoiceContent>(initRequest, false, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedGiveawayContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContent<GiveawayContent>(initRequest, false, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContent(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContent<GiveawayPublicResultsContent>(initRequest, false, errorFactory)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
import dev.inmo.tgbotapi.extensions.utils.baseEditMessageUpdateOrNull
|
|
||||||
import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
|
import dev.inmo.tgbotapi.extensions.utils.commonMessageOrNull
|
||||||
import dev.inmo.tgbotapi.extensions.utils.withContent
|
import dev.inmo.tgbotapi.extensions.utils.withContent
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.Request
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
@@ -136,3 +135,14 @@ suspend fun BehaviourContext.waitEditedInvoiceMessage(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEditedContentMessage<InvoiceContent>(initRequest, errorFactory)
|
) = waitEditedContentMessage<InvoiceContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedGiveawayContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContentMessage<GiveawayContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitEditedGiveawayPublicResultsContentMessage(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEditedContentMessage<GiveawayPublicResultsContent>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||||
import dev.inmo.tgbotapi.types.request.UserShared
|
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.filter
|
||||||
|
|
||||||
typealias EventMessageToEventMapper<T> = suspend ChatEventMessage<T>.() -> T?
|
typealias EventMessageToEventMapper<T> = suspend ChatEventMessage<T>.() -> T?
|
||||||
|
|
||||||
@@ -174,18 +175,47 @@ suspend fun BehaviourContext.waitWriteAccessAllowed(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEvents<WriteAccessAllowed>(initRequest, errorFactory)
|
) = waitEvents<WriteAccessAllowed>(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedFromRequest(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<WriteAccessAllowed.FromRequest>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedFromAttachmentMenu(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<WriteAccessAllowed.FromAttachmentMenu>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedFromWebAppLink(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<WriteAccessAllowed.FromWebAppLink>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedOther(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<WriteAccessAllowed.Other>(initRequest, errorFactory)
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitChatSharedRequest(
|
suspend fun BehaviourContext.waitChatSharedRequest(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEvents<ChatSharedRequest>(initRequest, errorFactory)
|
) = waitEvents<ChatSharedRequest>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitUsersShared(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<UsersShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitUserShared(
|
suspend fun BehaviourContext.waitUserShared(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEvents<UserShared>(initRequest, errorFactory)
|
) = waitUsersShared(initRequest, errorFactory).filter { it.userIds.size == 1 }
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitChatShared(
|
suspend fun BehaviourContext.waitChatShared(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEvents<ChatShared>(initRequest, errorFactory)
|
) = waitEvents<ChatShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostAdded(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEvents<ChatBoostAdded>(initRequest, errorFactory)
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ import dev.inmo.tgbotapi.types.message.abstracts.ChatEventMessage
|
|||||||
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
|
||||||
import dev.inmo.tgbotapi.types.request.ChatShared
|
import dev.inmo.tgbotapi.types.request.ChatShared
|
||||||
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
import dev.inmo.tgbotapi.types.request.ChatSharedRequest
|
||||||
import dev.inmo.tgbotapi.types.request.UserShared
|
import dev.inmo.tgbotapi.types.request.UsersShared
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
import dev.inmo.tgbotapi.utils.lowLevelRiskFeatureMessage
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.filter
|
||||||
|
|
||||||
@RiskFeature(lowLevelRiskFeatureMessage)
|
@RiskFeature(lowLevelRiskFeatureMessage)
|
||||||
suspend inline fun <reified O : ChatEvent> BehaviourContext.waitEventsMessages(
|
suspend inline fun <reified O : ChatEvent> BehaviourContext.waitEventsMessages(
|
||||||
@@ -171,18 +172,44 @@ suspend fun BehaviourContext.waitWriteAccessAllowedEventsMessages(
|
|||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEventsMessages<WriteAccessAllowed>(initRequest, errorFactory)
|
) = waitEventsMessages<WriteAccessAllowed>(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedFromRequestEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<WriteAccessAllowed.FromRequest>(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedFromAttachmentMenuEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<WriteAccessAllowed.FromAttachmentMenu>(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedFromWebAppLinkEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<WriteAccessAllowed.FromWebAppLink>(initRequest, errorFactory)
|
||||||
|
suspend fun BehaviourContext.waitWriteAccessAllowedOtherEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<WriteAccessAllowed.Other>(initRequest, errorFactory)
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitChatSharedRequestEventsMessages(
|
suspend fun BehaviourContext.waitChatSharedRequestEventsMessages(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEventsMessages<ChatSharedRequest>(initRequest, errorFactory)
|
) = waitEventsMessages<ChatSharedRequest>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitUsersSharedEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<UsersShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitUserSharedEventsMessages(
|
suspend fun BehaviourContext.waitUserSharedEventsMessages(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEventsMessages<UserShared>(initRequest, errorFactory)
|
) = waitUsersSharedEventsMessages(initRequest, errorFactory).filter { it.chatEvent.userIds.size == 1 }
|
||||||
|
|
||||||
suspend fun BehaviourContext.waitChatSharedEventsMessages(
|
suspend fun BehaviourContext.waitChatSharedEventsMessages(
|
||||||
initRequest: Request<*>? = null,
|
initRequest: Request<*>? = null,
|
||||||
errorFactory: NullableRequestBuilder<*> = { null }
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
) = waitEventsMessages<ChatShared>(initRequest, errorFactory)
|
) = waitEventsMessages<ChatShared>(initRequest, errorFactory)
|
||||||
|
|
||||||
|
suspend fun BehaviourContext.waitChatBoostAddedEventsMessages(
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitEventsMessages<ChatBoostAdded>(initRequest, errorFactory)
|
||||||
|
|||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.whenMentionTextSource
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.whenTextMentionTextSource
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.Username
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.MessageContent
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.TextedContent
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.filter
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check, that [TextedContent.textSources] contains:
|
||||||
|
*
|
||||||
|
* * Any [dev.inmo.tgbotapi.types.message.textsources.MentionTextSource] with [dev.inmo.tgbotapi.types.message.textsources.MentionTextSource.username]
|
||||||
|
* equal to [username]
|
||||||
|
* * Any [dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource] with [dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource.user]
|
||||||
|
* with the same [username]
|
||||||
|
*/
|
||||||
|
fun TextedContent.isWithMention(username: Username) = textSources.any {
|
||||||
|
it.whenMentionTextSource {
|
||||||
|
it.username == username
|
||||||
|
} ?: it.whenTextMentionTextSource {
|
||||||
|
it.user.username == username
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check, that [TextedContent.textSources] contains:
|
||||||
|
*
|
||||||
|
* * Any [dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource] with [dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource.user]
|
||||||
|
* with the same [userId]
|
||||||
|
*/
|
||||||
|
fun TextedContent.isWithTextMention(userId: UserId) = textSources.any {
|
||||||
|
it.whenTextMentionTextSource {
|
||||||
|
it.user.id == userId
|
||||||
|
} ?: false
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithMention] with [user] [Username] (is presented) or [isWithTextMention] with [user] [UserId] to determine
|
||||||
|
* user mentioning in [this] [CommonMessage]
|
||||||
|
*/
|
||||||
|
fun TextedContent.isWithMention(user: User): Boolean = user.username ?.let { username -> isWithMention(username) } == true || isWithTextMention(user.id)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithMention] passing [username] as argument to take only messages with [username] mentions or text mentions
|
||||||
|
*/
|
||||||
|
fun Flow<TextedContent>.filterMentions(username: Username) = filter {
|
||||||
|
it.isWithMention(username)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithTextMention] passing [userId] as argument to take only messages with [userId] text mentions
|
||||||
|
*/
|
||||||
|
fun Flow<TextedContent>.filterTextMentions(userId: UserId) = filter {
|
||||||
|
it.isWithTextMention(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithMention] passing [user] as argument to take only messages with [user] mentions or text mentions
|
||||||
|
*/
|
||||||
|
fun Flow<TextedContent>.filterMentions(user: User) = filter {
|
||||||
|
it.isWithMention(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates cold [Flow] with the messages with [TextedContent] where [username] has been mentioned
|
||||||
|
*
|
||||||
|
* @see filterMentions
|
||||||
|
* @see filterTextMentions
|
||||||
|
*/
|
||||||
|
suspend fun BehaviourContext.waitContentWithMentions (
|
||||||
|
username: Username,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContent(initRequest, errorFactory).mapContent<TextedContent>().filterMentions(username)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates cold [Flow] with the messages with [TextedContent] where [userId] has been mentioned with text
|
||||||
|
*
|
||||||
|
* @see filterTextMentions
|
||||||
|
* @see filterMentions
|
||||||
|
* @see dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource
|
||||||
|
*/
|
||||||
|
suspend fun BehaviourContext.waitContentWithTextMentions (
|
||||||
|
userId: UserId,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitTextedContent(initRequest, errorFactory).filterTextMentions(userId)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates cold [Flow] with the messages with [TextedContent] where [user] has been mentioned as text or mentioned
|
||||||
|
* with text
|
||||||
|
*
|
||||||
|
* @see filterMentions
|
||||||
|
* @see filterTextMentions
|
||||||
|
*/
|
||||||
|
suspend fun BehaviourContext.waitContentWithMentions (
|
||||||
|
user: User,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitTextedContent(initRequest, errorFactory).filterMentions(user)
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.expectations
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContext
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.whenMentionTextSource
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.whenTextMentionTextSource
|
||||||
|
import dev.inmo.tgbotapi.requests.abstracts.Request
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.Username
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.CommonMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.TextedContent
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.filter
|
||||||
|
|
||||||
|
fun CommonMessage<TextedContent>.isWithMention(username: Username) = content.isWithMention(username)
|
||||||
|
|
||||||
|
fun CommonMessage<TextedContent>.isWithTextMention(userId: UserId) = content.isWithTextMention(userId)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithMention] with [user] [Username] (is presented) or [isWithTextMention] with [user] [UserId] to determine
|
||||||
|
* user mentioning in [this] [CommonMessage]
|
||||||
|
*/
|
||||||
|
fun CommonMessage<TextedContent>.isWithMention(user: User): Boolean = content.isWithMention(user)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithMention] passing [username] as argument to take only messages with [username] mentions or text mentions
|
||||||
|
*/
|
||||||
|
fun Flow<CommonMessage<TextedContent>>.filterMentionsMessages(username: Username) = filter {
|
||||||
|
it.isWithMention(username)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithTextMention] passing [userId] as argument to take only messages with [userId] text mentions
|
||||||
|
*/
|
||||||
|
fun Flow<CommonMessage<TextedContent>>.filterTextMentionsMessages(userId: UserId) = filter {
|
||||||
|
it.isWithTextMention(userId)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses [isWithMention] passing [user] as argument to take only messages with [user] mentions or text mentions
|
||||||
|
*/
|
||||||
|
fun Flow<CommonMessage<TextedContent>>.filterMentionsMessages(user: User) = filter {
|
||||||
|
it.isWithMention(user)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates cold [Flow] with the messages with [TextedContent] where [username] has been mentioned
|
||||||
|
*
|
||||||
|
* @see filterMentions
|
||||||
|
* @see filterTextMentions
|
||||||
|
*/
|
||||||
|
suspend fun BehaviourContext.waitContentMessageWithMentions (
|
||||||
|
username: Username,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitContentMessage(initRequest, errorFactory).mapWithContent<TextedContent>().filterMentionsMessages(username)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates cold [Flow] with the messages with [TextedContent] where [userId] has been mentioned with text
|
||||||
|
*
|
||||||
|
* @see filterTextMentions
|
||||||
|
* @see filterMentions
|
||||||
|
* @see dev.inmo.tgbotapi.types.message.textsources.TextMentionTextSource
|
||||||
|
*/
|
||||||
|
suspend fun BehaviourContext.waitContentMessageWithTextMentions (
|
||||||
|
userId: UserId,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitTextedContentMessage(initRequest, errorFactory).filterTextMentionsMessages(userId)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates cold [Flow] with the messages with [TextedContent] where [user] has been mentioned as text or mentioned
|
||||||
|
* with text
|
||||||
|
*
|
||||||
|
* @see filterMentions
|
||||||
|
* @see filterTextMentions
|
||||||
|
*/
|
||||||
|
suspend fun BehaviourContext.waitContentMessageWithMentions (
|
||||||
|
user: User,
|
||||||
|
initRequest: Request<*>? = null,
|
||||||
|
errorFactory: NullableRequestBuilder<*> = { null }
|
||||||
|
) = waitTextedContentMessage(initRequest, errorFactory).filterMentionsMessages(user)
|
||||||
@@ -2,25 +2,28 @@ package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
|
||||||
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat
|
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceChat
|
||||||
|
import dev.inmo.tgbotapi.extensions.utils.extensions.sourceUser
|
||||||
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||||
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
||||||
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
|
import dev.inmo.tgbotapi.types.chat.member.ChatMemberUpdated
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
||||||
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
||||||
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow only events from the same chat as base [Message]
|
* Allow only events from the same chat as base [AccessibleMessage]
|
||||||
*/
|
*/
|
||||||
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, Message, Update> = { message, update ->
|
val MessageFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, AccessibleMessage, Update> = { message, update ->
|
||||||
update.sourceChat() ?.id == message.chat.id
|
update.sourceChat() ?.let {
|
||||||
|
it.id == message.chat.id
|
||||||
|
} != false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allow only events from the same chat as base [List] of [Message]
|
* Allow only events from the same chat as base [List] of [AccessibleMessage]
|
||||||
*/
|
*/
|
||||||
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<Message>, Update> = { messages, update ->
|
val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<AccessibleMessage>, Update> = { messages, update ->
|
||||||
val sourceChatId = update.sourceChat() ?.id
|
val sourceChatId = update.sourceChat() ?.id
|
||||||
sourceChatId != null && messages.all { sourceChatId == it.chat.id }
|
sourceChatId != null && messages.all { sourceChatId == it.chat.id }
|
||||||
}
|
}
|
||||||
@@ -29,31 +32,41 @@ val MessagesFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, List<Mess
|
|||||||
* Allow only updates from the same user as base [CallbackQuery.user]
|
* Allow only updates from the same user as base [CallbackQuery.user]
|
||||||
*/
|
*/
|
||||||
val CallbackQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, CallbackQuery, Update> = { query, update ->
|
val CallbackQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, CallbackQuery, Update> = { query, update ->
|
||||||
update.sourceChat() ?.id == query.user.id
|
update.sourceUser() ?.let {
|
||||||
|
it.id == query.user.id
|
||||||
|
} != false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allow only updates from the same user as base [ShippingQuery.user]
|
* Allow only updates from the same user as base [ShippingQuery.user]
|
||||||
*/
|
*/
|
||||||
val ShippingQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, ShippingQuery, Update> = { query, update ->
|
val ShippingQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, ShippingQuery, Update> = { query, update ->
|
||||||
update.sourceChat() ?.id == query.user.id
|
update.sourceUser() ?.let {
|
||||||
|
it.id == query.user.id
|
||||||
|
} != false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allow only updates from the same user as base [ShippingQuery.user]
|
* Allow only updates from the same user as base [ShippingQuery.user]
|
||||||
*/
|
*/
|
||||||
val PreCheckoutQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, PreCheckoutQuery, Update> = { query, update ->
|
val PreCheckoutQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, PreCheckoutQuery, Update> = { query, update ->
|
||||||
update.sourceChat() ?.id == query.user.id
|
update.sourceUser() ?.let {
|
||||||
|
it.id == query.user.id
|
||||||
|
} != false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allow only updates from the same user as base [InlineQuery.from]
|
* Allow only updates from the same user as base [InlineQuery.from]
|
||||||
*/
|
*/
|
||||||
val InlineQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, InlineQuery, Update> = { query, update ->
|
val InlineQueryFilterByUser: BehaviourContextAndTwoTypesReceiver<Boolean, InlineQuery, Update> = { query, update ->
|
||||||
update.sourceChat() ?.id == query.from.id
|
update.sourceUser() ?.let {
|
||||||
|
it.id == query.user.id
|
||||||
|
} != false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allow only events from the same chat as base [ChatMemberUpdated]
|
* Allow only events from the same chat as base [ChatMemberUpdated]
|
||||||
*/
|
*/
|
||||||
val ChatMemberUpdatedFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, ChatMemberUpdated, Update> = { updated, update ->
|
val ChatMemberUpdatedFilterByChat: BehaviourContextAndTwoTypesReceiver<Boolean, ChatMemberUpdated, Update> = { updated, update ->
|
||||||
update.sourceChat() ?.id == updated.chat.id
|
update.sourceChat() ?.let {
|
||||||
|
it.id == updated.chat.id
|
||||||
|
} != false
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Allow only events from the same chat as base [ChatMemberUpdated]
|
* Allow only events from the same chat as base [ChatMemberUpdated]
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
|
package dev.inmo.tgbotapi.extensions.behaviour_builder.filters
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextAndTwoTypesReceiver
|
|
||||||
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.SimpleFilter
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.*
|
import dev.inmo.tgbotapi.types.message.abstracts.*
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupMessage
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupMessage
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow only messages which are not [MediaGroupMessage]
|
* Allow only messages which are not [MediaGroupMessage]
|
||||||
*/
|
*/
|
||||||
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<Message> {
|
val CommonMessageFilterExcludeMediaGroups = SimpleFilter<AccessibleMessage> {
|
||||||
it !is CommonMessage<*> || it.content !is MediaGroupContent<*>
|
it !is CommonMessage<*> || it.content !is MediaGroupContent<*>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,6 @@ import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
|||||||
/**
|
/**
|
||||||
* Allow only messages which are not in some forum
|
* Allow only messages which are not in some forum
|
||||||
*/
|
*/
|
||||||
val MessageFilterForums = SimpleFilter<Message> {
|
val MessageFilterForums = SimpleFilter<AccessibleMessage> {
|
||||||
it.threadIdOrNull == null
|
it.threadIdOrNull == null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ suspend fun <BC : BehaviourContext> BC.onUnhandledInlineMessageIdDataCallbackQue
|
|||||||
markerFactory: MarkerFactory<in InlineMessageIdDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
markerFactory: MarkerFactory<in InlineMessageIdDataCallbackQuery, Any> = ByUserCallbackQueryMarkerFactory,
|
||||||
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InlineMessageIdDataCallbackQuery>
|
scenarioReceiver: CustomBehaviourContextAndTypeReceiver<BC, Unit, InlineMessageIdDataCallbackQuery>
|
||||||
) = onCallbackQuery (
|
) = onCallbackQuery (
|
||||||
initialFilter * !SimpleFilter<MessageDataCallbackQuery> { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) },
|
initialFilter * !SimpleFilter<InlineMessageIdDataCallbackQuery> { triggersHolder.handleableCallbackQueriesDataHolder.isHandled(it) },
|
||||||
subcontextUpdatesFilter,
|
subcontextUpdatesFilter,
|
||||||
markerFactory,
|
markerFactory,
|
||||||
scenarioReceiver
|
scenarioReceiver
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user