mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 20:10:18 +00:00
Compare commits
530 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4c08fb7d26 | |||
| d83ff12560 | |||
| 818ef8481d | |||
| f8cd446133 | |||
| 804b991921 | |||
| 817068aa71 | |||
|
|
0cca343612 | ||
| 6532bf255b | |||
| 421d5ae9e3 | |||
| 54f1181a14 | |||
| f616a02f7c | |||
| f1deb93147 | |||
| 2300b44aae | |||
| fe88cf037a | |||
| 89920abe35 | |||
| 4c4aa491cb | |||
| f0a4425be9 | |||
| 6c8af4cab3 | |||
| 017d57e5e5 | |||
| 5a456bcdbf | |||
| 4182d8f3fe | |||
| c6e2cba09b | |||
| 8dd3eefd15 | |||
| b72d4da8f0 | |||
| ebd023669d | |||
| f7be4e557e | |||
| ec434c6af4 | |||
| 0398590de6 | |||
| 9ef1b54ada | |||
| c30ce5c803 | |||
| c0a50bccb0 | |||
| e0cd7dc512 | |||
| 6ff621b428 | |||
| 964a61749c | |||
| 17930091ac | |||
| 2271beadfb | |||
| 44c48a8462 | |||
| 4d35f89ad1 | |||
| 174706b189 | |||
| fe17312bb5 | |||
| d8b5789cd2 | |||
| f27d0916db | |||
| fa0a2818a0 | |||
| 2d3fe45389 | |||
| 02b5d282d3 | |||
| 7795bc2b50 | |||
| a95365a691 | |||
| 07082bf896 | |||
| 6a3fc47f62 | |||
| 1c94e86b40 | |||
| 0416b200b8 | |||
| 48c4e90912 | |||
| 5fc88e89b9 | |||
| dad42cf939 | |||
| 041c3ecc1b | |||
| 103dd949ce | |||
| e3acdf1802 | |||
| f81d28dd5f | |||
| 8e02a702f1 | |||
| cb7a343208 | |||
| 3be8ddae74 | |||
| 9cd1862300 | |||
| 81fdf50217 | |||
| 554d47e301 | |||
| b66ae7ad77 | |||
| 4ddced8e26 | |||
| d003047a6c | |||
| 1e4a78c812 | |||
| 2a3ffd707e | |||
| aca076381b | |||
| 12ac227d2d | |||
| e235280253 | |||
| 0da0c4e894 | |||
| 47f1509ecc | |||
| ae8ef0dd3c | |||
| 687f9e95fa | |||
| 6dbe5f024f | |||
| a39a276299 | |||
| 9f57e5685f | |||
| bdcba202c9 | |||
| 3c48dcb2a6 | |||
| b59d94d0a9 | |||
| db74b55c41 | |||
| 37b5af235a | |||
| e2b05ce575 | |||
| 49851ee3d7 | |||
|
|
cd596cc66d | ||
|
|
5667ae8095 | ||
| f29996aac8 | |||
| 32613bacc6 | |||
| cf9dba0ecc | |||
| a8c4879769 | |||
| f083e94c05 | |||
| c332413e5a | |||
| c9f3d99cd7 | |||
| cf3d07a20d | |||
| e40548e558 | |||
| 4cd8e823c6 | |||
| 9c7faec124 | |||
| 2856880a6e | |||
|
|
5445fdbfa5 | ||
| ba53d0c75d | |||
| 78f6cc5a97 | |||
| 6ab7c6f9d9 | |||
| cb6b33727e | |||
| bc4a2235c5 | |||
| 300f94fd48 | |||
| 40617ad9c8 | |||
| bea056bba3 | |||
| 9a33451f88 | |||
| c4659b558f | |||
| 5a30a07554 | |||
| b064becb8a | |||
| 463d5252bd | |||
| 8b5da90e28 | |||
| febd6ce63c | |||
| 8df8b87d54 | |||
| c882717bcc | |||
| 4aa5924615 | |||
| 2b8e728559 | |||
| 90ad34f114 | |||
| dbe2607994 | |||
| 692b668f92 | |||
| f2322e3e57 | |||
| ae002ead43 | |||
| 4197e13c54 | |||
| e09ea9a9b4 | |||
| 2a32654d57 | |||
| 0fff553ce1 | |||
| 33a1701f5b | |||
| f9a9f958ba | |||
| f686be0271 | |||
| 91307f3ebf | |||
| 8e64205f53 | |||
| 5434df1f02 | |||
| e56199ac9f | |||
| 3e199c6944 | |||
| b43d9aefb9 | |||
| fe133bbde0 | |||
| 332fe95adf | |||
| 1f416d4a28 | |||
| e626d8b5cc | |||
| b906d605f4 | |||
| d3584e793c | |||
| f71ac51461 | |||
| 5fe8cf948a | |||
| 85ea101641 | |||
| dc3ecec5c7 | |||
| ebd5e1a37b | |||
| 3da2e4fffb | |||
| 9aea59b44b | |||
| 7bab96a9cd | |||
| a0c10d9a9a | |||
| e2901cb9f9 | |||
| 3c60d074ba | |||
| f10cfdc5f1 | |||
| 270f9a60c1 | |||
| 2b49a75a42 | |||
| 9f7a348000 | |||
| 8cec74aa6a | |||
| d1914c8045 | |||
| baeb4848cf | |||
| dbadcb3f5a | |||
| 13dd73dd63 | |||
| ceba86abcb | |||
| f6a0b1a19d | |||
| 4ed6e5c7b2 | |||
| 7f43dc0815 | |||
| c72993017f | |||
| e8991f8f89 | |||
| 03cd4276a9 | |||
| 4427d76cd1 | |||
| 00f504a095 | |||
| d167f10724 | |||
| a1ccbbdd51 | |||
| 925c4dae6c | |||
| 1ec4507891 | |||
| 236e47478f | |||
| f2f15d7173 | |||
| 1b8ee5c4d7 | |||
| 304b281d80 | |||
| 733ad34289 | |||
| 39335b1dab | |||
| 46fdbc02e8 | |||
| fbe8c9419d | |||
| aba5810319 | |||
| 7d7658c64f | |||
| c4fdc350ce | |||
| f700fab33f | |||
| f078041dec | |||
| dd6b688ae4 | |||
| 0d37147a36 | |||
| ee0c017a79 | |||
| b5d5eeb62d | |||
| d715bc0a9e | |||
| 113621f619 | |||
| 6a899f1217 | |||
| 6bc96162a8 | |||
| 4736610aa8 | |||
| f6f07a5e8a | |||
| b32ce88a97 | |||
| 47f514a635 | |||
| a80ed2ec57 | |||
| b1bba43f29 | |||
| 9df258805d | |||
| 8654437293 | |||
| bdbca92fe5 | |||
| aca4d90608 | |||
| ad75aef64f | |||
| 5bf30bc6c6 | |||
| acd3298d4d | |||
| 3f6f04d00f | |||
| c7f372c1e3 | |||
| 1ed620df85 | |||
| 541e00fa03 | |||
| 867a46d397 | |||
| 8f4eb74e39 | |||
| 16cc49e412 | |||
| f58614e5be | |||
|
|
c3a09b53fc | ||
| c8413e1d18 | |||
| 8b15296ee7 | |||
| 0fcc717269 | |||
| 2ce26b4f1e | |||
| b5d499b623 | |||
| 102515dc8a | |||
| 777a58ce9a | |||
| 7471da4ff0 | |||
| e753db0e71 | |||
| 70984424e3 | |||
| c8354a330e | |||
| 037ad8b87c | |||
|
|
89550107d6 | ||
|
|
86cc7cfb3d | ||
|
|
858586e608 | ||
| d9846f27c9 | |||
| c10da2a10a | |||
| 8ed216619d | |||
| 62a9c687d5 | |||
| c2918c308f | |||
|
|
81fbff0bf5 | ||
| 54fb58de81 | |||
| 94ed4fed10 | |||
| 63ceec70ca | |||
| 636382fc8f | |||
| ac7bf60182 | |||
| bd91d4a0c0 | |||
|
|
7488eb9d4b | ||
| 6fcd248aff | |||
| 5fa1804003 | |||
|
|
0c9919e9e7 | ||
|
|
9405aa4467 | ||
| 4f75bc792d | |||
| fda53cf171 | |||
| b588622c3d | |||
| 8b64a0c94e | |||
| 959f0dffba | |||
| 8fc9185884 | |||
| 3a9cf03958 | |||
| 7cd97ac779 | |||
| c460b4eacc | |||
| 0aa58bd9f6 | |||
| a4a82f69c6 | |||
| d450ed9126 | |||
| 69c5f1ae7d | |||
| e4e8eadfb5 | |||
| c1374c118d | |||
| 6004b159ec | |||
| 67f95682d5 | |||
| 5aa5460a43 | |||
| e937845fc7 | |||
| 96f40e55bc | |||
| d3d8603c35 | |||
| 759650892c | |||
| b58550a9ec | |||
| e15817e7c5 | |||
| 4cd1316e27 | |||
| 3575a62f34 | |||
| 82f7d5bd4f | |||
| 7a5e6a69a1 | |||
| fd25db5633 | |||
| f539a24740 | |||
| 1d7b4ea862 | |||
| 2d6f296c20 | |||
| 0ba1aa1127 | |||
| ae8a461e9d | |||
| 99f16e33a6 | |||
| e029b29f7f | |||
| c04f795fdd | |||
| b873898100 | |||
| 61ac9df5e3 | |||
| b1931900e7 | |||
| fab3af48d6 | |||
| 8d7563b6e4 | |||
| 05112afe0c | |||
| 9ea06de27c | |||
| fff05a40d9 | |||
| 5c6428f220 | |||
| 766b7ca205 | |||
| 41e6c52369 | |||
| 06013f624f | |||
| d8bba89f3f | |||
| 141281f96d | |||
| be7aaa7845 | |||
| 78c224ffa8 | |||
| a08d07f7b3 | |||
| 69dde19543 | |||
| e8a3b93831 | |||
| e10caa3171 | |||
| d4fe4e09fc | |||
| ad453afba2 | |||
| a0daca28b1 | |||
| cd62a9ef3c | |||
| 3c084d70e5 | |||
| 2611d4ecc1 | |||
| b4d853dfa0 | |||
| 5044075adf | |||
| 5f2660b804 | |||
| c72dccc0f9 | |||
| 3fc1058491 | |||
| c3668e978b | |||
| 5a4a6d5710 | |||
| ed1d8beb2e | |||
| 881ede7d2a | |||
| 60d3d279e7 | |||
| 4b84518dbb | |||
| 8b451791dd | |||
| 771fb5c288 | |||
| d19ee74f8b | |||
| aaf489c2ed | |||
| 1b06b63703 | |||
| bf7fc25285 | |||
| 4df242747f | |||
| e831ca143e | |||
| 44838a2088 | |||
| 3823b03453 | |||
| ec48708195 | |||
| 6a06775bc4 | |||
| bbdff0b31a | |||
| cb4880bd00 | |||
| a18eda3db6 | |||
| d8f6429385 | |||
| be74249b67 | |||
| 69f658e4a8 | |||
| 8c51ca9d72 | |||
| 48c4a3156b | |||
| 92407c9010 | |||
| 86937cc096 | |||
| ea614b790b | |||
| c994332cb9 | |||
| 9d893ffa48 | |||
| 57d2fe85c5 | |||
| c68b148d5e | |||
| 0a0a7cea0e | |||
| ea981605f6 | |||
| fe1e65a83c | |||
| c85983bd59 | |||
| d72e1029d3 | |||
| 4b89563cff | |||
| 542079f4bf | |||
|
|
5c7164e864 | ||
| 6329905f62 | |||
| c54945e4cc | |||
| 8f20e1d617 | |||
|
|
edbfedb74e | ||
|
|
b5006cd1e0 | ||
| ca01ce7843 | |||
| 54fad3f338 | |||
| 15ef481fd7 | |||
| 91e1202674 | |||
| bdd39963a8 | |||
| 01dfedf540 | |||
| 8ded892b72 | |||
| d0b606469b | |||
| 678f79da04 | |||
| fde2c79f4c | |||
| acaf46e015 | |||
| 3f9237b5de | |||
| 3d7334dd62 | |||
| 26306f1567 | |||
| 247553d990 | |||
| 049a8a3263 | |||
| cc67a31e97 | |||
| 8791573145 | |||
| 5752f7a4fb | |||
| ade236eaa3 | |||
| e7340a483a | |||
| c7dc69d09f | |||
| c2487c5adc | |||
| 7c4808f163 | |||
| b91b516659 | |||
| 57cdc4ff2a | |||
| 864992aff0 | |||
| e18e8ba6df | |||
| 02cedc6626 | |||
| 619b890956 | |||
| 100a76a832 | |||
| c583ae6761 | |||
| 7429ffb514 | |||
| 95aeedfb94 | |||
| 095e318a78 | |||
| 4aa2d2ae41 | |||
| e936d25c13 | |||
| 97a2a5d9fd | |||
| 00ab532eac | |||
| c2cc6ee1ec | |||
| d20b94e52c | |||
| 9f3cc6eafb | |||
| f86a095421 | |||
| b0c6b80d8b | |||
| 1df653f428 | |||
| 8dfaca7648 | |||
| 04db76831f | |||
| f2e9bf6bd8 | |||
| cde8fdeffd | |||
| e74f339ae2 | |||
| ff7702486f | |||
| c7818fe4df | |||
| 8243acd69e | |||
| 8081602a39 | |||
| 6fd85dbc56 | |||
| 8d6f4ba136 | |||
| b95b339ad1 | |||
| 637979100b | |||
| 4067439a13 | |||
| 03583ff6c1 | |||
| c1330f8e32 | |||
| db36c6aacb | |||
| 757e317e70 | |||
| cb708a1ba4 | |||
| 551276f78e | |||
| 88339a4977 | |||
| a13371e14c | |||
| ad7fdc6211 | |||
| c870a48a22 | |||
| 3149fd0231 | |||
| 7430490499 | |||
| 416187e079 | |||
| e7aec75aca | |||
| 95a466a08b | |||
| 507cb2af26 | |||
| 126a07cdc7 | |||
| 27a24a18a6 | |||
| 562e8c7429 | |||
| be027efc43 | |||
| e55195b308 | |||
| 14afb59b5f | |||
| 6b23347d56 | |||
| f54843fb60 | |||
| 8a3538d9c7 | |||
| e3db4250bb | |||
| 4643ac906a | |||
| 497974e45c | |||
| 78a00f0efb | |||
| 14ecb9d948 | |||
| c759b9a466 | |||
| 58c1f2ee6a | |||
| 9d16ca3b7e | |||
| 9d40e598f1 | |||
| f1be8bf16e | |||
| 56a8804e99 | |||
| 1e73aac750 | |||
| 82c6eda0b7 | |||
| e9ff93cde1 | |||
| 9b179ea1c9 | |||
| 72d20d2344 | |||
| bcd288fe05 | |||
| 75477060e9 | |||
| 60df609486 | |||
| 556b492b35 | |||
| 53e8c53fb1 | |||
| 69d36c5c1b | |||
| ad97008f12 | |||
| 3e58114eeb | |||
| d55d8fa000 | |||
| bd32dbb3ab | |||
| 8e0389f032 | |||
| cb37b85234 | |||
| df01976ea8 | |||
| 7be74e468b | |||
| 437176203a | |||
| ae639d38e0 | |||
| a2206b99a2 | |||
| 721c3f2430 | |||
| fc92df8fbe | |||
| 901c1e8956 | |||
| 2ae105cb15 | |||
|
|
db14eee3b6 | ||
| 6f8b881668 | |||
| d113d4f0f5 | |||
| dd893b14d3 | |||
| 19ddff2999 | |||
| 7f08fd9d66 | |||
| d3cb44490b | |||
| 4d3cad16a4 | |||
| d0709a509f | |||
| 0273d07777 | |||
| bafb0c2459 | |||
| 9be2b899cb | |||
| 9f451f25f7 | |||
| 506c2b4a09 | |||
| 6cbe313e42 | |||
| 900ef28404 | |||
| a930423955 | |||
| 323c4de858 | |||
| cdd5649c04 | |||
| 2275a61d73 | |||
| bf8f4c75f8 | |||
| b5334c2b72 | |||
| 8331d4edd7 | |||
| 0e6a708eea | |||
| fbc5e9f8c4 | |||
| 040a996df6 | |||
| cf27600fb5 | |||
| 1d42f86623 | |||
| a9cb07fa0d | |||
| dd7567f43c | |||
| d0006bb089 | |||
| 7d8b990ec4 | |||
| 4d20e2cd1c | |||
| 4ffe6f915f | |||
| 22a7697447 | |||
| ef9941134e | |||
| ba85b8657d | |||
| 2dcbc0df32 | |||
| 7bac4a3a32 | |||
| 63bcc4bcf8 | |||
| 643f8e577e | |||
| 721b82f912 | |||
| 892aef738d |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,3 +1,3 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
custom: ['https://www.tinkoff.ru/rm/ovsyannikov.aleksey113/ObMJ712472']
|
custom: ['https://www.tinkoff.ru/rm/ovsyannikov.aleksey113/ObMJ712472', 'https://boosty.to/insanusmokrassar']
|
||||||
|
|||||||
4
.github/workflows/kdocs.yml
vendored
4
.github/workflows/kdocs.yml
vendored
@@ -12,10 +12,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
java-version: 11
|
java-version: 11
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew dokkaHtml
|
run: ./gradlew dokkaHtmlMultiModule
|
||||||
- name: Publish KDocs
|
- name: Publish KDocs
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./docs/build/dokka/html
|
publish_dir: ./build/dokka/htmlMultiModule
|
||||||
publish_branch: kdocs
|
publish_branch: kdocs
|
||||||
|
|||||||
7
.github/workflows/packages_publishing.yml
vendored
7
.github/workflows/packages_publishing.yml
vendored
@@ -16,7 +16,12 @@ jobs:
|
|||||||
mv gradle.properties.tmp gradle.properties
|
mv gradle.properties.tmp gradle.properties
|
||||||
- name: Build
|
- name: Build
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
- name: Publish
|
- name: Publish to Gitea
|
||||||
|
continue-on-error: true
|
||||||
|
run: ./gradlew publishAllPublicationsToGiteaRepository
|
||||||
|
env:
|
||||||
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
- name: Publish to GithubPackages
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
||||||
env:
|
env:
|
||||||
|
|||||||
533
CHANGELOG.md
533
CHANGELOG.md
@@ -1,5 +1,538 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 6.1.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.17.2` -> `0.17.3`
|
||||||
|
* `API`:
|
||||||
|
* Fix of [#732](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/732)
|
||||||
|
|
||||||
|
## 6.0.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.17.1` -> `0.17.2`
|
||||||
|
* `Core`:
|
||||||
|
* `User` in `CallbackQuery` now is `CommonUser` as well as in `from`
|
||||||
|
* `User` in `InlineQuery` now is `CommonUser` as well as in `from`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Fixes in `DeepLink` triggers and waiters
|
||||||
|
|
||||||
|
## 6.0.2
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Long polling now uses media groups debounce as in webhooks
|
||||||
|
|
||||||
|
## 6.0.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Ktor`: `2.2.3` -> `2.2.4`
|
||||||
|
* `MicroUtils`: `0.17.0` -> `0.17.1`
|
||||||
|
|
||||||
|
## 6.0.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.7.22` -> `1.8.10`
|
||||||
|
* `MicroUtils`: `0.16.10` -> `0.17.0`
|
||||||
|
* `Serialization`: `1.4.1` -> `1.5.0`
|
||||||
|
* `uuid`: `0.6.0` -> `0.7.0`
|
||||||
|
* `Core`:
|
||||||
|
* `*.link` extensions have been deprecated with renaming to avoid collisions with `link` methods
|
||||||
|
* `API`:
|
||||||
|
* Add `TelegramBot.resend` methods
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Add triggers and waiters for `VisualMediaGroupPartContent`
|
||||||
|
* `Utils`:
|
||||||
|
* `*.link` extensions have been deprecated with renaming to avoid collisions with `link` methods
|
||||||
|
|
||||||
|
## 5.2.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* All the `CallbackQuery`es now will receive `CommonUser` instead of `User` due inability of bots to trigger any
|
||||||
|
inline interaction with others bots
|
||||||
|
* `API`:
|
||||||
|
* Now `sentMessageFlow` will take each sent message in `handleLiveLocation`
|
||||||
|
|
||||||
|
## 5.2.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.16.8` -> `0.16.10`
|
||||||
|
|
||||||
|
## 5.1.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Add opportunity to get user link with `makeUserLink`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Fixes in content waiting expectators
|
||||||
|
|
||||||
|
## 5.1.0
|
||||||
|
|
||||||
|
[Bot API 6.5](https://core.telegram.org/bots/api-changelog#february-3-2023) support
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* `ChatPermissions` now is interface and have two main realizations: `ChatPermissions.Granular` and
|
||||||
|
`ChatPermissions.Common`
|
||||||
|
* `RestrictedChatMember` now implements `ChatPermissions` too
|
||||||
|
* `API`:
|
||||||
|
* Now it is possible to pass all long polling parameters in all places used it
|
||||||
|
* `Issues`:
|
||||||
|
* Fix of [#697](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/697)
|
||||||
|
|
||||||
|
## 5.0.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.16.6` -> `0.16.8`
|
||||||
|
* `Ktor`: `2.2.2` -> `2.2.3`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Fixes in `BehaviourContext.onEditedContentMessage` - now it will trigger callback on channel post edits too
|
||||||
|
|
||||||
|
## 5.0.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.16.4` -> `0.16.6`
|
||||||
|
* `Ktor`: `2.2.1` -> `2.2.2`
|
||||||
|
* `Core`:
|
||||||
|
* Fixes in `SendMediaGroup` request
|
||||||
|
* Fixes in `SetChatAdministratorCustomTitle` request (thanks to [@madhead](https://github.com/madhead))
|
||||||
|
|
||||||
|
## 5.0.0
|
||||||
|
|
||||||
|
[Bot API 6.4](https://core.telegram.org/bots/api-changelog#december-30-2022) support!
|
||||||
|
|
||||||
|
* Long-polling improvements
|
||||||
|
|
||||||
|
## 4.2.4
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Fixes in webhook parts adapter
|
||||||
|
* `BehaviourBuilderWithFSM`:
|
||||||
|
* Fixes in `DefaultBehaviourContextWithFSM`
|
||||||
|
|
||||||
|
## 4.2.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.16.2` -> `0.16.4`
|
||||||
|
* `Core`:
|
||||||
|
* Simplify default `RequestsLimiter` (`ExceptionsOnlyLimiter`) (thanks to [@y9san9](https://github.com/y9san9) for help)
|
||||||
|
|
||||||
|
## 4.2.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.16.0` -> `0.16.2`
|
||||||
|
* `Core`:
|
||||||
|
* Fix of [#694](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/694): add opportunity to create `ChatId` and `ChatIdWithThreadId` from `IdChatIdentifier`
|
||||||
|
|
||||||
|
## 4.2.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.15.0` -> `0.16.0`
|
||||||
|
* `Ktor`: `2.1.3` -> `2.2.1`
|
||||||
|
* `Utils`:
|
||||||
|
* Improve support of `makeLinkToMessage` extensions
|
||||||
|
|
||||||
|
## 4.2.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.7.21` -> `1.7.22`
|
||||||
|
* `MicroUtils`: `0.14.4` -> `0.15.0`
|
||||||
|
|
||||||
|
## 4.1.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.14.2` -> `0.14.4`
|
||||||
|
* `Core`:
|
||||||
|
* `ContentMessage`, `CommonMessage`, `PossiblyMediaGroupMessage` and `PossiblySentViaBotCommonMessage` got `out`
|
||||||
|
variance
|
||||||
|
* `UserId` now is `ChatId` instead of `IdChatIdentififer`
|
||||||
|
|
||||||
|
## 4.1.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.14.1` -> `0.14.2`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Fixes in `CallbackQuery` waiters
|
||||||
|
|
||||||
|
## 4.1.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Add opportunity to create `IdChatIdentifier` with optional `threadId`
|
||||||
|
* New serializer `FullChatIdentifierSerializer` with serialization of `ChatIdWithThreadId`
|
||||||
|
|
||||||
|
## 4.1.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.7.20` -> `1.7.21`
|
||||||
|
* `MicroUtils`: `0.14.0` -> `0.14.1`
|
||||||
|
* `Korlibs`: `3.3.1` -> `3.4.0`
|
||||||
|
* `UUID`: `0.5.0` -> `0.6.0`
|
||||||
|
* `Core`:
|
||||||
|
* All the chats identifiers has been rewritten as value classes
|
||||||
|
* New chat identifier: `ChatIdWithThreadId`
|
||||||
|
* `RawMessage` will create `ChatIdWithThreadId` chat id under the hood by default
|
||||||
|
* All the methods which potentially using `threadId` will try to take it from `chatId`
|
||||||
|
* `API`:
|
||||||
|
* All default `threadId` null values has been replaced with auto-calculated threadId from chats/chat ids
|
||||||
|
|
||||||
|
## 4.0.0
|
||||||
|
|
||||||
|
**!!! THIS UPDATE CONTAINS FULL REWORK OF MEDIA GROUPS FUNCTIONALITY !!!**
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* All the media groups have been rewritten. Since this update, there are no separated messages types for media groups,
|
||||||
|
but new type of content (`MediaGroupContent`) has been introduced
|
||||||
|
* [Bot API 6.3](https://core.telegram.org/bots/api-changelog#november-5-2022) support
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.13.2` -> `0.14.0`
|
||||||
|
* `Core`:
|
||||||
|
* New requests
|
||||||
|
|
||||||
|
## 3.3.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Ktor`: `2.1.2` -> `2.1.3`
|
||||||
|
* `Klock`: `3.2.0` -> `3.3.1`
|
||||||
|
* `MicroUtils`: `0.13.1` -> `0.13.2`
|
||||||
|
* `Utils`:
|
||||||
|
* New extensions on `CommonMessage`: `hasCommands` and `hasNoCommands`. Useful for the `initialFilter` parameter in behaviour builder triggers.
|
||||||
|
|
||||||
|
## 3.3.0
|
||||||
|
|
||||||
|
**THIS VERSION CONTAINS UPGRADE KOTLIN (AND ALL RELATED LIBRARIES) UP TO 1.7.20**
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.7.10` -> `1.7.20`
|
||||||
|
* `Kotlin Serialization`: `1.4.0` -> `1.4.1`
|
||||||
|
* `Korlibs`: `3.1.0` -> `3.2.0`
|
||||||
|
* `MicroUtils`: `0.12.17` -> `0.13.1`
|
||||||
|
* `Core`:
|
||||||
|
* Add opportunity to create command text source and add command in entities builder
|
||||||
|
via `BotCommamd` (thanks to [d1shin](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/664))
|
||||||
|
* `API`:
|
||||||
|
* New extensions `TelegramBot#getStickerSetOrNull` and `TelegramBot#getStickerSetOrThrow`
|
||||||
|
* Old `TelegramBot#getStickerSet` has been deprecated
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* Add opportunity to use triggers and waiters with `BotCommand` (thanks to [d1shin](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/664))
|
||||||
|
|
||||||
|
## 3.2.7
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.12.13` -> `0.12.17`
|
||||||
|
* `Ktor`: `2.1.1` -> `2.1.2`
|
||||||
|
* `Utils`:
|
||||||
|
* Next classes become typealiases instead of classes:
|
||||||
|
* `ReplyKeyboardBuilder`
|
||||||
|
* `ReplyKeyboardRowBuilder`
|
||||||
|
* `InlineKeyboardBuilder`
|
||||||
|
* `InlineKeyboardRowBuilder`
|
||||||
|
|
||||||
|
## 3.2.6
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Fixes in `ChatMemberSerializer#serialize` method
|
||||||
|
* Migration of `EntitiesBuilder` from `Utils` to `Core`
|
||||||
|
* `API`:
|
||||||
|
* All the extensions related to text messages (replies, sending, editing) got their duplicates with `buildEntities` lambda and separator
|
||||||
|
* `Utils`:
|
||||||
|
* Migration of `EntitiesBuilder` from `Utils` to `Core`
|
||||||
|
|
||||||
|
## 3.2.5
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* Improve support of new exceptions recovering mechanism
|
||||||
|
|
||||||
|
## 3.2.4
|
||||||
|
|
||||||
|
* `API`:
|
||||||
|
* New `edit`'s with chats and message ids
|
||||||
|
|
||||||
|
## 3.2.3
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Fixes in `DeleteMyCommands`
|
||||||
|
|
||||||
|
## 3.2.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.12.10` -> `0.12.13`
|
||||||
|
* `Core`:
|
||||||
|
* `MessageIdentifier` has been renamed to `MessageId`
|
||||||
|
* `API`:
|
||||||
|
* New `reply`'es with chats and message ids
|
||||||
|
|
||||||
|
## 3.2.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Ktor`: `2.1.0` -> `2.1.1`
|
||||||
|
* `Korlibs`: `3.0.0` -> `3.1.0`
|
||||||
|
* `MicroUtils`: `0.12.4` -> `0.12.10`
|
||||||
|
|
||||||
|
## 3.2.0
|
||||||
|
|
||||||
|
**Since this update, `RequestsExecutor#execute` may throw only `BotException`. In case you wish to handle some exceptions from `execute` you must catch `BotException` and handle its `cause`**
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Serialization`: `1.4.0-RC` -> `1.4.0`
|
||||||
|
* `MicroUtils`: `0.12.1` -> `0.12.4`
|
||||||
|
* `Core`:
|
||||||
|
* `SetWebhook#allowedUpdates` now is `ALL_UPDATES_LIST` by default instead of `null`
|
||||||
|
* `API`:
|
||||||
|
* Extension `TelegramBot#setWebhook` parameter `allowedUpdates` now is `ALL_UPDATES_LIST` by default instead of `null`
|
||||||
|
* `Utils`:
|
||||||
|
* All related to long polling extensions parameters `allowedUpdates` now are `ALL_UPDATES_LIST` by default instead of `null`
|
||||||
|
|
||||||
|
## 3.1.1
|
||||||
|
|
||||||
|
* `Common`:
|
||||||
|
* Complete Bot API 6.2 implementation
|
||||||
|
|
||||||
|
## 3.1.0
|
||||||
|
|
||||||
|
**This update contains including of Bot API 6.2**
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Ktor`: `2.0.3` -> `2.1.0`
|
||||||
|
* `MicroUtils`: `0.12.0` -> `0.12.1`
|
||||||
|
* `Core`:
|
||||||
|
* Add support of `custom emoji`s
|
||||||
|
* Add support of `sticker_type`
|
||||||
|
|
||||||
|
## 3.0.2
|
||||||
|
|
||||||
|
**ALL OLD DEPRECATIONS HAVE BEEN REMOVED**
|
||||||
|
|
||||||
|
**`copyMessage` HAVE CHANGED THEIR SIGNATURE BY SWAPPING FROM AND TO CHAT IDS**
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.6.21` -> `1.7.10`
|
||||||
|
* `Serialization`: `1.3.3` -> `1.4.0-RC`
|
||||||
|
* `Korlibs`: `2.7.0` -> `3.0.0`
|
||||||
|
* `UUID`: `0.4.1` -> `0.5.0`
|
||||||
|
* `MicroUtils`: `0.11.13` -> `0.12.0`
|
||||||
|
* `Core`:
|
||||||
|
* Interface `ReplyMakrup` has been renamed to `WithReplyMarkup` to correspond its purpose
|
||||||
|
* Data class `LeftChatMember` has been renamed to `LeftChatMemberEvent` to avoid type ambiguite with the other `LeftChatMember`
|
||||||
|
* `ForwardInfo` hierarchy has been fully reworked:
|
||||||
|
* `AnonymousForwardInfo` -> `ForwardInfo.ByAnonymous`
|
||||||
|
* `UserForwardInfo` -> `ForwardInfo.ByUser`
|
||||||
|
* `ForwardFromPublicChatInfo` -> `ForwardInfo.PublicChat`
|
||||||
|
* `ForwardFromChannelInfo` -> `ForwardInfo.PublicChat.FromChannel`
|
||||||
|
* `ForwardFromSupergroupInfo` -> `ForwardInfo.PublicChat.FromSupergroup`
|
||||||
|
* `ForwardInfo.PublicChat.SentByChannel` ___has been created___
|
||||||
|
* `API`:
|
||||||
|
* Add new `Flow`-based live locations API
|
||||||
|
* Add `sendLocation` for sending live locations
|
||||||
|
* `Utils`:
|
||||||
|
* **BREAKING CHANGES** Now all new classcasts (like `Chat.ifPrivateChat` etc.) have been rewritten to be generated with `ksp` and `kotlin poet`
|
||||||
|
|
||||||
|
*Note: Versions 3.0.0 and 3.0.1 have been published with errors and didn't recommend to use*
|
||||||
|
|
||||||
|
## 2.2.2
|
||||||
|
|
||||||
|
* `Utils`:
|
||||||
|
* `buildEntities` now is inline
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* Fixes in `CallbackQuery` triggers
|
||||||
|
|
||||||
|
## 2.2.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Coroutines`: `1.6.3` -> `1.6.4`
|
||||||
|
* `MicroUtils`: `0.11.12` -> `0.11.13`
|
||||||
|
* `Core`:
|
||||||
|
* New `typealiase`s for `CommonMessage` with all supported content types, more info: [PR](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/629)
|
||||||
|
* `Utils`:
|
||||||
|
* New extensions for all types of messages `*.withContentOrNull` and `*.withContentOrThrow` as analogies to the same ones from class casts
|
||||||
|
|
||||||
|
## 2.2.0
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* For `CopyMessage` order of parameters has been changed
|
||||||
|
* `ReplyForce` defaults changes:
|
||||||
|
* All old companion properties (like `ReplyForce.ReplyForceSelective`) have been renamed:
|
||||||
|
* `ReplyForceSelective` -> `Selective`
|
||||||
|
* `ReplyForceNonSelective` -> `NonSelective`
|
||||||
|
* `ReplyForceDefault` -> `Default`
|
||||||
|
* New companion functions:
|
||||||
|
* `ReplyForce#Selective`
|
||||||
|
* `ReplyForce#NonSelective`
|
||||||
|
* Rename `CreatorChatMember` -> `OwnerChatMember`
|
||||||
|
* `API`:
|
||||||
|
* For `copyMessage` order of parameters has been changed
|
||||||
|
* `Utils`:
|
||||||
|
* New extension `Message#sameChat`
|
||||||
|
* New extension `Message#sameMessage`
|
||||||
|
* New functions `flatInlineKeyboard` and `flatReplyKeyboard`
|
||||||
|
* Experimentally add new triple of class casts: `if*`, `*OrNull` and `*OrThrow`
|
||||||
|
|
||||||
|
## 2.1.3
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.11.9` -> `0.11.12`
|
||||||
|
* `Utils`:
|
||||||
|
* Rename `UserId` extension `link` to `userLink`
|
||||||
|
* `Core`
|
||||||
|
* `ChatJoinRequest#inviteLink` is nullable due to the fact that join requests without link do not require invite link
|
||||||
|
|
||||||
|
## 2.1.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Coroutines`: `1.6.1` -> `1.6.3`
|
||||||
|
* `Ktor`: `2.0.2` -> `2.0.3`
|
||||||
|
* `MicroUtils`: `0.11.6` -> `0.11.9`
|
||||||
|
|
||||||
|
## 2.1.1
|
||||||
|
|
||||||
|
* `API`:
|
||||||
|
* Now it is possible to edit any message text via `editMessageText` (but with warning)
|
||||||
|
* Now it is possible to edit any message caption via `editMessageCaption` (but with warning)
|
||||||
|
* Media message caption edit method (`editMessageCaption`) now returns the message with the same generic type (as it must be in telegram system)
|
||||||
|
* New extensions `TelegramBot#edit` has been added for all possible editions types
|
||||||
|
* New extensions `TelegramBot#send` has been added for all possible sending types
|
||||||
|
* New extensions `TelegramBot#delete` has been added
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.11.3` -> `0.11.6`
|
||||||
|
|
||||||
|
## 2.1.0
|
||||||
|
|
||||||
|
__This update contains including of [Telegram Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)__
|
||||||
|
|
||||||
|
* Add support of functionality for `WebApp`s from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||||
|
* Add support of functionality for premium feature from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||||
|
* Add support of `addedToAttachmentMenu` in `CommonUser` from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||||
|
* Add support of `secret_token` in `SetWebhook` request from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||||
|
* Add support of `createInvoiceLink` request from [Bot API 6.1](https://core.telegram.org/bots/api-changelog#june-20-2022)
|
||||||
|
|
||||||
|
## 2.0.3
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* New function `regularln` for simple creating of `RegularTextSource` with new line in the end
|
||||||
|
* `API`:
|
||||||
|
* New function `downloadFileToTemp` for simple downloading of file in filesystem and manipulation with avoiding of direct using input streams and other low-level things
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.11.0` -> `0.11.3`
|
||||||
|
|
||||||
|
## 2.0.2
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils`: `0.10.8` -> `0.11.0`
|
||||||
|
* `UUID`: `0.4.0` -> `0.4.1`
|
||||||
|
|
||||||
|
## 2.0.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Ktor`: `2.0.1` -> `2.0.2`
|
||||||
|
* `MicroUtils`: `0.10.5` -> `0.10.8`
|
||||||
|
* `Utils`:
|
||||||
|
* `TelegramBot#longPolling` now accepts `UpdatesFilter` instead of `FlowsUpdatesFilter`
|
||||||
|
|
||||||
|
## 2.0.0
|
||||||
|
|
||||||
|
___ALL PREVIOUS DEPRECATIONS HAVE BEEN REMOVED___
|
||||||
|
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* Mappers have been removed from waiters extensions
|
||||||
|
* Triggers extensions now will use filtering inside of context receiver instead of passing the filters into `BehaviourContext`. That means that in the subcontext will not be used preinstalled filters for their `BehaviourContext` and filter of trigger will not be used in subcontext
|
||||||
|
* Waiters do not take count parameter anymore
|
||||||
|
* Waiters do not take filter parameter anymore. Use flows filters
|
||||||
|
* `Utils`:
|
||||||
|
* Add opportunity to get event messages with specific `ChatEvent` type using `withEvent`/`requireWithEvent` (by analog with `withEvent` and `requireWithEvent`)
|
||||||
|
|
||||||
|
## 1.1.3
|
||||||
|
|
||||||
|
* `Behaviour Builder with FSM`:
|
||||||
|
* Typealias `StateHandlingErrorHandler` from `1.1.2` has been deprecated and should be replaced with the new one from microutils
|
||||||
|
|
||||||
|
## 1.1.2
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Rename of `TelegramAPIUrlsKeeper#checkWebAppLink` -> `TelegramAPIUrlsKeeper#checkWebAppData` (fix of [#591](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/591))
|
||||||
|
* `Behaviour Builder with FSM`:
|
||||||
|
* New typealias `StateHandlingErrorHandler`
|
||||||
|
* `BehaviourBuilderWithFSM` now accepts new parameter `onStateHandlingErrorHandler` which will be used in case if state has not been successfully completed
|
||||||
|
|
||||||
|
## 1.1.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `MicroUtils.Crypto` will not be provided with that library anymore. Instead, it is recommended to use `Korlibs.Krypto`. You still can add crypto from microutils using next groovy dependency: `dev.inmo:micro_utils.crypto:$micro_utils_version`
|
||||||
|
* `Core`:
|
||||||
|
* Improvements in `TelegramAPIUrlsKeeper#checkWebAppLink`
|
||||||
|
* New field in `TelegramAPIUrlsKeeper#webAppDataSecretKeyHash`
|
||||||
|
* `Behaviour Builder`:
|
||||||
|
* Extension `TelegramBot#buildBehaviour` now returns `BehaviourContext`
|
||||||
|
|
||||||
|
## 1.1.0
|
||||||
|
|
||||||
|
* `Utils`:
|
||||||
|
* New parameter `additionalApplicationEngineEnvironmentConfigurator` in `RequestsExecutor#setWebhookInfoAndStartListenWebhooks` and `startListenWebhooks`
|
||||||
|
|
||||||
|
## 1.0.1
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Serialization`: `1.3.2` -> `1.3.3`
|
||||||
|
* `MicroUtils`: `0.10.3` -> `0.10.4`
|
||||||
|
|
||||||
|
## 1.0.0
|
||||||
|
|
||||||
|
__All the `tgbotapi.extensions.*` packages have been removed__
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `1.6.10` -> `1.6.21`
|
||||||
|
* `Ktor`: `1.6.8` -> `2.0.1`
|
||||||
|
* `MicroUtils`: `0.9.24` -> `0.10.3`
|
||||||
|
* `Core`:
|
||||||
|
* **`Ktor` package renamed. Migration:** `dev.inmo.tgbotapi.bot.Ktor` -> `dev.inmo.tgbotapi.bot.ktor`
|
||||||
|
* **`CallbackQuery` package renamed. Migration:** `dev.inmo.tgbotapi.types.CallbackQuery([\s\\.])` -> `dev.inmo.tgbotapi.types.queries.callback$1`
|
||||||
|
* **`ChatMember` package renamed. Migration:** `dev.inmo.tgbotapi.types.ChatMember([\s\\.])` -> `dev.inmo.tgbotapi.types.chat.member$1`
|
||||||
|
* **`ChatAdministratorRightsImpl` replaced. Migration:** `dev.inmo.tgbotapi.types.ChatAdministratorRightsImpl` -> `dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl`
|
||||||
|
* **`chat.abstract.extended` replaced. Migration:** `dev.inmo.tgbotapi.types.chat.abstract.extended` -> `dev.inmo.tgbotapi.types.chat.member.chat`
|
||||||
|
* **`chat.abstract` replaced. Migration:** `dev.inmo.tgbotapi.types.chat.abstract` -> `dev.inmo.tgbotapi.types.chat.member.chat`
|
||||||
|
* **`chat.extended` replaced. Migration:** `dev.inmo.tgbotapi.types.chat.extended` -> `dev.inmo.tgbotapi.types.chat.member.chat`
|
||||||
|
* **User interfaces have been fully replaced**:
|
||||||
|
* `dev.inmo.tgbotapi.types.User` -> `dev.inmo.tgbotapi.types.chat.User`
|
||||||
|
* `dev.inmo.tgbotapi.types.CommonUser` -> `dev.inmo.tgbotapi.types.chat.CommonUser`
|
||||||
|
* `dev.inmo.tgbotapi.types.ExtendedUser` -> `dev.inmo.tgbotapi.types.chat.ExtendedUser`
|
||||||
|
* `dev.inmo.tgbotapi.types.Bot` -> `dev.inmo.tgbotapi.types.chat.Bot`
|
||||||
|
* `dev.inmo.tgbotapi.types.CommonBot` -> `dev.inmo.tgbotapi.types.chat.CommonBot`
|
||||||
|
* `dev.inmo.tgbotapi.types.ExtendedBot` -> `dev.inmo.tgbotapi.types.chat.ExtendedBot`
|
||||||
|
* `dev.inmo.tgbotapi.types.UserSerializer` -> `dev.inmo.tgbotapi.types.chat.UserSerializer`
|
||||||
|
* **All `InputMedia` has been renamed as `TelegramMedia`. Migration:** `InputMedia` -> `TelegramMedia`
|
||||||
|
* `dev.inmo.tgbotapi.types.InputMedia` -> `dev.inmo.tgbotapi.types.media`
|
||||||
|
* **Replaces of `MessageContent`. Migrations:**
|
||||||
|
* `dev.inmo.tgbotapi.types.message.content.abstracts` -> `dev.inmo.tgbotapi.types.message.content`
|
||||||
|
* `dev.inmo.tgbotapi.types.message.content.media` -> `dev.inmo.tgbotapi.types.message.content`
|
||||||
|
* **Replaces of `TextSource`s. Migrations:** `dev.inmo.tgbotapi.types.MessageEntity.textsources` -> `dev.inmo.tgbotapi.types.message.textsources`
|
||||||
|
* **Replaces of `ParseMode`s. Migrations:** `dev.inmo.tgbotapi.types.ParseMode` -> `dev.inmo.tgbotapi.types.message`
|
||||||
|
* **Replaces of `MediaGroupUpdate`s. Migrations:** `dev.inmo.tgbotapi.types.update.MediaGroupUpdates` -> `dev.inmo.tgbotapi.types.update.media_group`
|
||||||
|
* **`InvoiceContent` has been replaced: `dev.inmo.tgbotapi.types.message.payments.InvoiceContent` -> `dev.inmo.tgbotapi.types.message.content.InvoiceContent`**
|
||||||
|
* **`PossiblySentViaBotCommonMessage` has been replaced: `dev.inmo.tgbotapi.types.message.content.abstracts.PossiblySentViaBotCommonMessage` -> `dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage`**
|
||||||
|
* **Edit live location requests have been replaced:**
|
||||||
|
* `dev.inmo.tgbotapi.requests.edit.LiveLocation` -> `dev.inmo.tgbotapi.requests.edit.location.live`
|
||||||
|
* `dev.inmo.tgbotapi.extensions.api.edit.LiveLocation` -> `dev.inmo.tgbotapi.extensions.api.edit.location.live`
|
||||||
|
* **Edit reply markup requests have been replaced:**
|
||||||
|
* `dev.inmo.tgbotapi.requests.edit.ReplyMarkup` -> `dev.inmo.tgbotapi.requests.edit.reply_markup`
|
||||||
|
* `dev.inmo.tgbotapi.extensions.api.edit.ReplyMarkup` -> `dev.inmo.tgbotapi.extensions.api.edit.reply_markup`
|
||||||
|
* **Common abstracts have been replaced: `dev.inmo.tgbotapi.CommonAbstracts` -> `dev.inmo.tgbotapi.abstracts`**
|
||||||
|
* Constructor of `UnknownInlineKeyboardButton` is not internal and can be created with any `json` ([#563](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/563))
|
||||||
|
* All the interfaces from `dev.inmo.tgbotapi.types.files.abstracts` have been replaced to `dev.inmo.tgbotapi.types.files` and converted to sealed ([#550](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/550))
|
||||||
|
* `PassportFile` has been replaced to `dev.inmo.tgbotapi.types.files`
|
||||||
|
* `StorageFile` has been deprecated (fix of [#556](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/556))
|
||||||
|
* `MultipartFile` do not require `StorageFile` anymore
|
||||||
|
* `InputFile` companion got functions to simplify creation of `InputFile`s
|
||||||
|
* New typealias `FileUrl` (represents `FileId` but declare that they are the same)
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* `SimpleFilter` now is a `fun interface` instead of just callback (fix of [#546](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/546))
|
||||||
|
* New extension `BehaviourContext#createSubContext`. It uses separated `AccumulatorFlow` and will retrieve updates by itself
|
||||||
|
* New extension `BehaviourContext#doInContext`
|
||||||
|
* Extension `BehaviourContext#doInSubContextWithUpdatesFilter` has been renamed to `BehaviourContext#createSubContextAndDoWithUpdatesFilter`
|
||||||
|
* Extension `BehaviourContext#doInSubContext` has been deprecated
|
||||||
|
* `BehaviourContextWithFSM`:
|
||||||
|
* `launchStateHandling` lost its parameter `contextUpdatesFlow: Flow`
|
||||||
|
* `handleState` of `BehaviourContextWithFSM` now will get/create sub context for the state and launch handling in it
|
||||||
|
* `BehaviourWithFSMStateHandler` now extends `StatesHandler`
|
||||||
|
* `BehaviourWithFSMStateHandlerHolder` now extends `CheckableHandlerHolder` and `BehaviourWithFSMStateHandler`
|
||||||
|
* Function `checkHandleable` of `BehaviourWithFSMStateHandlerHolder` now is `suspend`
|
||||||
|
|
||||||
## 0.38.23
|
## 0.38.23
|
||||||
|
|
||||||
* `BehaviourHandler`:
|
* `BehaviourHandler`:
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -1,8 +1,17 @@
|
|||||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#april-16-2022)
|
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#february-3-2023)
|
||||||
|
|
||||||
| [](https://github.com/KotlinBy/awesome-kotlin) [](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) [](https://t.me/InMoTelegramBotAPI) |
|
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
||||||
|:---:|
|
|:---:|:---:|
|
||||||
| [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) [](https://tgbotapi.inmo.dev/index.html) [](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
| 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) |
|
||||||
|
|
||||||
|
<!--- [](https://t.me/ktgbotapi) --->
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://t.me/ktgbotapi">
|
||||||
|
<img src="./resources/tg_channel_qr.jpg">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
Hello! This is a set of libraries for working with Telegram Bot API.
|
Hello! This is a set of libraries for working with Telegram Bot API.
|
||||||
|
|
||||||
@@ -107,5 +116,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 [wiki](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/About-this-project) and
|
always welcome in our [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and
|
||||||
[chat](https://t.me/InMoTelegramBotAPIChat).
|
[chat](https://t.me/InMoTelegramBotAPIChat).
|
||||||
|
|||||||
20
build.gradle
20
build.gradle
@@ -6,19 +6,26 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath libs.kotlin.gradle.plugin
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
classpath libs.kotlin.ksp.plugin
|
||||||
classpath "com.github.breadmoirai:github-release:$github_release_plugin_version"
|
classpath libs.kotlin.serialization.plugin
|
||||||
|
classpath libs.kotlin.dokka.plugin
|
||||||
|
classpath libs.github.release.plugin
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" apply false
|
alias(libs.plugins.kotlin.dokka)
|
||||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" apply false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
||||||
allprojects {
|
allprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
google()
|
||||||
|
maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
|
||||||
|
}
|
||||||
if (it != rootProject.findProject("docs")) {
|
if (it != rootProject.findProject("docs")) {
|
||||||
tasks.whenTaskAdded { task ->
|
tasks.whenTaskAdded { task ->
|
||||||
if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") {
|
if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") {
|
||||||
@@ -27,6 +34,7 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
apply from: "./extensions.gradle"
|
||||||
|
|
||||||
private String getCurrentVersionChangelog() {
|
private String getCurrentVersionChangelog() {
|
||||||
OutputStream changelogDataOS = new ByteArrayOutputStream()
|
OutputStream changelogDataOS = new ByteArrayOutputStream()
|
||||||
@@ -48,7 +56,7 @@ if (new File(projectDir, "secret.gradle").exists()) {
|
|||||||
owner "InsanusMokrassar"
|
owner "InsanusMokrassar"
|
||||||
repo "TelegramBotAPI"
|
repo "TelegramBotAPI"
|
||||||
|
|
||||||
tagName "$library_version"
|
tagName "v$library_version"
|
||||||
releaseName "$library_version"
|
releaseName "$library_version"
|
||||||
targetCommitish "$library_version"
|
targetCommitish "$library_version"
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,17 @@
|
|||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
|
||||||
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
id "org.jetbrains.dokka" version "$dokka_version"
|
id "org.jetbrains.dokka"
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
project.description = "Full collection of all built-in tgbotapi tools"
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm {
|
|
||||||
compilations.main {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
js(IR) {
|
|
||||||
browser()
|
|
||||||
nodejs()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation kotlin('stdlib')
|
|
||||||
|
|
||||||
api project(":tgbotapi.core")
|
api project(":tgbotapi.core")
|
||||||
api project(":tgbotapi.api")
|
api project(":tgbotapi.api")
|
||||||
api project(":tgbotapi.utils")
|
api project(":tgbotapi.utils")
|
||||||
@@ -58,12 +30,13 @@ kotlin {
|
|||||||
|
|
||||||
private List<SourceDirectorySet> findSourcesWithName(String... approximateNames) {
|
private List<SourceDirectorySet> findSourcesWithName(String... approximateNames) {
|
||||||
return parent.subprojects
|
return parent.subprojects
|
||||||
.findAll { it != project }
|
.findAll { it != project && it.hasProperty("kotlin") }
|
||||||
.collectMany { it.kotlin.sourceSets }
|
.collectMany { it.kotlin.sourceSets }
|
||||||
.findAll { sourceSet -> approximateNames.any {
|
.findAll { sourceSet ->
|
||||||
nameToFilter -> sourceSet.name.contains(nameToFilter)
|
approximateNames.any { nameToFilter ->
|
||||||
}
|
sourceSet.name.contains(nameToFilter)
|
||||||
}.collect { it.kotlin }
|
}
|
||||||
|
}.collect { it.kotlin }
|
||||||
}
|
}
|
||||||
|
|
||||||
Object callback = {
|
Object callback = {
|
||||||
@@ -103,8 +76,3 @@ Object callback = {
|
|||||||
|
|
||||||
tasks.dokkaGfm(callback)
|
tasks.dokkaGfm(callback)
|
||||||
tasks.dokkaHtml(callback)
|
tasks.dokkaHtml(callback)
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|||||||
8
extensions.gradle
Normal file
8
extensions.gradle
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
allprojects {
|
||||||
|
ext {
|
||||||
|
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
|
||||||
|
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle"
|
||||||
|
|
||||||
|
publishGradlePath = "${rootProject.projectDir.absolutePath}/publish.gradle"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,21 +5,5 @@ kotlin.js.generate.externals=true
|
|||||||
kotlin.incremental=true
|
kotlin.incremental=true
|
||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
kotlin_version=1.6.10
|
|
||||||
kotlin_coroutines_version=1.6.1
|
|
||||||
kotlin_serialisation_runtime_version=1.3.2
|
|
||||||
klock_version=2.7.0
|
|
||||||
uuid_version=0.4.0
|
|
||||||
ktor_version=1.6.8
|
|
||||||
|
|
||||||
micro_utils_version=0.9.24
|
|
||||||
|
|
||||||
javax_activation_version=1.1.1
|
|
||||||
|
|
||||||
|
|
||||||
dokka_version=1.6.10
|
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=0.38.23
|
library_version=6.1.0
|
||||||
|
|
||||||
github_release_plugin_version=2.3.7
|
|
||||||
|
|||||||
70
gradle/libs.versions.toml
Normal file
70
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
[versions]
|
||||||
|
|
||||||
|
kotlin = "1.8.10"
|
||||||
|
kotlin-serialization = "1.5.0"
|
||||||
|
kotlin-coroutines = "1.6.4"
|
||||||
|
|
||||||
|
javax-activation = "1.1.1"
|
||||||
|
|
||||||
|
korlibs = "3.4.0"
|
||||||
|
uuid = "0.7.0"
|
||||||
|
ktor = "2.2.4"
|
||||||
|
|
||||||
|
ksp = "1.8.10-1.0.9"
|
||||||
|
kotlin-poet = "1.12.0"
|
||||||
|
|
||||||
|
microutils = "0.17.3"
|
||||||
|
|
||||||
|
github-release-plugin = "2.4.1"
|
||||||
|
dokka = "1.8.10"
|
||||||
|
|
||||||
|
[libraries]
|
||||||
|
|
||||||
|
kotlin = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin" }
|
||||||
|
kotlin-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlin-coroutines" }
|
||||||
|
kotlin-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlin-serialization" }
|
||||||
|
kotlin-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlin-serialization" }
|
||||||
|
kotlin-test-common = { module = "org.jetbrains.kotlin:kotlin-test-common", version.ref = "kotlin" }
|
||||||
|
kotlin-test-annotations-common = { module = "org.jetbrains.kotlin:kotlin-test-annotations-common", version.ref = "kotlin" }
|
||||||
|
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
|
||||||
|
kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref = "kotlin" }
|
||||||
|
|
||||||
|
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||||
|
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
|
||||||
|
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
|
||||||
|
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
|
||||||
|
|
||||||
|
javax-activation = { module = "javax.activation:activation", version.ref = "javax-activation" }
|
||||||
|
|
||||||
|
korlibs-klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "korlibs" }
|
||||||
|
korlibs-krypto = { module = "com.soywiz.korlibs.krypto:krypto", version.ref = "korlibs" }
|
||||||
|
|
||||||
|
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
|
||||||
|
|
||||||
|
microutils-coroutines = { module = "dev.inmo:micro_utils.coroutines", version.ref = "microutils" }
|
||||||
|
microutils-serialization-base64 = { module = "dev.inmo:micro_utils.serialization.base64", version.ref = "microutils" }
|
||||||
|
microutils-serialization-encapsulator = { module = "dev.inmo:micro_utils.serialization.encapsulator", version.ref = "microutils" }
|
||||||
|
microutils-serialization-typedSerializer = { module = "dev.inmo:micro_utils.serialization.typed_serializer", version.ref = "microutils" }
|
||||||
|
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" }
|
||||||
|
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
|
||||||
|
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
||||||
|
|
||||||
|
# ksp dependencies
|
||||||
|
|
||||||
|
kotlin-poet = { module = "com.squareup:kotlinpoet-ksp", version.ref = "kotlin-poet" }
|
||||||
|
ksp = { module = "com.google.devtools.ksp:symbol-processing-api", version.ref = "ksp" }
|
||||||
|
|
||||||
|
# buildscript classpaths
|
||||||
|
|
||||||
|
kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||||
|
kotlin-ksp-plugin = { module = "com.google.devtools.ksp:symbol-processing-gradle-plugin", version.ref = "ksp" }
|
||||||
|
kotlin-serialization-plugin = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kotlin" }
|
||||||
|
kotlin-dokka-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka" }
|
||||||
|
github-release-plugin = { module = "com.github.breadmoirai:github-release", version.ref = "github-release-plugin" }
|
||||||
|
|
||||||
|
[plugins]
|
||||||
|
|
||||||
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", 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-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
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.4.2-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||||
|
|||||||
32
mppJsProject.gradle
Normal file
32
mppJsProject.gradle
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
project.version = "$version"
|
||||||
|
project.group = "$group"
|
||||||
|
|
||||||
|
apply from: "$publishGradlePath"
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js (IR) {
|
||||||
|
browser()
|
||||||
|
nodejs()
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kotlin
|
||||||
|
api libs.kotlin.serialization
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commonTest {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kotlin.test.common
|
||||||
|
implementation libs.kotlin.test.annotations.common
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsTest {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kotlin.test.js
|
||||||
|
implementation libs.kotlin.test.junit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
47
mppProjectWithSerialization.gradle
Normal file
47
mppProjectWithSerialization.gradle
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
project.version = "$library_version"
|
||||||
|
project.group = "$library_group"
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
jvm {
|
||||||
|
compilations.main {
|
||||||
|
kotlinOptions {
|
||||||
|
jvmTarget = "1.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
js (IR) {
|
||||||
|
browser()
|
||||||
|
nodejs()
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kotlin
|
||||||
|
api libs.kotlin.serialization
|
||||||
|
}
|
||||||
|
}
|
||||||
|
commonTest {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kotlin.test.common
|
||||||
|
implementation libs.kotlin.test.annotations.common
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jvmTest {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kotlin.test.junit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsTest {
|
||||||
|
dependencies {
|
||||||
|
implementation libs.kotlin.test.js
|
||||||
|
implementation libs.kotlin.test.junit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
task javadocsJar(type: Jar) {
|
||||||
classifier = 'javadoc'
|
archiveClassifier.convention("javadoc")
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
@@ -19,22 +20,22 @@ publishing {
|
|||||||
}
|
}
|
||||||
|
|
||||||
developers {
|
developers {
|
||||||
|
|
||||||
developer {
|
developer {
|
||||||
id = "InsanusMokrassar"
|
id = "InsanusMokrassar"
|
||||||
name = "Ovsiannikov Aleksei"
|
name = "Ovsiannikov Aleksei"
|
||||||
email = "ovsyannikov.alexey95@gmail.com"
|
email = "ovsyannikov.alexey95@gmail.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
licenses {
|
licenses {
|
||||||
|
|
||||||
license {
|
license {
|
||||||
name = "Apache Software License 2.0"
|
name = "Apache Software License 2.0"
|
||||||
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
|
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
@@ -42,35 +43,55 @@ 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) {
|
||||||
|
maven {
|
||||||
|
name = "Gitea"
|
||||||
|
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
||||||
|
|
||||||
|
credentials(HttpHeaderCredentials) {
|
||||||
|
name = "Authorization"
|
||||||
|
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
||||||
|
}
|
||||||
|
|
||||||
|
authentication {
|
||||||
|
header(HttpHeaderAuthentication)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||||
maven {
|
maven {
|
||||||
name = "sonatype"
|
name = "sonatype"
|
||||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||||
|
|
||||||
credentials {
|
credentials {
|
||||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.hasProperty("signing.gnupg.keyName")) {
|
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||||
apply plugin: 'signing'
|
apply plugin: 'signing'
|
||||||
|
|
||||||
signing {
|
signing {
|
||||||
useGpgCmd()
|
useGpgCmd()
|
||||||
|
|
||||||
sign publishing.publications
|
sign publishing.publications
|
||||||
}
|
}
|
||||||
|
|
||||||
task signAll {
|
task signAll {
|
||||||
tasks.withType(Sign).forEach {
|
tasks.withType(Sign).forEach {
|
||||||
dependsOn(it)
|
dependsOn(it)
|
||||||
|
|||||||
@@ -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":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||||
BIN
resources/tg_channel_qr.jpg
Normal file
BIN
resources/tg_channel_qr.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 448 KiB |
@@ -12,14 +12,10 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
include ":tgbotapi.core"
|
include ":tgbotapi.core"
|
||||||
|
include ":tgbotapi.ksp"
|
||||||
include ":tgbotapi.api"
|
include ":tgbotapi.api"
|
||||||
include ":tgbotapi.utils"
|
include ":tgbotapi.utils"
|
||||||
include ":tgbotapi.behaviour_builder"
|
include ":tgbotapi.behaviour_builder"
|
||||||
include ":tgbotapi.behaviour_builder.fsm"
|
include ":tgbotapi.behaviour_builder.fsm"
|
||||||
include ":tgbotapi.extensions.api"
|
|
||||||
include ":tgbotapi.extensions.utils"
|
|
||||||
include ":tgbotapi.extensions.behaviour_builder"
|
|
||||||
include ":tgbotapi.extensions.behaviour_builder.fsm"
|
|
||||||
include ":tgbotapi"
|
include ":tgbotapi"
|
||||||
include ":tgbotapi.webapps"
|
include ":tgbotapi.webapps"
|
||||||
include ":docs"
|
|
||||||
|
|||||||
@@ -1,56 +1,21 @@
|
|||||||
buildscript {
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform"
|
id "org.jetbrains.kotlin.multiplatform"
|
||||||
id "org.jetbrains.kotlin.plugin.serialization"
|
id "org.jetbrains.kotlin.plugin.serialization"
|
||||||
|
id "org.jetbrains.dokka"
|
||||||
}
|
}
|
||||||
|
|
||||||
project.version = "$library_version"
|
|
||||||
project.group = "$library_group"
|
|
||||||
project.description = "API extensions with \"Telegram Bot API\"-like extensions for TelegramBot and RequestsExecutor"
|
project.description = "API extensions with \"Telegram Bot API\"-like extensions for TelegramBot and RequestsExecutor"
|
||||||
|
|
||||||
apply from: "../publish.gradle"
|
apply from: "$mppProjectWithSerializationPresetPath"
|
||||||
|
apply from: "$publishGradlePath"
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvm {
|
|
||||||
compilations.main {
|
|
||||||
kotlinOptions {
|
|
||||||
jvmTarget = "1.8"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
js(IR) {
|
|
||||||
browser()
|
|
||||||
nodejs()
|
|
||||||
}
|
|
||||||
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation kotlin('stdlib')
|
|
||||||
api project(":tgbotapi.core")
|
api project(":tgbotapi.core")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.Ktor.telegramBot
|
import dev.inmo.tgbotapi.bot.ktor.telegramBot
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
|
||||||
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
||||||
|
|||||||
@@ -3,25 +3,51 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.DeleteMessage
|
import dev.inmo.tgbotapi.requests.DeleteMessage
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
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,
|
||||||
messageId: MessageIdentifier
|
messageId: MessageId
|
||||||
) = execute(
|
) = execute(
|
||||||
DeleteMessage(chatId, messageId)
|
DeleteMessage(chatId, messageId)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier
|
messageId: MessageId
|
||||||
) = deleteMessage(chat.id, messageId)
|
) = deleteMessage(chat.id, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteMessage(
|
suspend fun TelegramBot.deleteMessage(
|
||||||
message: Message
|
message: Message
|
||||||
) = deleteMessage(message.chat, message.messageId)
|
): Boolean {
|
||||||
|
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
||||||
|
if (mediaGroupContent == null) {
|
||||||
|
return deleteMessage(message.chat, message.messageId)
|
||||||
|
} else {
|
||||||
|
return mediaGroupContent.group.map {
|
||||||
|
deleteMessage(it.sourceMessage)
|
||||||
|
}.all { it }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId
|
||||||
|
) = deleteMessage(chatId, messageId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId
|
||||||
|
) = deleteMessage(chat, messageId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.delete(
|
||||||
|
message: Message
|
||||||
|
) = deleteMessage(message)
|
||||||
|
|
||||||
suspend fun Message.delete(
|
suspend fun Message.delete(
|
||||||
requestsExecutor: TelegramBot
|
requestsExecutor: TelegramBot
|
||||||
|
|||||||
@@ -3,54 +3,62 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.ForwardMessage
|
import dev.inmo.tgbotapi.requests.ForwardMessage
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = execute(
|
) = execute(
|
||||||
ForwardMessage(fromChatId, toChatId, messageId, disableNotification, protectContent)
|
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification, protectContent)
|
) = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification, protectContent)
|
) = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification, protectContent)
|
) = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: Message,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification, protectContent)
|
) = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent)
|
||||||
|
|
||||||
suspend fun TelegramBot.forwardMessage(
|
suspend fun TelegramBot.forwardMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: Message,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false
|
||||||
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification, protectContent)
|
) = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent)
|
||||||
|
|||||||
@@ -1,70 +1,57 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.InternalUtils
|
package dev.inmo.tgbotapi.extensions.api.InternalUtils
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
|
import dev.inmo.tgbotapi.types.MediaGroupIdentifier
|
||||||
import dev.inmo.tgbotapi.types.UpdateIdentifier
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblySentViaBotCommonMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
|
import dev.inmo.tgbotapi.types.message.content.MediaGroupPartContent
|
||||||
import dev.inmo.tgbotapi.types.update.*
|
import dev.inmo.tgbotapi.types.update.*
|
||||||
import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.*
|
|
||||||
import dev.inmo.tgbotapi.types.update.abstracts.*
|
import dev.inmo.tgbotapi.types.update.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.asMediaGroupMessage
|
||||||
|
|
||||||
internal fun Update.lastUpdateIdentifier(): UpdateIdentifier {
|
/**
|
||||||
return if (this is SentMediaGroupUpdate) {
|
* Will convert incoming list of updates to list with [MediaGroupUpdate]s
|
||||||
origins.last().updateId
|
*/
|
||||||
} else {
|
|
||||||
updateId
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun List<Update>.lastUpdateIdentifier(): UpdateIdentifier? {
|
|
||||||
return maxByOrNull { it.updateId } ?.lastUpdateIdentifier()
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
||||||
val resultUpdates = mutableListOf<Update>()
|
val resultUpdates = mutableListOf<Update>()
|
||||||
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<BaseSentMessageUpdate>>()
|
val mediaGroups = mutableMapOf<MediaGroupIdentifier, MutableList<Pair<BaseSentMessageUpdate, PossiblySentViaBotCommonMessage<MediaGroupPartContent>>>>()
|
||||||
|
|
||||||
for (update in this) {
|
for (update in this) {
|
||||||
val data = (update.data as? MediaGroupMessage<*>)
|
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {
|
||||||
if (data == null) {
|
if (it.content is MediaGroupPartContent) {
|
||||||
|
it as PossiblySentViaBotCommonMessage<MediaGroupPartContent>
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val mediaGroupId = message ?.mediaGroupId
|
||||||
|
if (message == null || mediaGroupId == null) {
|
||||||
resultUpdates.add(update)
|
resultUpdates.add(update)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
when (update) {
|
when (update) {
|
||||||
is BaseEditMessageUpdate -> resultUpdates.add(
|
|
||||||
update.toEditMediaGroupUpdate()
|
|
||||||
)
|
|
||||||
is BaseSentMessageUpdate -> {
|
is BaseSentMessageUpdate -> {
|
||||||
mediaGroups.getOrPut(data.mediaGroupId) {
|
mediaGroups.getOrPut(mediaGroupId) {
|
||||||
mutableListOf()
|
mutableListOf()
|
||||||
}.add(update)
|
}.add(update to message)
|
||||||
}
|
}
|
||||||
else -> resultUpdates.add(update)
|
else -> resultUpdates.add(update)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mediaGroups.values.map {
|
|
||||||
it.toSentMediaGroupUpdate() ?.let { mediaGroupUpdate ->
|
mediaGroups.map { (_, updatesWithMessages) ->
|
||||||
resultUpdates.add(mediaGroupUpdate)
|
val update = updatesWithMessages.maxBy { it.first.updateId }.first
|
||||||
}
|
resultUpdates.add(
|
||||||
|
update.copy(updatesWithMessages.map { it.second }.asMediaGroupMessage())
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
resultUpdates.sortBy { it.updateId }
|
resultUpdates.sortBy { it.updateId }
|
||||||
return resultUpdates
|
return resultUpdates
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun List<BaseSentMessageUpdate>.toSentMediaGroupUpdate(): SentMediaGroupUpdate? = (this as? SentMediaGroupUpdate) ?: let {
|
/**
|
||||||
if (isEmpty()) {
|
* @return [EditMessageMediaGroupUpdate] in case if [this] is [EditMessageUpdate]. When [this] object is
|
||||||
return@let null
|
* [EditChannelPostUpdate] instance - will return [EditChannelPostMediaGroupUpdate]
|
||||||
}
|
*
|
||||||
val resultList = sortedBy { it.updateId }
|
* @throws IllegalStateException
|
||||||
when (first()) {
|
*/
|
||||||
is MessageUpdate -> MessageMediaGroupUpdate(resultList)
|
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate() = this
|
||||||
is ChannelPostUpdate -> ChannelPostMediaGroupUpdate(resultList)
|
|
||||||
else -> null
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate(): EditMediaGroupUpdate = (this as? EditMediaGroupUpdate) ?: let {
|
|
||||||
when (this) {
|
|
||||||
is EditMessageUpdate -> EditMessageMediaGroupUpdate(this)
|
|
||||||
is EditChannelPostUpdate -> EditChannelPostMediaGroupUpdate(this)
|
|
||||||
else -> error("Unsupported type of ${BaseEditMessageUpdate::class.simpleName}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
||||||
|
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||||
|
import dev.inmo.tgbotapi.abstracts.*
|
||||||
|
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||||
|
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||||
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
|
import kotlinx.coroutines.*
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.FlowCollector
|
||||||
|
import kotlinx.coroutines.flow.map
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
import kotlin.js.JsName
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
import kotlin.math.ceil
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class EditLiveLocationInfo(
|
||||||
|
override val latitude: Double,
|
||||||
|
override val longitude: Double,
|
||||||
|
override val horizontalAccuracy: Meters? = null,
|
||||||
|
override val heading: Degrees? = null,
|
||||||
|
override val proximityAlertRadius: Meters? = null,
|
||||||
|
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) : Locationed, HorizontallyAccured, ProximityAlertable, Headed, WithReplyMarkup
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will [sendLiveLocation] with the first [EditLiveLocationInfo] data and update than. Each [liveTimeMillis] passing,
|
||||||
|
* the message will be sent again and new edits will be applied to the new message
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.handleLiveLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
locationsFlow: Flow<EditLiveLocationInfo>,
|
||||||
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||||
|
) {
|
||||||
|
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null
|
||||||
|
val updateMessageJob = CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
|
||||||
|
while (isActive) {
|
||||||
|
delay(liveTimeMillis)
|
||||||
|
// Remove previous location message info to resend live location message
|
||||||
|
currentLiveLocationMessage = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
locationsFlow.collect {
|
||||||
|
val capturedLiveLocationMessage = currentLiveLocationMessage
|
||||||
|
if (capturedLiveLocationMessage == null) {
|
||||||
|
updateMessageJob.start()
|
||||||
|
currentLiveLocationMessage = send(
|
||||||
|
chatId,
|
||||||
|
it.latitude,
|
||||||
|
it.longitude,
|
||||||
|
ceil(liveTimeMillis.toDouble() / 1000).toInt(),
|
||||||
|
it.horizontalAccuracy,
|
||||||
|
it.heading,
|
||||||
|
it.proximityAlertRadius,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
it.replyMarkup
|
||||||
|
).also {
|
||||||
|
sentMessageFlow ?.emit(it)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
edit(
|
||||||
|
capturedLiveLocationMessage,
|
||||||
|
it.latitude,
|
||||||
|
it.longitude,
|
||||||
|
it.horizontalAccuracy,
|
||||||
|
it.heading,
|
||||||
|
it.proximityAlertRadius,
|
||||||
|
it.replyMarkup
|
||||||
|
).also {
|
||||||
|
sentMessageFlow ?.emit(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will apply [Flow.map] to the [locationsFlow] to create [EditLiveLocationInfo] and pass the result flow to the
|
||||||
|
* [handleLiveLocation] with [Flow] typed by [EditLiveLocationInfo]
|
||||||
|
*/
|
||||||
|
@JvmName("handleLiveLocationWithLocation")
|
||||||
|
@JsName("handleLiveLocationWithLocation")
|
||||||
|
suspend fun TelegramBot.handleLiveLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
locationsFlow: Flow<Location>,
|
||||||
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||||
|
) {
|
||||||
|
handleLiveLocation(
|
||||||
|
chatId,
|
||||||
|
locationsFlow.map {
|
||||||
|
EditLiveLocationInfo(
|
||||||
|
it.latitude,
|
||||||
|
it.longitude,
|
||||||
|
it.horizontalAccuracy,
|
||||||
|
(it as? LiveLocation) ?.heading,
|
||||||
|
(it as? LiveLocation) ?.proximityAlertRadius,
|
||||||
|
(it as? WithReplyMarkup) ?.replyMarkup as? InlineKeyboardMarkup
|
||||||
|
)
|
||||||
|
},
|
||||||
|
liveTimeMillis,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
sentMessageFlow
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will apply [Flow.map] to the [locationsFlow] to create [EditLiveLocationInfo] and pass the result flow to the
|
||||||
|
* [handleLiveLocation] with [Flow] typed by [EditLiveLocationInfo]
|
||||||
|
*/
|
||||||
|
@JvmName("handleLiveLocationWithLatLong")
|
||||||
|
@JsName("handleLiveLocationWithLatLong")
|
||||||
|
suspend fun TelegramBot.handleLiveLocation(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
locationsFlow: Flow<Pair<Double, Double>>,
|
||||||
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||||
|
) {
|
||||||
|
handleLiveLocation(
|
||||||
|
chatId,
|
||||||
|
locationsFlow.map { (lat, long) ->
|
||||||
|
EditLiveLocationInfo(
|
||||||
|
lat,
|
||||||
|
long
|
||||||
|
)
|
||||||
|
},
|
||||||
|
liveTimeMillis,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
sentMessageFlow
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -2,22 +2,38 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
|
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import com.soywiz.klock.TimeSpan
|
import com.soywiz.klock.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.LiveLocation.editLiveLocation
|
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||||
import dev.inmo.tgbotapi.extensions.api.edit.LiveLocation.stopLiveLocation
|
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.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.abstracts.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.Message
|
||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
import io.ktor.utils.io.core.Closeable
|
import io.ktor.utils.io.core.Closeable
|
||||||
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
|
||||||
@@ -44,7 +60,8 @@ class LiveLocationProvider internal constructor(
|
|||||||
private set
|
private set
|
||||||
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
||||||
|
|
||||||
private var message: ContentMessage<LocationContent> = initMessage
|
var message: ContentMessage<LocationContent> = initMessage
|
||||||
|
private set
|
||||||
val lastLocation: LiveLocation
|
val lastLocation: LiveLocation
|
||||||
get() = message.content.location as LiveLocation
|
get() = message.content.location as LiveLocation
|
||||||
|
|
||||||
@@ -90,9 +107,10 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHorizontalAccuracy: Meters? = null,
|
initHorizontalAccuracy: Meters? = null,
|
||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider {
|
): LiveLocationProvider {
|
||||||
@@ -106,6 +124,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHorizontalAccuracy,
|
initHorizontalAccuracy,
|
||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@@ -135,9 +154,10 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHorizontalAccuracy: Meters? = null,
|
initHorizontalAccuracy: Meters? = null,
|
||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -149,6 +169,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHorizontalAccuracy,
|
initHorizontalAccuracy,
|
||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@@ -162,15 +183,16 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.startLiveLocation(
|
suspend fun TelegramBot.startLiveLocation(
|
||||||
scope: CoroutineScope,
|
scope: CoroutineScope,
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
location: StaticLocation,
|
location: StaticLocation,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
initHorizontalAccuracy: Meters? = null,
|
initHorizontalAccuracy: Meters? = null,
|
||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -182,6 +204,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHorizontalAccuracy,
|
initHorizontalAccuracy,
|
||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@@ -201,9 +224,10 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHorizontalAccuracy: Meters? = null,
|
initHorizontalAccuracy: Meters? = null,
|
||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -215,6 +239,7 @@ suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHorizontalAccuracy,
|
initHorizontalAccuracy,
|
||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
replyToMessageId,
|
replyToMessageId,
|
||||||
@@ -235,6 +260,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHorizontalAccuracy: Meters? = null,
|
initHorizontalAccuracy: Meters? = null,
|
||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
|
threadId: MessageThreadId? = to.threadIdOrNull,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
@@ -248,6 +274,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHorizontalAccuracy,
|
initHorizontalAccuracy,
|
||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
@@ -267,6 +294,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHorizontalAccuracy: Meters? = null,
|
initHorizontalAccuracy: Meters? = null,
|
||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
|
threadId: MessageThreadId? = to.threadIdOrNull,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
@@ -279,6 +307,7 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHorizontalAccuracy,
|
initHorizontalAccuracy,
|
||||||
initHeading,
|
initHeading,
|
||||||
initProximityAlertRadius,
|
initProximityAlertRadius,
|
||||||
|
threadId,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.StopPoll
|
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.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -13,7 +13,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
suspend fun TelegramBot.stopPoll(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
StopPoll(chatId, messageId, replyMarkup)
|
StopPoll(chatId, messageId, replyMarkup)
|
||||||
@@ -25,7 +25,7 @@ suspend fun TelegramBot.stopPoll(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
suspend fun TelegramBot.stopPoll(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chat.id, messageId, replyMarkup)
|
) = stopPoll(chat.id, messageId, replyMarkup)
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ suspend fun TelegramBot.stopPoll(
|
|||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopPoll(
|
suspend fun TelegramBot.stopPoll(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
message: Message,
|
message: Message,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopPoll(chatId, message.messageId, replyMarkup)
|
) = stopPoll(chatId, message.messageId, replyMarkup)
|
||||||
|
|||||||
@@ -2,7 +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.AnswerCallbackQuery
|
import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery
|
||||||
import dev.inmo.tgbotapi.types.CallbackQuery.CallbackQuery
|
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||||
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
||||||
|
|
||||||
suspend fun TelegramBot.answerCallbackQuery(
|
suspend fun TelegramBot.answerCallbackQuery(
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ 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.ClearMyDefaultAdministratorRights
|
import dev.inmo.tgbotapi.requests.bot.ClearMyDefaultAdministratorRights
|
||||||
import dev.inmo.tgbotapi.types.ChatAdministratorRightsImpl
|
|
||||||
|
|
||||||
suspend fun TelegramBot.clearMyDefaultAdministratorRights(
|
suspend fun TelegramBot.clearMyDefaultAdministratorRights(
|
||||||
forChannels: Boolean? = null
|
forChannels: Boolean? = null
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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.ChatAdministratorRightsImpl
|
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
|
||||||
|
|
||||||
suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
||||||
rights: ChatAdministratorRightsImpl,
|
rights: ChatAdministratorRightsImpl,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.ExportChatInviteLink
|
import dev.inmo.tgbotapi.requests.chat.ExportChatInviteLink
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.exportChatInviteLink(
|
suspend fun TelegramBot.exportChatInviteLink(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.LeaveChat
|
import dev.inmo.tgbotapi.requests.chat.LeaveChat
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.leaveChat(
|
suspend fun TelegramBot.leaveChat(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
|
||||||
|
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.closeForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
CloseForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.closeForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = closeForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.closeForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = closeForumTopic(chat.id, forumTopic.messageThreadId)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseGeneralForumTopic
|
||||||
|
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.closeGeneralForumTopic(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(
|
||||||
|
CloseGeneralForumTopic(chatId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.closeGeneralForumTopic(
|
||||||
|
chat: Chat
|
||||||
|
) = closeGeneralForumTopic(chat.id)
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.utils.RGBColor
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
name: String,
|
||||||
|
color: RGBColor,
|
||||||
|
iconEmojiId: CustomEmojiId? = null
|
||||||
|
) = execute(
|
||||||
|
CreateForumTopic(
|
||||||
|
chatId,
|
||||||
|
name,
|
||||||
|
color,
|
||||||
|
iconEmojiId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.createForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
name: String,
|
||||||
|
color: RGBColor,
|
||||||
|
iconEmojiId: CustomEmojiId? = null
|
||||||
|
) = createForumTopic(chat.id, name, color, iconEmojiId)
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.DeleteForumTopic
|
||||||
|
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.deleteForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
DeleteForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = deleteForumTopic(chatId, forumTopic.messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = deleteForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.deleteForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = deleteForumTopic(chat.id, forumTopic.messageThreadId)
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.EditForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||||
|
import dev.inmo.tgbotapi.types.ForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId,
|
||||||
|
name: String? = null,
|
||||||
|
iconEmojiId: CustomEmojiId? = null
|
||||||
|
) = execute(
|
||||||
|
EditForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId,
|
||||||
|
name,
|
||||||
|
iconEmojiId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId,
|
||||||
|
name: String? = null,
|
||||||
|
iconEmojiId: CustomEmojiId? = null
|
||||||
|
) = editForumTopic(chat.id, messageThreadId, name, iconEmojiId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editForumTopic(
|
||||||
|
chatIdentifier: ChatIdentifier,
|
||||||
|
forumTopic: ForumTopic,
|
||||||
|
iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId
|
||||||
|
) = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.EditForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.EditGeneralForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||||
|
import dev.inmo.tgbotapi.types.ForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editGeneralForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
name: String
|
||||||
|
) = execute(
|
||||||
|
EditGeneralForumTopic(
|
||||||
|
chatId,
|
||||||
|
name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editGeneralForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
name: String
|
||||||
|
) = editGeneralForumTopic(chat.id, name)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.editGeneralForumTopic(
|
||||||
|
chatIdentifier: ChatIdentifier,
|
||||||
|
forumTopic: ForumTopic,
|
||||||
|
) = editGeneralForumTopic(chatIdentifier, forumTopic.name)
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseGeneralForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.HideGeneralForumTopic
|
||||||
|
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.hideGeneralForumTopic(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(
|
||||||
|
HideGeneralForumTopic(chatId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.hideGeneralForumTopic(
|
||||||
|
chat: Chat
|
||||||
|
) = hideGeneralForumTopic(chat.id)
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.ReopenForumTopic
|
||||||
|
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.reopenForumTopic(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
ReopenForumTopic(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reopenForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = reopenForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reopenForumTopic(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = reopenForumTopic(chat.id, forumTopic.messageThreadId)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.ReopenForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.ReopenGeneralForumTopic
|
||||||
|
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.reopenGeneralForumTopic(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(
|
||||||
|
ReopenGeneralForumTopic(chatId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.reopenGeneralForumTopic(
|
||||||
|
chat: Chat
|
||||||
|
) = reopenGeneralForumTopic(chat.id)
|
||||||
@@ -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.CloseForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.CloseGeneralForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.HideGeneralForumTopic
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.forum.UnhideGeneralForumTopic
|
||||||
|
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.unhideGeneralForumTopic(
|
||||||
|
chatId: ChatIdentifier
|
||||||
|
) = execute(
|
||||||
|
UnhideGeneralForumTopic(chatId)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unhideGeneralForumTopic(
|
||||||
|
chat: Chat
|
||||||
|
) = unhideGeneralForumTopic(chat.id)
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
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.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.ForumTopic
|
||||||
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = execute(
|
||||||
|
UnpinAllForumTopicMessages(
|
||||||
|
chatId,
|
||||||
|
messageThreadId
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
|
chat: Chat,
|
||||||
|
messageThreadId: MessageThreadId
|
||||||
|
) = unpinAllForumTopicMessages(chat.id, messageThreadId)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
|
chat: Chat,
|
||||||
|
forumTopic: ForumTopic
|
||||||
|
) = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)
|
||||||
@@ -2,11 +2,28 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.get.GetChat
|
import dev.inmo.tgbotapi.requests.chat.get.GetChat
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.*
|
import dev.inmo.tgbotapi.types.chat.ChannelChat
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.*
|
import dev.inmo.tgbotapi.types.chat.ChannelChatImpl
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.extended.*
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.chat.extended.*
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedUser
|
||||||
|
import dev.inmo.tgbotapi.types.chat.GroupChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.GroupChatImpl
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PrivateChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PrivateChatImpl
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.SupergroupChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
|
||||||
import dev.inmo.tgbotapi.utils.PreviewFeature
|
import dev.inmo.tgbotapi.utils.PreviewFeature
|
||||||
|
|
||||||
suspend fun TelegramBot.getChat(
|
suspend fun TelegramBot.getChat(
|
||||||
@@ -18,7 +35,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
) = getChat(chat.id)
|
) = getChat(chat.id)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedPublicChat] with unsafe operator "as"
|
* [ExtendedPublicChat] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -30,7 +47,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedChannelChat] with unsafe operator "as"
|
* [ExtendedChannelChat] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -41,7 +58,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
) = getChat(chat.id) as ExtendedChannelChat
|
) = getChat(chat.id) as ExtendedChannelChat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedChannelChatImpl] with unsafe operator "as"
|
* [ExtendedChannelChatImpl] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -53,7 +70,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedGroupChat] with unsafe operator "as"
|
* [ExtendedGroupChat] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -64,7 +81,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
) = getChat(chat.id) as ExtendedGroupChat
|
) = getChat(chat.id) as ExtendedGroupChat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedGroupChatImpl] with unsafe operator "as"
|
* [ExtendedGroupChatImpl] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -76,7 +93,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedSupergroupChat] with unsafe operator "as"
|
* [ExtendedSupergroupChat] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -87,7 +104,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
) = getChat(chat.id) as ExtendedSupergroupChat
|
) = getChat(chat.id) as ExtendedSupergroupChat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedSupergroupChatImpl] with unsafe operator "as"
|
* [ExtendedSupergroupChatImpl] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -99,7 +116,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedPrivateChat] with unsafe operator "as"
|
* [ExtendedPrivateChat] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -110,7 +127,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
) = getChat(chat.id) as ExtendedPrivateChat
|
) = getChat(chat.id) as ExtendedPrivateChat
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedPrivateChatImpl] with unsafe operator "as"
|
* [ExtendedPrivateChatImpl] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
@@ -121,7 +138,7 @@ suspend fun TelegramBot.getChat(
|
|||||||
) = getChat(chat.id) as ExtendedPrivateChatImpl
|
) = getChat(chat.id) as ExtendedPrivateChatImpl
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.abstracts.extended.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedUser] with unsafe operator "as"
|
* [ExtendedUser] with unsafe operator "as"
|
||||||
*
|
*
|
||||||
* @throws ClassCastException
|
* @throws ClassCastException
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.get.GetChatAdministrators
|
import dev.inmo.tgbotapi.requests.chat.get.GetChatAdministrators
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.getChatAdministrators(
|
suspend fun TelegramBot.getChatAdministrators(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.get.GetChatMemberCount
|
import dev.inmo.tgbotapi.requests.chat.get.GetChatMemberCount
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.getChatMemberCount(
|
suspend fun TelegramBot.getChatMemberCount(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
|
|||||||
@@ -2,12 +2,11 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.get.GetChatMenuButton
|
import dev.inmo.tgbotapi.requests.chat.get.GetChatMenuButton
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.chat.PrivateChat
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PrivateChat
|
|
||||||
|
|
||||||
suspend fun TelegramBot.getChatMenuButton(
|
suspend fun TelegramBot.getChatMenuButton(
|
||||||
chatId: ChatId
|
chatId: IdChatIdentifier
|
||||||
) = execute(GetChatMenuButton(chatId))
|
) = execute(GetChatMenuButton(chatId))
|
||||||
|
|
||||||
suspend fun TelegramBot.getChatMenuButton(
|
suspend fun TelegramBot.getChatMenuButton(
|
||||||
|
|||||||
@@ -2,7 +2,5 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.get.GetDefaultChatMenuButton
|
import dev.inmo.tgbotapi.requests.chat.get.GetDefaultChatMenuButton
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.SetDefaultChatMenuButton
|
|
||||||
import dev.inmo.tgbotapi.types.MenuButton
|
|
||||||
|
|
||||||
suspend fun TelegramBot.getDefaultChatMenuButton() = execute(GetDefaultChatMenuButton)
|
suspend fun TelegramBot.getDefaultChatMenuButton() = execute(GetDefaultChatMenuButton)
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.get
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.get.GetForumTopicIconStickers
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getForumTopicIconStickers() = execute(GetForumTopicIconStickers)
|
||||||
@@ -2,8 +2,11 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.invite_links.ApproveChatJoinRequest
|
import dev.inmo.tgbotapi.requests.chat.invite_links.ApproveChatJoinRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||||
|
|
||||||
suspend fun TelegramBot.approveChatJoinRequest(
|
suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
|
|||||||
@@ -3,8 +3,11 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
|||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.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.*
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.MembersLimit
|
||||||
|
import dev.inmo.tgbotapi.types.TelegramDate
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.toTelegramDate
|
||||||
|
|
||||||
suspend fun TelegramBot.createChatInviteLinkUnlimited(
|
suspend fun TelegramBot.createChatInviteLinkUnlimited(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.invite_links.ApproveChatJoinRequest
|
|
||||||
import dev.inmo.tgbotapi.requests.chat.invite_links.DeclineChatJoinRequest
|
import dev.inmo.tgbotapi.requests.chat.invite_links.DeclineChatJoinRequest
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ChatJoinRequest
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||||
|
|
||||||
suspend fun TelegramBot.declineChatJoinRequest(
|
suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
|
|||||||
@@ -3,8 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
|||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.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.*
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.ChatInviteLink
|
||||||
|
import dev.inmo.tgbotapi.types.MembersLimit
|
||||||
|
import dev.inmo.tgbotapi.types.TelegramDate
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.toTelegramDate
|
||||||
|
|
||||||
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.chat.invite_links.RevokeChatInviteLink
|
import dev.inmo.tgbotapi.requests.chat.invite_links.RevokeChatInviteLink
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.ChatInviteLink
|
import dev.inmo.tgbotapi.types.ChatInviteLink
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.revokeChatInviteLink(
|
suspend fun TelegramBot.revokeChatInviteLink(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
|||||||
@@ -2,8 +2,12 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.BanChatMember
|
import dev.inmo.tgbotapi.requests.chat.members.BanChatMember
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
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.banChatMember(
|
suspend fun TelegramBot.banChatMember(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -20,7 +24,7 @@ suspend fun TelegramBot.banChatMember(
|
|||||||
) = banChatMember(chat.id, userId, untilDate, revokeMessages)
|
) = banChatMember(chat.id, userId, untilDate, revokeMessages)
|
||||||
|
|
||||||
suspend fun TelegramBot.banChatMember(
|
suspend fun TelegramBot.banChatMember(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
revokeMessages: Boolean? = null
|
revokeMessages: Boolean? = null
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.chat.members
|
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.BanChatMember
|
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.BanChatSenderChat
|
import dev.inmo.tgbotapi.requests.chat.members.BanChatSenderChat
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.banChatSenderChat(
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
senderChatId: ChatId
|
senderChatId: IdChatIdentifier
|
||||||
) = execute(BanChatSenderChat(chatId, senderChatId))
|
) = execute(BanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
suspend fun TelegramBot.banChatSenderChat(
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
senderChatId: ChatId
|
senderChatId: IdChatIdentifier
|
||||||
) = banChatSenderChat(chat.id, senderChatId)
|
) = banChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
suspend fun TelegramBot.banChatSenderChat(
|
suspend fun TelegramBot.banChatSenderChat(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
senderChat: PublicChat
|
senderChat: PublicChat
|
||||||
) = banChatSenderChat(chatId, senderChat.id)
|
) = banChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.GetChatMember
|
import dev.inmo.tgbotapi.requests.chat.members.GetChatMember
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
|
||||||
suspend fun TelegramBot.getChatMember(
|
suspend fun TelegramBot.getChatMember(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -16,7 +19,7 @@ suspend fun TelegramBot.getChatMember(
|
|||||||
) = getChatMember(chat.id, userId)
|
) = getChatMember(chat.id, userId)
|
||||||
|
|
||||||
suspend fun TelegramBot.getChatMember(
|
suspend fun TelegramBot.getChatMember(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
user: User
|
user: User
|
||||||
) = getChatMember(chatId, user.id)
|
) = getChatMember(chatId, user.id)
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,12 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
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.promoteChatMember(
|
suspend fun TelegramBot.promoteChatMember(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -19,7 +23,8 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages: Boolean? = null,
|
canPinMessages: Boolean? = null,
|
||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean?
|
canManageChat: Boolean? = null,
|
||||||
|
canManageTopics: Boolean? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
PromoteChatMember(
|
PromoteChatMember(
|
||||||
chatId,
|
chatId,
|
||||||
@@ -35,7 +40,8 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages,
|
canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats,
|
||||||
canManageChat
|
canManageChat,
|
||||||
|
canManageTopics
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,7 +59,8 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages: Boolean? = null,
|
canPinMessages: Boolean? = null,
|
||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null
|
canManageChat: Boolean? = null,
|
||||||
|
canManageTopics: Boolean? = null
|
||||||
) = promoteChatMember(
|
) = promoteChatMember(
|
||||||
chat.id,
|
chat.id,
|
||||||
userId,
|
userId,
|
||||||
@@ -68,11 +75,12 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages,
|
canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats,
|
||||||
canManageChat
|
canManageChat,
|
||||||
|
canManageTopics
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.promoteChatMember(
|
suspend fun TelegramBot.promoteChatMember(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
isAnonymous: Boolean? = null,
|
isAnonymous: Boolean? = null,
|
||||||
@@ -85,7 +93,8 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages: Boolean? = null,
|
canPinMessages: Boolean? = null,
|
||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null
|
canManageChat: Boolean? = null,
|
||||||
|
canManageTopics: Boolean? = null
|
||||||
) = promoteChatMember(
|
) = promoteChatMember(
|
||||||
chatId,
|
chatId,
|
||||||
user.id,
|
user.id,
|
||||||
@@ -100,7 +109,8 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages,
|
canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats,
|
||||||
canManageChat
|
canManageChat,
|
||||||
|
canManageTopics
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.promoteChatMember(
|
suspend fun TelegramBot.promoteChatMember(
|
||||||
@@ -117,7 +127,8 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages: Boolean? = null,
|
canPinMessages: Boolean? = null,
|
||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null
|
canManageChat: Boolean? = null,
|
||||||
|
canManageTopics: Boolean? = null
|
||||||
) = promoteChatMember(
|
) = promoteChatMember(
|
||||||
chat.id,
|
chat.id,
|
||||||
user.id,
|
user.id,
|
||||||
@@ -132,5 +143,6 @@ suspend fun TelegramBot.promoteChatMember(
|
|||||||
canPinMessages,
|
canPinMessages,
|
||||||
canPromoteMembers,
|
canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats,
|
||||||
canManageChat
|
canManageChat,
|
||||||
|
canManageTopics
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,35 +2,43 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.RestrictChatMember
|
import dev.inmo.tgbotapi.requests.chat.members.RestrictChatMember
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.TelegramDate
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
import dev.inmo.tgbotapi.types.chat.ChatPermissions
|
import dev.inmo.tgbotapi.types.chat.ChatPermissions
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
|
||||||
suspend fun TelegramBot.restrictChatMember(
|
suspend fun TelegramBot.restrictChatMember(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions()
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
) = execute(RestrictChatMember(chatId, userId, untilDate, permissions))
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
|
) = execute(RestrictChatMember(chatId, userId, untilDate, permissions, useIndependentChatPermissions))
|
||||||
|
|
||||||
suspend fun TelegramBot.restrictChatMember(
|
suspend fun TelegramBot.restrictChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions()
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
) = restrictChatMember(chat.id, userId, untilDate, permissions)
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
|
) = restrictChatMember(chat.id, userId, untilDate, permissions, useIndependentChatPermissions)
|
||||||
|
|
||||||
suspend fun TelegramBot.restrictChatMember(
|
suspend fun TelegramBot.restrictChatMember(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions()
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
) = restrictChatMember(chatId, user.id, untilDate, permissions)
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
|
) = restrictChatMember(chatId, user.id, untilDate, permissions, useIndependentChatPermissions)
|
||||||
|
|
||||||
suspend fun TelegramBot.restrictChatMember(
|
suspend fun TelegramBot.restrictChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User,
|
user: User,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions()
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
) = restrictChatMember(chat.id, user.id, untilDate, permissions)
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
|
) = restrictChatMember(chat.id, user.id, untilDate, permissions, useIndependentChatPermissions)
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.SetChatAdministratorCustomTitle
|
import dev.inmo.tgbotapi.requests.chat.members.SetChatAdministratorCustomTitle
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
|
||||||
suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
customTitle: String
|
customTitle: String
|
||||||
) = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
|
) = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
|
||||||
@@ -18,7 +20,7 @@ suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
|||||||
) = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
|
) = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
|
||||||
|
|
||||||
suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
customTitle: String
|
customTitle: String
|
||||||
) = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
|
) = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
|
||||||
@@ -27,4 +29,4 @@ suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
|||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User,
|
user: User,
|
||||||
customTitle: String
|
customTitle: String
|
||||||
) = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)
|
) = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.UnbanChatMember
|
import dev.inmo.tgbotapi.requests.chat.members.UnbanChatMember
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
|
||||||
suspend fun TelegramBot.unbanChatMember(
|
suspend fun TelegramBot.unbanChatMember(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
@@ -18,7 +21,7 @@ suspend fun TelegramBot.unbanChatMember(
|
|||||||
) = unbanChatMember(chat.id, userId, onlyIfBanned)
|
) = unbanChatMember(chat.id, userId, onlyIfBanned)
|
||||||
|
|
||||||
suspend fun TelegramBot.unbanChatMember(
|
suspend fun TelegramBot.unbanChatMember(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
onlyIfBanned: Boolean? = null
|
onlyIfBanned: Boolean? = null
|
||||||
) = unbanChatMember(chatId, user.id, onlyIfBanned)
|
) = unbanChatMember(chatId, user.id, onlyIfBanned)
|
||||||
|
|||||||
@@ -1,22 +1,23 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.chat.members
|
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.*
|
import dev.inmo.tgbotapi.requests.chat.members.UnbanChatSenderChat
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.unbanChatSenderChat(
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
senderChatId: ChatId
|
senderChatId: IdChatIdentifier
|
||||||
) = execute(UnbanChatSenderChat(chatId, senderChatId))
|
) = execute(UnbanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
suspend fun TelegramBot.unbanChatSenderChat(
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
senderChatId: ChatId
|
senderChatId: IdChatIdentifier
|
||||||
) = unbanChatSenderChat(chat.id, senderChatId)
|
) = unbanChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
suspend fun TelegramBot.unbanChatSenderChat(
|
suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
senderChat: PublicChat
|
senderChat: PublicChat
|
||||||
) = unbanChatSenderChat(chatId, senderChat.id)
|
) = unbanChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.modify
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.DeleteChatPhoto
|
import dev.inmo.tgbotapi.requests.chat.modify.DeleteChatPhoto
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteChatPhoto(
|
suspend fun TelegramBot.deleteChatPhoto(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
|
|||||||
@@ -3,19 +3,19 @@ package dev.inmo.tgbotapi.extensions.api.chat.modify
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.PinChatMessage
|
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.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
|
||||||
suspend fun TelegramBot.pinChatMessage(
|
suspend fun TelegramBot.pinChatMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
) = execute(PinChatMessage(chatId, messageId, disableNotification))
|
) = execute(PinChatMessage(chatId, messageId, disableNotification))
|
||||||
|
|
||||||
suspend fun TelegramBot.pinChatMessage(
|
suspend fun TelegramBot.pinChatMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
) = pinChatMessage(chat.id, messageId, disableNotification)
|
) = pinChatMessage(chat.id, messageId, disableNotification)
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.modify
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.SetChatDescription
|
import dev.inmo.tgbotapi.requests.chat.modify.SetChatDescription
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.setChatDescription(
|
suspend fun TelegramBot.setChatDescription(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.chat.modify
|
package dev.inmo.tgbotapi.extensions.api.chat.modify
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.*
|
import dev.inmo.tgbotapi.requests.chat.modify.SetChatMenuButton
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PrivateChat
|
import dev.inmo.tgbotapi.types.MenuButton
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PrivateChat
|
||||||
|
|
||||||
suspend fun TelegramBot.setChatMenuButton(
|
suspend fun TelegramBot.setChatMenuButton(
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
menuButton: MenuButton
|
menuButton: MenuButton
|
||||||
) = execute(SetChatMenuButton(chatId, menuButton))
|
) = execute(SetChatMenuButton(chatId, menuButton))
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,16 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.chat.modify.SetChatPermissions
|
import dev.inmo.tgbotapi.requests.chat.modify.SetChatPermissions
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.ChatPermissions
|
import dev.inmo.tgbotapi.types.chat.ChatPermissions
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.setDefaultChatMembersPermissions(
|
suspend fun TelegramBot.setDefaultChatMembersPermissions(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
permissions: ChatPermissions
|
permissions: ChatPermissions,
|
||||||
) = execute(SetChatPermissions(chatId, permissions))
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
|
) = execute(SetChatPermissions(chatId, permissions, useIndependentChatPermissions))
|
||||||
|
|
||||||
suspend fun TelegramBot.setDefaultChatMembersPermissions(
|
suspend fun TelegramBot.setDefaultChatMembersPermissions(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
permissions: ChatPermissions
|
permissions: ChatPermissions,
|
||||||
) = setDefaultChatMembersPermissions(chat.id, permissions)
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
|
) = setDefaultChatMembersPermissions(chat.id, permissions, useIndependentChatPermissions)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.SetChatPhoto
|
import dev.inmo.tgbotapi.requests.chat.modify.SetChatPhoto
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.setChatPhoto(
|
suspend fun TelegramBot.setChatPhoto(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.modify
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.SetChatTitle
|
import dev.inmo.tgbotapi.requests.chat.modify.SetChatTitle
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.PublicChat
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
|
||||||
suspend fun TelegramBot.setChatTitle(
|
suspend fun TelegramBot.setChatTitle(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.modify
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.UnpinAllChatMessages
|
import dev.inmo.tgbotapi.requests.chat.modify.UnpinAllChatMessages
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinAllChatMessages(
|
suspend fun TelegramBot.unpinAllChatMessages(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
|
|||||||
@@ -3,18 +3,18 @@ package dev.inmo.tgbotapi.extensions.api.chat.modify
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.modify.UnpinChatMessage
|
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.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier? = null
|
messageId: MessageId? = null
|
||||||
) = execute(UnpinChatMessage(chatId, messageId))
|
) = execute(UnpinChatMessage(chatId, messageId))
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier? = null
|
messageId: MessageId? = null
|
||||||
) = unpinChatMessage(chat.id, messageId)
|
) = unpinChatMessage(chat.id, messageId)
|
||||||
|
|
||||||
suspend fun TelegramBot.unpinChatMessage(
|
suspend fun TelegramBot.unpinChatMessage(
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.chat.stickers
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.chat.stickers.DeleteChatStickerSet
|
import dev.inmo.tgbotapi.requests.chat.stickers.DeleteChatStickerSet
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.SupergroupChat
|
import dev.inmo.tgbotapi.types.chat.SupergroupChat
|
||||||
|
|
||||||
suspend fun TelegramBot.deleteChatStickerSet(
|
suspend fun TelegramBot.deleteChatStickerSet(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.requests.chat.stickers.SetChatStickerSet
|
import dev.inmo.tgbotapi.requests.chat.stickers.SetChatStickerSet
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.StickerSetName
|
import dev.inmo.tgbotapi.types.StickerSetName
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.SupergroupChat
|
import dev.inmo.tgbotapi.types.chat.SupergroupChat
|
||||||
|
|
||||||
suspend fun TelegramBot.setChatStickerSet(
|
suspend fun TelegramBot.setChatStickerSet(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
|
|||||||
@@ -0,0 +1,308 @@
|
|||||||
|
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 <T> TelegramBot.edit(
|
||||||
|
message: ContentMessage<T>,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
|
||||||
|
return editMessageCaption(message, text, parseMode, replyMarkup)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun <T> TelegramBot.edit(
|
||||||
|
message: ContentMessage<T>,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
|
||||||
|
return editMessageCaption(message, entities, replyMarkup)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
horizontalAccuracy: Meters? = null,
|
||||||
|
heading: Degrees? = null,
|
||||||
|
proximityAlertRadius: Meters? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(chatId, 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(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
horizontalAccuracy: Meters? = null,
|
||||||
|
heading: Degrees? = null,
|
||||||
|
proximityAlertRadius: Meters? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(chat, 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(
|
||||||
|
message: ContentMessage<LocationContent>,
|
||||||
|
latitude: Double,
|
||||||
|
longitude: Double,
|
||||||
|
horizontalAccuracy: Meters? = null,
|
||||||
|
heading: Degrees? = null,
|
||||||
|
proximityAlertRadius: Meters? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(message, 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(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
location: LiveLocation,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(
|
||||||
|
chatId, 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(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
location: LiveLocation,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(chat, 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(
|
||||||
|
message: ContentMessage<LocationContent>,
|
||||||
|
location: LiveLocation,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editLiveLocation(message, location, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
media: TelegramMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageMedia(chatId, 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(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
media: TelegramMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageMedia(chat, 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(
|
||||||
|
message: ContentMessage<MediaContent>,
|
||||||
|
media: TelegramMedia,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageMedia(message, media, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageReplyMarkup(chatId, messageId, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageReplyMarkup(chat, messageId, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
message: Message,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageReplyMarkup(message, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
text: String,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = edit(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = edit(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.edit(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = edit(message, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.edit.caption
|
package dev.inmo.tgbotapi.extensions.api.edit.caption
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.CommonAbstracts.TextedWithTextSources
|
import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.caption.EditChatMessageCaption
|
import dev.inmo.tgbotapi.requests.edit.caption.EditChatMessageCaption
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.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.abstracts.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.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
import dev.inmo.tgbotapi.utils.RiskFeature
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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]
|
||||||
@@ -19,7 +21,7 @@ import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageCaption(
|
suspend fun TelegramBot.editMessageCaption(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
@@ -33,7 +35,7 @@ suspend fun TelegramBot.editMessageCaption(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageCaption(
|
suspend fun TelegramBot.editMessageCaption(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
@@ -48,8 +50,9 @@ suspend fun <T> TelegramBot.editMessageCaption(
|
|||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
|
||||||
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup)
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup) as ContentMessage<T>
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,7 +61,7 @@ suspend fun <T> TelegramBot.editMessageCaption(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageCaption(
|
suspend fun TelegramBot.editMessageCaption(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
@@ -71,7 +74,7 @@ suspend fun TelegramBot.editMessageCaption(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageCaption(
|
suspend fun TelegramBot.editMessageCaption(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
entities: List<TextSource>,
|
entities: List<TextSource>,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageCaption(chat.id, messageId, entities, replyMarkup)
|
) = editMessageCaption(chat.id, messageId, entities, replyMarkup)
|
||||||
@@ -84,6 +87,20 @@ suspend fun <T> TelegramBot.editMessageCaption(
|
|||||||
message: ContentMessage<T>,
|
message: ContentMessage<T>,
|
||||||
entities: List<TextSource>,
|
entities: List<TextSource>,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
): ContentMessage<T> where T : TextedWithTextSources, T : MediaContent {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
|
return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup) as ContentMessage<T>
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
@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(
|
||||||
|
message: Message,
|
||||||
|
entities: List<TextSource>,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
): ContentMessage<MediaContent> where T : TextedWithTextSources, T : MediaContent {
|
||||||
return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup)
|
return editMessageCaption(message.chat.id, message.messageId, entities, replyMarkup)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ package dev.inmo.tgbotapi.extensions.api.edit.caption
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption
|
import dev.inmo.tgbotapi.requests.edit.caption.EditInlineMessageCaption
|
||||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
|
package dev.inmo.tgbotapi.extensions.api.edit.location.live
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.LiveLocation.EditChatMessageLiveLocation
|
import dev.inmo.tgbotapi.requests.edit.location.live.EditChatMessageLiveLocation
|
||||||
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.abstracts.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.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
@@ -15,7 +15,7 @@ import dev.inmo.tgbotapi.types.message.content.LocationContent
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editLiveLocation(
|
suspend fun TelegramBot.editLiveLocation(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
horizontalAccuracy: Meters? = null,
|
horizontalAccuracy: Meters? = null,
|
||||||
@@ -34,7 +34,7 @@ suspend fun TelegramBot.editLiveLocation(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editLiveLocation(
|
suspend fun TelegramBot.editLiveLocation(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
latitude: Double,
|
latitude: Double,
|
||||||
longitude: Double,
|
longitude: Double,
|
||||||
horizontalAccuracy: Meters? = null,
|
horizontalAccuracy: Meters? = null,
|
||||||
@@ -63,7 +63,7 @@ suspend fun TelegramBot.editLiveLocation(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editLiveLocation(
|
suspend fun TelegramBot.editLiveLocation(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
location: LiveLocation,
|
location: LiveLocation,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
@@ -78,7 +78,7 @@ suspend fun TelegramBot.editLiveLocation(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editLiveLocation(
|
suspend fun TelegramBot.editLiveLocation(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
location: LiveLocation,
|
location: LiveLocation,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
|
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, location.horizontalAccuracy, location.heading, location.proximityAlertRadius, replyMarkup)
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
|
package dev.inmo.tgbotapi.extensions.api.edit.location.live
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.LiveLocation.EditInlineMessageLiveLocation
|
import dev.inmo.tgbotapi.requests.edit.location.live.EditInlineMessageLiveLocation
|
||||||
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.location.LiveLocation
|
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
|
package dev.inmo.tgbotapi.extensions.api.edit.location.live
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.LiveLocation.StopChatMessageLiveLocation
|
import dev.inmo.tgbotapi.requests.edit.location.live.StopChatMessageLiveLocation
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
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.abstracts.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.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ import dev.inmo.tgbotapi.types.message.content.LocationContent
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopLiveLocation(
|
suspend fun TelegramBot.stopLiveLocation(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
StopChatMessageLiveLocation(
|
StopChatMessageLiveLocation(
|
||||||
@@ -29,7 +29,7 @@ suspend fun TelegramBot.stopLiveLocation(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.stopLiveLocation(
|
suspend fun TelegramBot.stopLiveLocation(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = stopLiveLocation(chat.id, messageId, replyMarkup)
|
) = stopLiveLocation(chat.id, messageId, replyMarkup)
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.edit.LiveLocation
|
package dev.inmo.tgbotapi.extensions.api.edit.location.live
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.LiveLocation.StopInlineMessageLiveLocation
|
import dev.inmo.tgbotapi.requests.edit.location.live.StopInlineMessageLiveLocation
|
||||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
|
||||||
@@ -3,12 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.edit.media
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.media.EditChatMessageMedia
|
import dev.inmo.tgbotapi.requests.edit.media.EditChatMessageMedia
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMedia
|
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
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.abstracts.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.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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]
|
||||||
@@ -16,8 +16,8 @@ import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageMedia(
|
suspend fun TelegramBot.editMessageMedia(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
media: InputMedia,
|
media: TelegramMedia,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
EditChatMessageMedia(chatId, messageId, media, replyMarkup)
|
EditChatMessageMedia(chatId, messageId, media, replyMarkup)
|
||||||
@@ -29,8 +29,8 @@ suspend fun TelegramBot.editMessageMedia(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageMedia(
|
suspend fun TelegramBot.editMessageMedia(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
media: InputMedia,
|
media: TelegramMedia,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageMedia(chat.id, messageId, media, replyMarkup)
|
) = editMessageMedia(chat.id, messageId, media, replyMarkup)
|
||||||
|
|
||||||
@@ -40,6 +40,6 @@ suspend fun TelegramBot.editMessageMedia(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageMedia(
|
suspend fun TelegramBot.editMessageMedia(
|
||||||
message: ContentMessage<out MediaContent>,
|
message: ContentMessage<out MediaContent>,
|
||||||
media: InputMedia,
|
media: TelegramMedia,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageMedia(message.chat.id, message.messageId, media, replyMarkup)
|
) = editMessageMedia(message.chat.id, message.messageId, media, replyMarkup)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.edit.media
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.media.EditInlineMessageMedia
|
import dev.inmo.tgbotapi.requests.edit.media.EditInlineMessageMedia
|
||||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.InputMedia
|
import dev.inmo.tgbotapi.types.media.TelegramMedia
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,6 +12,6 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageCaption(
|
suspend fun TelegramBot.editMessageCaption(
|
||||||
inlineMessageId: InlineMessageIdentifier,
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
media: InputMedia,
|
media: TelegramMedia,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))
|
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.edit.ReplyMarkup
|
package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.ReplyMarkup.EditChatMessageReplyMarkup
|
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditChatMessageReplyMarkup
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
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.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +14,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageReplyMarkup(
|
suspend fun TelegramBot.editMessageReplyMarkup(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
EditChatMessageReplyMarkup(chatId, messageId, replyMarkup)
|
EditChatMessageReplyMarkup(chatId, messageId, replyMarkup)
|
||||||
@@ -26,7 +26,7 @@ suspend fun TelegramBot.editMessageReplyMarkup(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageReplyMarkup(
|
suspend fun TelegramBot.editMessageReplyMarkup(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
|
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
|
||||||
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.edit.ReplyMarkup
|
package dev.inmo.tgbotapi.extensions.api.edit.reply_markup
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.edit.ReplyMarkup.EditInlineMessageReplyMarkup
|
import dev.inmo.tgbotapi.requests.edit.reply_markup.EditInlineMessageReplyMarkup
|
||||||
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
import dev.inmo.tgbotapi.types.InlineMessageIdentifier
|
||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
|
|
||||||
@@ -3,13 +3,16 @@ 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.MessageEntity.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.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.abstracts.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.content.TextContent
|
import dev.inmo.tgbotapi.types.message.content.TextContent
|
||||||
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
|
import dev.inmo.tgbotapi.utils.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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]
|
||||||
@@ -17,7 +20,7 @@ import dev.inmo.tgbotapi.types.message.content.TextContent
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
@@ -32,7 +35,7 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
text: String,
|
text: String,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
@@ -57,7 +60,7 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
@@ -65,18 +68,70 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
EditChatMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
|
EditChatMessageText(chatId, messageId, entities, disableWebPagePreview, replyMarkup)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(chatId, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
*/
|
*/
|
||||||
suspend fun TelegramBot.editMessageText(
|
suspend fun TelegramBot.editMessageText(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(chat.id, messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(chat.id, messageId, entities, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(chat.id, messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
* as a builder for that
|
* as a builder for that
|
||||||
@@ -87,3 +142,65 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
message: ContentMessage<TextContent>,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
@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(
|
||||||
|
message: Message,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
|
) = editMessageText(message.chat.id, message.messageId, entities, disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
@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(
|
||||||
|
message: Message,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
@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(
|
||||||
|
message: Message,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(message.chat.id, message.messageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|||||||
@@ -3,9 +3,12 @@ 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.MessageEntity.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.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.message.textsources.TextSource
|
||||||
|
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]
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
@@ -29,3 +32,27 @@ suspend fun TelegramBot.editMessageText(
|
|||||||
disableWebPagePreview: Boolean? = null,
|
disableWebPagePreview: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = execute(EditInlineMessageText(inlineMessageId, entities, disableWebPagePreview, replyMarkup))
|
) = execute(EditInlineMessageText(inlineMessageId, entities, disableWebPagePreview, replyMarkup))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.editMessageText(
|
||||||
|
inlineMessageId: InlineMessageIdentifier,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
replyMarkup: InlineKeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = editMessageText(inlineMessageId, buildEntities(separator, builderBody), disableWebPagePreview, replyMarkup)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
|||||||
import dev.inmo.tgbotapi.requests.DownloadFile
|
import dev.inmo.tgbotapi.requests.DownloadFile
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFile(
|
suspend fun TelegramBot.downloadFile(
|
||||||
filePath: String
|
filePath: String
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
|||||||
import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStream(
|
suspend fun TelegramBot.downloadFileStream(
|
||||||
filePath: String
|
filePath: String
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import dev.inmo.tgbotapi.extensions.api.get.getFileAdditionalInfo
|
|||||||
import dev.inmo.tgbotapi.requests.DownloadFileStream
|
import dev.inmo.tgbotapi.requests.DownloadFileStream
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.types.files.PathedFile
|
import dev.inmo.tgbotapi.types.files.PathedFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.downloadFileStreamAllocator(
|
suspend fun TelegramBot.downloadFileStreamAllocator(
|
||||||
filePath: String
|
filePath: String
|
||||||
|
|||||||
@@ -3,22 +3,23 @@ package dev.inmo.tgbotapi.extensions.api.games
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.games.GetGameHighScoresByChat
|
import dev.inmo.tgbotapi.requests.games.GetGameHighScoresByChat
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.GameContent
|
import dev.inmo.tgbotapi.types.message.content.GameContent
|
||||||
|
|
||||||
suspend fun TelegramBot.getGameScore(
|
suspend fun TelegramBot.getGameScore(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
messageId: MessageIdentifier
|
messageId: MessageId
|
||||||
) = execute(
|
) = execute(
|
||||||
GetGameHighScoresByChat(userId, chatId, messageId)
|
GetGameHighScoresByChat(userId, chatId, messageId)
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend fun TelegramBot.getGameScore(
|
suspend fun TelegramBot.getGameScore(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
messageId: MessageIdentifier
|
messageId: MessageId
|
||||||
) = getGameScore(
|
) = getGameScore(
|
||||||
user.id, chatId, messageId
|
user.id, chatId, messageId
|
||||||
)
|
)
|
||||||
@@ -26,7 +27,7 @@ suspend fun TelegramBot.getGameScore(
|
|||||||
suspend fun TelegramBot.getGameScore(
|
suspend fun TelegramBot.getGameScore(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier
|
messageId: MessageId
|
||||||
) = getGameScore(
|
) = getGameScore(
|
||||||
userId, chat.id, messageId
|
userId, chat.id, messageId
|
||||||
)
|
)
|
||||||
@@ -34,7 +35,7 @@ suspend fun TelegramBot.getGameScore(
|
|||||||
suspend fun TelegramBot.getGameScore(
|
suspend fun TelegramBot.getGameScore(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier
|
messageId: MessageId
|
||||||
) = getGameScore(
|
) = getGameScore(
|
||||||
user.id, chat.id, messageId
|
user.id, chat.id, messageId
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.games
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.games.GetGameHighScoresByInlineMessageId
|
import dev.inmo.tgbotapi.requests.games.GetGameHighScoresByInlineMessageId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
|
|
||||||
suspend fun TelegramBot.getGameScore(
|
suspend fun TelegramBot.getGameScore(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
|
|||||||
@@ -3,15 +3,16 @@ package dev.inmo.tgbotapi.extensions.api.games
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.games.SetGameScoreByChatId
|
import dev.inmo.tgbotapi.requests.games.SetGameScoreByChatId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.GameContent
|
import dev.inmo.tgbotapi.types.message.content.GameContent
|
||||||
|
|
||||||
suspend fun TelegramBot.setGameScore(
|
suspend fun TelegramBot.setGameScore(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
score: Long,
|
score: Long,
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
force: Boolean = false,
|
force: Boolean = false,
|
||||||
disableEditMessage: Boolean = false
|
disableEditMessage: Boolean = false
|
||||||
) = execute(
|
) = execute(
|
||||||
@@ -21,8 +22,8 @@ suspend fun TelegramBot.setGameScore(
|
|||||||
suspend fun TelegramBot.setGameScore(
|
suspend fun TelegramBot.setGameScore(
|
||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
score: Long,
|
score: Long,
|
||||||
chatId: ChatId,
|
chatId: IdChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
force: Boolean = false,
|
force: Boolean = false,
|
||||||
disableEditMessage: Boolean = false
|
disableEditMessage: Boolean = false
|
||||||
) = setGameScore(
|
) = setGameScore(
|
||||||
@@ -33,7 +34,7 @@ suspend fun TelegramBot.setGameScore(
|
|||||||
userId: UserId,
|
userId: UserId,
|
||||||
score: Long,
|
score: Long,
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
force: Boolean = false,
|
force: Boolean = false,
|
||||||
disableEditMessage: Boolean = false
|
disableEditMessage: Boolean = false
|
||||||
) = setGameScore(
|
) = setGameScore(
|
||||||
@@ -44,7 +45,7 @@ suspend fun TelegramBot.setGameScore(
|
|||||||
user: CommonUser,
|
user: CommonUser,
|
||||||
score: Long,
|
score: Long,
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
force: Boolean = false,
|
force: Boolean = false,
|
||||||
disableEditMessage: Boolean = false
|
disableEditMessage: Boolean = false
|
||||||
) = setGameScore(
|
) = setGameScore(
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api.games
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.games.SetGameScoreByInlineMessageId
|
import dev.inmo.tgbotapi.requests.games.SetGameScoreByInlineMessageId
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
|
|
||||||
suspend fun TelegramBot.setGameScore(
|
suspend fun TelegramBot.setGameScore(
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.get
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.get.GetCustomEmojiStickers
|
||||||
|
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
||||||
|
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||||
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
import kotlin.js.JsName
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getCustomEmojiStickers(
|
||||||
|
customEmojiIds: List<CustomEmojiId>
|
||||||
|
) = execute(
|
||||||
|
GetCustomEmojiStickers(customEmojiIds)
|
||||||
|
)
|
||||||
|
|
||||||
|
@JvmName("getCustomEmojiStickersWithStringsList")
|
||||||
|
@JsName("getCustomEmojiStickersWithStringsList")
|
||||||
|
suspend fun TelegramBot.getCustomEmojiStickers(
|
||||||
|
customEmojiIds: List<String>
|
||||||
|
) = getCustomEmojiStickers(customEmojiIds.map(::CustomEmojiId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getCustomEmojiStickerOrNull(
|
||||||
|
customEmojiId: CustomEmojiId
|
||||||
|
) = getCustomEmojiStickers(listOf(customEmojiId)).firstOrNull()
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getCustomEmojiStickerOrThrow(
|
||||||
|
customEmojiId: CustomEmojiId
|
||||||
|
) = getCustomEmojiStickers(listOf(customEmojiId)).first()
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getCustomEmojiStickerOrNull(
|
||||||
|
customEmojiId: String
|
||||||
|
) = getCustomEmojiStickerOrNull(CustomEmojiId(customEmojiId))
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getCustomEmojiStickerOrThrow(
|
||||||
|
customEmojiId: String
|
||||||
|
) = getCustomEmojiStickerOrThrow(CustomEmojiId(customEmojiId))
|
||||||
@@ -3,8 +3,8 @@ package dev.inmo.tgbotapi.extensions.api.get
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
import dev.inmo.tgbotapi.requests.abstracts.FileId
|
||||||
import dev.inmo.tgbotapi.requests.get.GetFile
|
import dev.inmo.tgbotapi.requests.get.GetFile
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MediaContent
|
import dev.inmo.tgbotapi.types.message.content.MediaContent
|
||||||
|
|
||||||
suspend fun TelegramBot.getFileAdditionalInfo(
|
suspend fun TelegramBot.getFileAdditionalInfo(
|
||||||
fileId: FileId
|
fileId: FileId
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
import dev.inmo.tgbotapi.requests.get.GetStickerSet
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
|
|
||||||
suspend fun TelegramBot.getStickerSet(
|
suspend fun TelegramBot.getStickerSet(
|
||||||
name: String
|
name: String
|
||||||
@@ -10,8 +10,21 @@ suspend fun TelegramBot.getStickerSet(
|
|||||||
GetStickerSet(name)
|
GetStickerSet(name)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Deprecated("Renamed", ReplaceWith("getStickerSetOrThrow(sticker)", "dev.inmo.tgbotapi.extensions.api.get.getStickerSetOrThrow"))
|
||||||
suspend fun TelegramBot.getStickerSet(
|
suspend fun TelegramBot.getStickerSet(
|
||||||
sticker: Sticker
|
sticker: Sticker
|
||||||
) = getStickerSet(
|
) = getStickerSet(
|
||||||
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
|
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getStickerSetOrNull(
|
||||||
|
sticker: Sticker
|
||||||
|
) = sticker.stickerSetName ?.let {
|
||||||
|
getStickerSet(it)
|
||||||
|
}
|
||||||
|
|
||||||
|
suspend fun TelegramBot.getStickerSetOrThrow(
|
||||||
|
sticker: Sticker
|
||||||
|
) = getStickerSet(
|
||||||
|
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
|
||||||
|
)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.get
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.get.GetUserProfilePhotos
|
import dev.inmo.tgbotapi.requests.get.GetUserProfilePhotos
|
||||||
import dev.inmo.tgbotapi.types.CommonUser
|
import dev.inmo.tgbotapi.types.chat.CommonUser
|
||||||
import dev.inmo.tgbotapi.types.UserId
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
|
|
||||||
suspend fun TelegramBot.getUserProfilePhotos(
|
suspend fun TelegramBot.getUserProfilePhotos(
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package dev.inmo.tgbotapi.extensions.api.passport
|
|||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.SetPassportDataErrors
|
import dev.inmo.tgbotapi.requests.SetPassportDataErrors
|
||||||
import dev.inmo.tgbotapi.types.User
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
import dev.inmo.tgbotapi.types.UserId
|
import dev.inmo.tgbotapi.types.UserId
|
||||||
import dev.inmo.tgbotapi.types.message.PassportMessage
|
import dev.inmo.tgbotapi.types.message.PassportMessage
|
||||||
import dev.inmo.tgbotapi.types.passport.PassportData
|
import dev.inmo.tgbotapi.types.passport.PassportData
|
||||||
|
|||||||
@@ -3,12 +3,14 @@ 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.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -16,17 +18,30 @@ import dev.inmo.tgbotapi.types.message.abstracts.Message
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(fromChatId, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
CopyMessage(
|
||||||
|
fromChatId,
|
||||||
|
messageId,
|
||||||
|
toChatId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,16 +50,17 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChatId, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -52,16 +68,17 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChatId, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -69,48 +86,17 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChat.id, messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
|
||||||
toChatId: ChatIdentifier,
|
|
||||||
message: Message,
|
|
||||||
text: String? = null,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
|
||||||
) = copyMessage(message.chat, toChatId, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
|
||||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
|
||||||
toChat: Chat,
|
|
||||||
message: Message,
|
|
||||||
text: String? = null,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
|
||||||
replyMarkup: KeyboardMarkup? = null
|
|
||||||
) = copyMessage(message.chat, toChat, message.messageId, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,16 +105,28 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = execute(
|
) = execute(
|
||||||
CopyMessage(fromChatId, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
CopyMessage(
|
||||||
|
fromChatId,
|
||||||
|
messageId,
|
||||||
|
toChatId,
|
||||||
|
entities,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -137,15 +135,16 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChatId, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -153,15 +152,16 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChatId, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChatId, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -169,15 +169,50 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
*/
|
*/
|
||||||
suspend inline fun TelegramBot.copyMessage(
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChat.id, toChat.id, messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(fromChat.id, messageId, toChat.id, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
message: Message,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChat: Chat,
|
||||||
|
message: Message,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(message.chat, message.messageId, toChat, text, parseMode, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -187,12 +222,13 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: Message,
|
message: Message,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, toChatId, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, message.messageId, toChatId, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -202,9 +238,247 @@ suspend inline fun TelegramBot.copyMessage(
|
|||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: Message,
|
message: Message,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
replyToMessageId: MessageId? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(message.chat, toChat, message.messageId, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(message.chat, message.messageId, toChat, entities, threadId, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
CopyMessage(
|
||||||
|
fromChatId,
|
||||||
|
messageId,
|
||||||
|
toChatId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(
|
||||||
|
toChatId,
|
||||||
|
fromChat.id,
|
||||||
|
messageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChat: Chat,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(
|
||||||
|
toChat.id,
|
||||||
|
fromChatId,
|
||||||
|
messageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChat: Chat,
|
||||||
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
text: String? = null,
|
||||||
|
parseMode: ParseMode? = null,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(
|
||||||
|
toChat.id,
|
||||||
|
fromChat.id,
|
||||||
|
messageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = execute(
|
||||||
|
CopyMessage(
|
||||||
|
fromChatId,
|
||||||
|
messageId,
|
||||||
|
toChatId,
|
||||||
|
entities,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChatId: ChatIdentifier,
|
||||||
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(
|
||||||
|
toChatId,
|
||||||
|
fromChat.id,
|
||||||
|
messageId,
|
||||||
|
entities,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChat: Chat,
|
||||||
|
fromChatId: ChatIdentifier,
|
||||||
|
messageId: MessageId,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(
|
||||||
|
toChat.id,
|
||||||
|
fromChatId,
|
||||||
|
messageId,
|
||||||
|
entities,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
|
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||||
|
*/
|
||||||
|
suspend inline fun TelegramBot.copyMessage(
|
||||||
|
toChat: Chat,
|
||||||
|
fromChat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
entities: TextSourcesList,
|
||||||
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
replyToMessageId: MessageId? = null,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
) = copyMessage(
|
||||||
|
toChat.id,
|
||||||
|
fromChat.id,
|
||||||
|
messageId,
|
||||||
|
entities,
|
||||||
|
threadId,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
replyToMessageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,173 +0,0 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api.send
|
|
||||||
|
|
||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.media.sendMediaGroup
|
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.*
|
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
|
||||||
import dev.inmo.tgbotapi.types.MessageIdentifier
|
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
|
||||||
import dev.inmo.tgbotapi.types.chat.abstracts.Chat
|
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
|
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.MediaGroupContent
|
|
||||||
import dev.inmo.tgbotapi.types.update.MediaGroupUpdates.SentMediaGroupUpdate
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChatId: ChatIdentifier,
|
|
||||||
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
|
||||||
text: String? = null,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
): List<MediaGroupMessage<MediaGroupContent>> {
|
|
||||||
val first = messages.first().content.toMediaGroupMemberInputMedia().let {
|
|
||||||
if (text != null) {
|
|
||||||
when (it) {
|
|
||||||
is InputMediaAudio -> it.copy(text = text, parseMode = parseMode)
|
|
||||||
is InputMediaDocument -> it.copy(text = text, parseMode = parseMode)
|
|
||||||
is InputMediaPhoto -> it.copy(text = text, parseMode = parseMode)
|
|
||||||
is InputMediaVideo -> it.copy(text = text, parseMode = parseMode)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
it
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sendMediaGroup(
|
|
||||||
toChatId,
|
|
||||||
listOf(first) + messages.drop(1).map {
|
|
||||||
it.content.toMediaGroupMemberInputMedia()
|
|
||||||
},
|
|
||||||
disableNotification,
|
|
||||||
protectContent,
|
|
||||||
replyToMessageId,
|
|
||||||
allowSendingWithoutReply
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChat: Chat,
|
|
||||||
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
|
||||||
text: String? = null,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = copyMessages(toChat.id, messages, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChat: ChatIdentifier,
|
|
||||||
update: SentMediaGroupUpdate,
|
|
||||||
text: String? = null,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = copyMessages(toChat, update.data, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChat: Chat,
|
|
||||||
update: SentMediaGroupUpdate,
|
|
||||||
text: String? = null,
|
|
||||||
parseMode: ParseMode? = null,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = copyMessages(toChat.id, update, text, parseMode, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChatId: ChatIdentifier,
|
|
||||||
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
|
||||||
entities: TextSourcesList,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
): List<MediaGroupMessage<MediaGroupContent>> {
|
|
||||||
val first = messages.first().content.toMediaGroupMemberInputMedia().let {
|
|
||||||
when (it) {
|
|
||||||
is InputMediaAudio -> InputMediaAudio(it.file, entities, it.duration, it.performer, it.title, it.thumb)
|
|
||||||
is InputMediaDocument -> InputMediaDocument(it.file, entities, it.thumb, it.disableContentTypeDetection)
|
|
||||||
is InputMediaPhoto -> InputMediaPhoto(it.file, entities)
|
|
||||||
is InputMediaVideo -> InputMediaVideo(it.file, entities, it.width, it.height, it.duration, it.thumb)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sendMediaGroup(
|
|
||||||
toChatId,
|
|
||||||
listOf(first) + messages.drop(1).map {
|
|
||||||
it.content.toMediaGroupMemberInputMedia()
|
|
||||||
},
|
|
||||||
disableNotification,
|
|
||||||
protectContent,
|
|
||||||
replyToMessageId,
|
|
||||||
allowSendingWithoutReply
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChat: Chat,
|
|
||||||
messages: List<MediaGroupMessage<MediaGroupContent>>,
|
|
||||||
entities: TextSourcesList,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = copyMessages(toChat.id, messages, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChat: ChatIdentifier,
|
|
||||||
update: SentMediaGroupUpdate,
|
|
||||||
entities: TextSourcesList,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = copyMessages(toChat, update.data, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Send media group via [sendMediaGroup] extension with edited [entities] of first [messages] element. Other elements
|
|
||||||
* will be copied as they are
|
|
||||||
*/
|
|
||||||
suspend inline fun TelegramBot.copyMessages(
|
|
||||||
toChat: Chat,
|
|
||||||
update: SentMediaGroupUpdate,
|
|
||||||
entities: TextSourcesList,
|
|
||||||
disableNotification: Boolean = false,
|
|
||||||
protectContent: Boolean = false,
|
|
||||||
replyToMessageId: MessageIdentifier? = null,
|
|
||||||
allowSendingWithoutReply: Boolean? = null
|
|
||||||
) = copyMessages(toChat.id, update, entities, disableNotification, protectContent, replyToMessageId, allowSendingWithoutReply)
|
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
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.extensions.api.*
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.games.sendGame
|
import dev.inmo.tgbotapi.extensions.api.send.games.sendGame
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.media.*
|
import dev.inmo.tgbotapi.extensions.api.send.media.*
|
||||||
import dev.inmo.tgbotapi.extensions.api.send.payments.sendInvoice
|
import dev.inmo.tgbotapi.extensions.api.send.payments.sendInvoice
|
||||||
@@ -9,28 +10,31 @@ import dev.inmo.tgbotapi.extensions.api.send.polls.sendRegularPoll
|
|||||||
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
import dev.inmo.tgbotapi.requests.abstracts.InputFile
|
||||||
import dev.inmo.tgbotapi.requests.send.media.rawSendingMediaGroupsWarning
|
import dev.inmo.tgbotapi.requests.send.media.rawSendingMediaGroupsWarning
|
||||||
import dev.inmo.tgbotapi.types.*
|
import dev.inmo.tgbotapi.types.*
|
||||||
import dev.inmo.tgbotapi.types.InputMedia.*
|
import dev.inmo.tgbotapi.types.media.*
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSource
|
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
|
||||||
import dev.inmo.tgbotapi.types.MessageEntity.textsources.TextSourcesList
|
import dev.inmo.tgbotapi.types.message.ParseMode
|
||||||
import dev.inmo.tgbotapi.types.ParseMode.ParseMode
|
|
||||||
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.abstracts.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.files.*
|
import dev.inmo.tgbotapi.types.files.*
|
||||||
import dev.inmo.tgbotapi.types.files.abstracts.TelegramMediaFile
|
import dev.inmo.tgbotapi.types.files.TelegramMediaFile
|
||||||
import dev.inmo.tgbotapi.types.files.sticker.Sticker
|
import dev.inmo.tgbotapi.types.files.Sticker
|
||||||
import dev.inmo.tgbotapi.types.games.Game
|
import dev.inmo.tgbotapi.types.games.Game
|
||||||
import dev.inmo.tgbotapi.types.location.*
|
import dev.inmo.tgbotapi.types.location.*
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyTopicMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.*
|
import dev.inmo.tgbotapi.types.message.content.*
|
||||||
import dev.inmo.tgbotapi.types.message.content.abstracts.MessageContent
|
import dev.inmo.tgbotapi.types.message.textsources.TextSource
|
||||||
import dev.inmo.tgbotapi.types.message.content.media.*
|
|
||||||
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
import dev.inmo.tgbotapi.types.payments.LabeledPrice
|
||||||
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
|
||||||
import dev.inmo.tgbotapi.types.polls.*
|
import dev.inmo.tgbotapi.types.polls.*
|
||||||
import dev.inmo.tgbotapi.types.venue.Venue
|
import dev.inmo.tgbotapi.types.venue.Venue
|
||||||
import dev.inmo.tgbotapi.utils.RiskFeature
|
import dev.inmo.tgbotapi.utils.*
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlin.js.JsName
|
||||||
|
import kotlin.jvm.JvmName
|
||||||
|
|
||||||
|
|
||||||
// Contact
|
// Contact
|
||||||
@@ -53,6 +57,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
phoneNumber,
|
phoneNumber,
|
||||||
firstName,
|
firstName,
|
||||||
lastName,
|
lastName,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
@@ -74,6 +79,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendContact(
|
) = sendContact(
|
||||||
to.chat,
|
to.chat,
|
||||||
contact,
|
contact,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
@@ -95,7 +101,7 @@ suspend inline fun TelegramBot.replyWithDice(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendDice(to.chat, animationType, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendDice(to.chat, animationType, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||||
@@ -129,6 +135,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to.chat,
|
to.chat,
|
||||||
latitude,
|
latitude,
|
||||||
longitude,
|
longitude,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
@@ -150,6 +157,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendLocation(
|
) = sendLocation(
|
||||||
to.chat,
|
to.chat,
|
||||||
location,
|
location,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
allowSendingWithoutReply,
|
allowSendingWithoutReply,
|
||||||
@@ -178,6 +186,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
disableWebPagePreview,
|
disableWebPagePreview,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
@@ -201,6 +210,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to.chat,
|
to.chat,
|
||||||
entities,
|
entities,
|
||||||
disableWebPagePreview,
|
disableWebPagePreview,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
@@ -208,6 +218,36 @@ suspend inline fun TelegramBot.reply(
|
|||||||
replyMarkup
|
replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
to: Message,
|
||||||
|
separator: TextSource? = null,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = reply(to, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||||
|
* as a builder for that
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
to: Message,
|
||||||
|
separator: String,
|
||||||
|
disableWebPagePreview: Boolean? = null,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
|
builderBody: EntitiesBuilderBody
|
||||||
|
) = reply(to, buildEntities(separator, builderBody), disableWebPagePreview, disableNotification, protectContent, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Venue
|
// Venue
|
||||||
|
|
||||||
@@ -239,6 +279,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
foursquareType = foursquareType,
|
foursquareType = foursquareType,
|
||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
|
threadId = to.threadIdOrNull,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = to.messageId,
|
replyToMessageId = to.messageId,
|
||||||
@@ -269,6 +310,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
foursquareType = foursquareType,
|
foursquareType = foursquareType,
|
||||||
googlePlaceId = googlePlaceId,
|
googlePlaceId = googlePlaceId,
|
||||||
googlePlaceType = googlePlaceType,
|
googlePlaceType = googlePlaceType,
|
||||||
|
threadId = to.threadIdOrNull,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = to.messageId,
|
replyToMessageId = to.messageId,
|
||||||
@@ -286,6 +328,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
) = sendVenue(
|
) = sendVenue(
|
||||||
chat = to.chat,
|
chat = to.chat,
|
||||||
venue = venue,
|
venue = venue,
|
||||||
|
threadId = to.threadIdOrNull,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
replyToMessageId = to.messageId,
|
replyToMessageId = to.messageId,
|
||||||
@@ -304,7 +347,7 @@ suspend inline fun TelegramBot.replyWithGame(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
to.chat, gameShortName, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
|
to.chat, gameShortName, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithGame(
|
suspend inline fun TelegramBot.replyWithGame(
|
||||||
@@ -315,7 +358,7 @@ suspend inline fun TelegramBot.replyWithGame(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendGame(
|
) = sendGame(
|
||||||
to.chat, game.title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
|
to.chat, game.title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup
|
||||||
)
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
@@ -336,6 +379,7 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
spoilered: Boolean = false,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -349,9 +393,11 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
thumb,
|
thumb,
|
||||||
text,
|
text,
|
||||||
parseMode,
|
parseMode,
|
||||||
|
spoilered,
|
||||||
duration,
|
duration,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
@@ -364,6 +410,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
animation: AnimationFile,
|
animation: AnimationFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
spoilered: Boolean = false,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -371,12 +418,13 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(to.chat, animation, text, parseMode, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(to.chat, animation, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAnimation(
|
suspend inline fun TelegramBot.replyWithAnimation(
|
||||||
to: Message,
|
to: Message,
|
||||||
animation: InputFile,
|
animation: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
spoilered: Boolean = false,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
@@ -390,9 +438,11 @@ suspend inline fun TelegramBot.replyWithAnimation(
|
|||||||
animation,
|
animation,
|
||||||
thumb,
|
thumb,
|
||||||
entities,
|
entities,
|
||||||
|
spoilered,
|
||||||
duration,
|
duration,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
to.threadIdOrNull,
|
||||||
disableNotification,
|
disableNotification,
|
||||||
protectContent,
|
protectContent,
|
||||||
to.messageId,
|
to.messageId,
|
||||||
@@ -404,6 +454,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
to: Message,
|
to: Message,
|
||||||
animation: AnimationFile,
|
animation: AnimationFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
spoilered: Boolean = false,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -411,7 +462,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAnimation(to.chat, animation, entities, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAnimation(to.chat, animation, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
@@ -429,7 +480,7 @@ suspend inline fun TelegramBot.replyWithAudio(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, thumb, text, parseMode, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -441,7 +492,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, text, parseMode, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, text, parseMode, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithAudio(
|
suspend inline fun TelegramBot.replyWithAudio(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -455,7 +506,7 @@ suspend inline fun TelegramBot.replyWithAudio(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, thumb, entities, duration, performer, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -466,7 +517,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendAudio(to.chat, audio, entities, title, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendAudio(to.chat, audio, entities, title, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Documents
|
// Documents
|
||||||
@@ -482,7 +533,7 @@ suspend inline fun TelegramBot.replyWithDocument(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, thumb, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, thumb, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -494,7 +545,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithDocument(
|
suspend inline fun TelegramBot.replyWithDocument(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -506,7 +557,7 @@ suspend inline fun TelegramBot.replyWithDocument(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, thumb, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, thumb, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -517,7 +568,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null,
|
replyMarkup: KeyboardMarkup? = null,
|
||||||
disableContentTypeDetection: Boolean? = null
|
disableContentTypeDetection: Boolean? = null
|
||||||
) = sendDocument(to.chat, document, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
) = sendDocument(to.chat, document, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup, disableContentTypeDetection)
|
||||||
|
|
||||||
|
|
||||||
// Media Group
|
// Media Group
|
||||||
@@ -525,35 +576,35 @@ suspend inline fun TelegramBot.reply(
|
|||||||
@RiskFeature(rawSendingMediaGroupsWarning)
|
@RiskFeature(rawSendingMediaGroupsWarning)
|
||||||
suspend inline fun TelegramBot.replyWithMediaGroup(
|
suspend inline fun TelegramBot.replyWithMediaGroup(
|
||||||
to: Message,
|
to: Message,
|
||||||
media: List<MediaGroupMemberInputMedia>,
|
media: List<MediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendMediaGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
) = sendMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithPlaylist(
|
suspend inline fun TelegramBot.replyWithPlaylist(
|
||||||
to: Message,
|
to: Message,
|
||||||
media: List<AudioMediaGroupMemberInputMedia>,
|
media: List<AudioMediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendPlaylist(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
) = sendPlaylist(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithDocuments(
|
suspend inline fun TelegramBot.replyWithDocuments(
|
||||||
to: Message,
|
to: Message,
|
||||||
media: List<DocumentMediaGroupMemberInputMedia>,
|
media: List<DocumentMediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendDocumentsGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
) = sendDocumentsGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithGallery(
|
suspend inline fun TelegramBot.replyWithGallery(
|
||||||
to: Message,
|
to: Message,
|
||||||
media: List<VisualMediaGroupMemberInputMedia>,
|
media: List<VisualMediaGroupMemberTelegramMedia>,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) = sendVisualMediaGroup(to.chat, media, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
) = sendVisualMediaGroup(to.chat, media, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply)
|
||||||
|
|
||||||
|
|
||||||
// Photo
|
// Photo
|
||||||
@@ -563,64 +614,70 @@ suspend inline fun TelegramBot.replyWithPhoto(
|
|||||||
fileId: InputFile,
|
fileId: InputFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, fileId, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, fileId, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
photo: Photo,
|
photo: Photo,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, photo, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photo, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
photoSize: PhotoSize,
|
photoSize: PhotoSize,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, photoSize, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photoSize, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithPhoto(
|
suspend inline fun TelegramBot.replyWithPhoto(
|
||||||
to: Message,
|
to: Message,
|
||||||
fileId: InputFile,
|
fileId: InputFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, fileId, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, fileId, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
photo: Photo,
|
photo: Photo,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, photo, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photo, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
photoSize: PhotoSize,
|
photoSize: PhotoSize,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendPhoto(to.chat, photoSize, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendPhoto(to.chat, photoSize, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Sticker
|
// Sticker
|
||||||
@@ -632,7 +689,7 @@ suspend inline fun TelegramBot.replyWithSticker(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(to.chat, sticker, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(to.chat, sticker, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -641,7 +698,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendSticker(to.chat, sticker, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendSticker(to.chat, sticker, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Videos
|
// Videos
|
||||||
@@ -652,6 +709,7 @@ suspend inline fun TelegramBot.replyWithVideo(
|
|||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
spoilered: Boolean = false,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -659,24 +717,26 @@ suspend inline fun TelegramBot.replyWithVideo(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, thumb, text, parseMode, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, thumb, text, parseMode, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
video: VideoFile,
|
video: VideoFile,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, text, parseMode, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVideo(
|
suspend inline fun TelegramBot.replyWithVideo(
|
||||||
to: Message,
|
to: Message,
|
||||||
video: InputFile,
|
video: InputFile,
|
||||||
thumb: InputFile? = null,
|
thumb: InputFile? = null,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
spoilered: Boolean = false,
|
||||||
duration: Long? = null,
|
duration: Long? = null,
|
||||||
width: Int? = null,
|
width: Int? = null,
|
||||||
height: Int? = null,
|
height: Int? = null,
|
||||||
@@ -684,17 +744,18 @@ suspend inline fun TelegramBot.replyWithVideo(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, thumb, entities, duration, width, height, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, thumb, entities, spoilered, duration, width, height, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
video: VideoFile,
|
video: VideoFile,
|
||||||
entities: TextSourcesList,
|
entities: TextSourcesList,
|
||||||
|
spoilered: Boolean = false,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideo(to.chat, video, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideo(to.chat, video, entities, spoilered, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// VideoNotes
|
// VideoNotes
|
||||||
@@ -709,7 +770,7 @@ suspend inline fun TelegramBot.replyWithVideoNote(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(to.chat, videoNote, thumb, duration, size, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -718,7 +779,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVideoNote(to.chat, videoNote, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVideoNote(to.chat, videoNote, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Voice
|
// Voice
|
||||||
@@ -733,7 +794,7 @@ suspend inline fun TelegramBot.replyWithVoice(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, text, parseMode, duration, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, text, parseMode, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -744,7 +805,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, text, parseMode, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.replyWithVoice(
|
suspend inline fun TelegramBot.replyWithVoice(
|
||||||
@@ -756,7 +817,7 @@ suspend inline fun TelegramBot.replyWithVoice(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, entities, duration, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, entities, duration, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -766,7 +827,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendVoice(to.chat, voice, entities, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendVoice(to.chat, voice, entities, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Invoice
|
// Invoice
|
||||||
@@ -798,7 +859,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: InlineKeyboardMarkup? = null
|
replyMarkup: InlineKeyboardMarkup? = null
|
||||||
) = sendInvoice(to.chat.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendInvoice(to.chat.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
// Polls
|
// Polls
|
||||||
@@ -815,7 +876,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(to.chat, question, options, isAnonymous, isClosed, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -830,7 +891,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendRegularPoll(to.chat, poll, isClosed, question, options, isAnonymous, allowMultipleAnswers, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -846,7 +907,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -863,7 +924,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, explanation, parseMode, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -878,7 +939,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, question, options, correctOptionId, isAnonymous, isClosed, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
@@ -894,7 +955,7 @@ suspend inline fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = sendQuizPoll(to.chat, isClosed, quizPoll, question, options, correctOptionId, isAnonymous, entities, closeInfo, to.threadIdOrNull, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
||||||
|
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
@@ -945,19 +1006,31 @@ suspend inline fun TelegramBot.reply(
|
|||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
) = copyMessage(fromChatId, to.chat.id, messageId, text, parseMode, disableNotification, protectContent, to.messageId, allowSendingWithoutReply, replyMarkup)
|
) = copyMessage(
|
||||||
|
to.chat.id,
|
||||||
|
fromChatId,
|
||||||
|
messageId,
|
||||||
|
text,
|
||||||
|
parseMode,
|
||||||
|
to.threadIdOrNull,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
to.messageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
|
||||||
suspend inline fun TelegramBot.reply(
|
suspend inline fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
messageId: MessageIdentifier,
|
messageId: MessageId,
|
||||||
text: String? = null,
|
text: String? = null,
|
||||||
parseMode: ParseMode? = null,
|
parseMode: ParseMode? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
@@ -984,16 +1057,92 @@ suspend fun TelegramBot.reply(
|
|||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
|
): Message = execute(
|
||||||
|
content.createResend(
|
||||||
|
to.chat.id,
|
||||||
|
to.threadIdOrNull,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
to.messageId,
|
||||||
|
allowSendingWithoutReply,
|
||||||
|
replyMarkup
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will use [handleLiveLocation] with replying to [message] each time new message will be sent by live location update
|
||||||
|
*
|
||||||
|
* @see handleLiveLocation
|
||||||
|
*/
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
message: Message,
|
||||||
|
locationsFlow: Flow<EditLiveLocationInfo>,
|
||||||
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) = handleLiveLocation(
|
||||||
|
message.chat.id,
|
||||||
|
locationsFlow,
|
||||||
|
liveTimeMillis,
|
||||||
|
message.threadIdOrNull,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
message.messageId,
|
||||||
|
allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will use [handleLiveLocation] with replying to [message] each time new message will be sent by live location update
|
||||||
|
*
|
||||||
|
* @see handleLiveLocation
|
||||||
|
*/
|
||||||
|
@JvmName("replyLiveLocationWithLocation")
|
||||||
|
@JsName("replyLiveLocationWithLocation")
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
message: Message,
|
||||||
|
locationsFlow: Flow<Location>,
|
||||||
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
) {
|
) {
|
||||||
execute(
|
handleLiveLocation(
|
||||||
content.createResend(
|
message.chat.id,
|
||||||
to.chat.id,
|
locationsFlow,
|
||||||
disableNotification,
|
liveTimeMillis,
|
||||||
protectContent,
|
message.threadIdOrNull,
|
||||||
to.messageId,
|
disableNotification,
|
||||||
allowSendingWithoutReply,
|
protectContent,
|
||||||
replyMarkup
|
message.messageId,
|
||||||
)
|
allowSendingWithoutReply
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will use [handleLiveLocation] with replying to [message] each time new message will be sent by live location update
|
||||||
|
*
|
||||||
|
* @see handleLiveLocation
|
||||||
|
*/
|
||||||
|
@JvmName("replyLiveLocationWithLatLong")
|
||||||
|
@JsName("replyLiveLocationWithLatLong")
|
||||||
|
suspend fun TelegramBot.reply(
|
||||||
|
message: Message,
|
||||||
|
locationsFlow: Flow<Pair<Double, Double>>,
|
||||||
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
|
disableNotification: Boolean = false,
|
||||||
|
protectContent: Boolean = false,
|
||||||
|
allowSendingWithoutReply: Boolean? = null
|
||||||
|
) {
|
||||||
|
handleLiveLocation(
|
||||||
|
message.chat.id,
|
||||||
|
locationsFlow,
|
||||||
|
liveTimeMillis,
|
||||||
|
message.threadIdOrNull,
|
||||||
|
disableNotification,
|
||||||
|
protectContent,
|
||||||
|
message.messageId,
|
||||||
|
allowSendingWithoutReply
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1102,7 +1251,7 @@ suspend fun TelegramBot.reply(
|
|||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
is AudioMediaGroupContent -> reply(
|
is AudioMediaGroupPartContent -> reply(
|
||||||
to = to,
|
to = to,
|
||||||
audio = content.media,
|
audio = content.media,
|
||||||
text = text,
|
text = text,
|
||||||
@@ -1158,7 +1307,7 @@ suspend fun TelegramBot.reply(
|
|||||||
suspend fun TelegramBot.reply(
|
suspend fun TelegramBot.reply(
|
||||||
to: Message,
|
to: Message,
|
||||||
content: TextedMediaContent,
|
content: TextedMediaContent,
|
||||||
entities: List<TextSource>,
|
entities: TextSourcesList,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
@@ -1174,7 +1323,7 @@ suspend fun TelegramBot.reply(
|
|||||||
allowSendingWithoutReply = allowSendingWithoutReply,
|
allowSendingWithoutReply = allowSendingWithoutReply,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
is AudioMediaGroupContent -> reply(
|
is AudioMediaGroupPartContent -> reply(
|
||||||
to = to,
|
to = to,
|
||||||
audio = content.media,
|
audio = content.media,
|
||||||
entities = entities,
|
entities = entities,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user