mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-05-18 06:17:22 +00:00
Compare commits
380 Commits
cdf93e0d12
...
34.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 236939eab8 | |||
| d47641c39a | |||
| f3f28b6165 | |||
| 08d160cfa7 | |||
| 3ed7c8c75f | |||
| 7e1df37b87 | |||
| 97b7b3d5d7 | |||
| 62b4bc15ca | |||
| 7c2ce53713 | |||
| 035c8f469a | |||
| c982eef85b | |||
| 16e94a1e1b | |||
| 96a5508e9a | |||
| 83de9fd973 | |||
| 4a0b890697 | |||
| 0e481c3dd9 | |||
| 176d0d419a | |||
| 77bf7b6e89 | |||
| 5337f8c7cc | |||
| 57fa6fd597 | |||
| 703538a6fa | |||
| 08877a8f47 | |||
| 8d3338b79a | |||
| 243a3ca626 | |||
| 277c329ab9 | |||
| e3ae85e067 | |||
| ac51189694 | |||
| cfd74eb58c | |||
| 78c476e4c6 | |||
| a5446b5adb | |||
| 4b5aad2b85 | |||
| a0e748f9a9 | |||
| de13ddeb54 | |||
| b37dda6f47 | |||
| e604b7a3bf | |||
| 661b846a74 | |||
| ce44203941 | |||
| ba65e01c84 | |||
| 2a1bd229d6 | |||
| b30af48b8d | |||
| 083fd1b682 | |||
| a8410df038 | |||
| bd7e8ed55f | |||
| 8c6408bc2b | |||
| e5d18a421f | |||
| d3c1859338 | |||
| e6d6bbdaa0 | |||
| 75a977aebb | |||
| f48eb820bf | |||
| 9f9d890831 | |||
| da662603b0 | |||
| 2dd91f47d7 | |||
| 8eb8e5ee1f | |||
| b533bab95f | |||
| 4f97327d29 | |||
| b17d7a868a | |||
| df695ceadb | |||
| ac511d0aed | |||
| 65cd359002 | |||
| 8d7005be80 | |||
| a20368ee51 | |||
| 744149a674 | |||
| 410183e315 | |||
| 9776a2474a | |||
| aebc571307 | |||
| 26c11d9d6b | |||
| c9be5041b8 | |||
| f10cfdbe1e | |||
| 83b4d2155f | |||
| eccc687aec | |||
| 53e79b152e | |||
| b9157b1924 | |||
| e6aaa264f6 | |||
| e6cb028a71 | |||
| 10b796c88e | |||
| 62a4bf5195 | |||
| a0bb05ce4a | |||
| e02849ae5e | |||
| 4252db489a | |||
| ac05fa0fe3 | |||
| bd816b7847 | |||
| 407f2a8bf7 | |||
| 10b1c359fa | |||
| c4f2566b71 | |||
| 85fb7e42e5 | |||
| d68c70e898 | |||
| 14402f9283 | |||
| b734757062 | |||
| fd9ad8dbf1 | |||
| 734e6074ef | |||
| d642a04e01 | |||
| ecd01c9254 | |||
| 8922b80cff | |||
| 50a7c9cae2 | |||
| f7ee0828ce | |||
| 0c87cf95eb | |||
| 9fea7390e8 | |||
| 9f0ca8143c | |||
| 9d879b90bb | |||
| 2a28f8ab39 | |||
| 44ce84cb84 | |||
| cea80ccee6 | |||
| e1848aa5c9 | |||
| e40424b26a | |||
| cc5056b685 | |||
| 9713a668e2 | |||
| 90d7bdff56 | |||
| 374f6a93bd | |||
| 28b5fae760 | |||
| 97dae295d6 | |||
| 93597f3940 | |||
| f27caaecde | |||
| b71b1414b9 | |||
| f8ceab7640 | |||
| 68897c89c3 | |||
| fb08b7044e | |||
| 7ed021b5bc | |||
| 1cff533265 | |||
| 8b08e11441 | |||
| b69c8f1d8f | |||
| fdf393405c | |||
| c951fc3353 | |||
| 02f42c3f52 | |||
| 0105e46a5f | |||
| 325a189ebb | |||
| 1d021c8450 | |||
| 6eb9379e0a | |||
| 2d97d10ee1 | |||
| 4b7d052ece | |||
| df512a917b | |||
| 67cd836466 | |||
| eb1fb16117 | |||
| ee4cf7c626 | |||
| 74d8b31437 | |||
| 3f61cfdefb | |||
| 91339fc839 | |||
| 2e23f48350 | |||
| f6211d33bb | |||
| 2ff11ad73c | |||
| 2695b03968 | |||
| 03d23a938e | |||
| 719fb1f4a9 | |||
| c3c69f3e7f | |||
| 4fb662c560 | |||
| cc967c2981 | |||
| aa7bf426f1 | |||
| 0b2735ca1e | |||
| 48bfa76b9e | |||
| 79a0e202d8 | |||
| 152bf2af02 | |||
| 0163e5ce8c | |||
| 62b4a21650 | |||
| f312e04c0d | |||
| 1c36c0a2f7 | |||
| bd73852253 | |||
| fbb2511fca | |||
| f22d571484 | |||
| 9be5ebb036 | |||
| da4cd527ec | |||
| 4117288b21 | |||
| 458bdd3ee4 | |||
| 8101c4c9fb | |||
| 255416f72a | |||
| 6eb7563c70 | |||
| b9bdf7cc72 | |||
| 4a8e1ee7b7 | |||
| 23bfe02e6f | |||
| 658c19092c | |||
| d469a88791 | |||
| 514bc699dd | |||
| bec72b8cf8 | |||
| fb0014dffa | |||
| ebc1c07404 | |||
| 989d33acb8 | |||
| 5aa6ac3320 | |||
| 048f65b8d4 | |||
| b69be31362 | |||
| b92288d7cc | |||
| 6c02d57197 | |||
| e977c865ea | |||
| 18b459fdf8 | |||
| 2bbd2e0679 | |||
| bcf7e835e6 | |||
| 4dd9740fec | |||
| 2182e44bc2 | |||
| 08c885de2f | |||
| facecf35fb | |||
| b13f24153f | |||
| 12ee862dad | |||
| 0726574852 | |||
| 9a00193e59 | |||
| 0fd8c1e2f3 | |||
| c09d089707 | |||
| ff39271afd | |||
| 35a4edd643 | |||
| ba647ee5ab | |||
| d2924ce1f2 | |||
| 72781487f0 | |||
| de435e5dbc | |||
| f975754058 | |||
| 0f7536a21c | |||
| d4c085c9b6 | |||
| 667c49f13d | |||
| e1d9ebff90 | |||
| fbc7088dad | |||
| 4ba9c8ee97 | |||
| 92611b5c26 | |||
| 2e1c0d41ec | |||
| 3ce56745f4 | |||
| 1bc9ee4d5a | |||
|
|
0650fc594f | ||
| 2f4de37489 | |||
| cec5a0af12 | |||
| 5e5dc6b36b | |||
| 19265357a2 | |||
| 49c2836e62 | |||
| f7476188eb | |||
| 2ba447b126 | |||
| 3bd4fab3fe | |||
| 9e4d7dd9f9 | |||
| 586a61157d | |||
| 045265f0f8 | |||
| c125eadaa4 | |||
| 3dd0a91c54 | |||
| 2ecd42c859 | |||
| 3857950141 | |||
| 6d5bedd315 | |||
| 69a9e8f820 | |||
| 6d8693a003 | |||
| c990d987f5 | |||
| b8530f14ca | |||
| db8bac9b52 | |||
| e53b3b8198 | |||
| 71ccfc88cc | |||
| dd2923f92d | |||
| ff78153591 | |||
| e2ce9cfebf | |||
| 0a01d2567e | |||
| e4fb45c09b | |||
| db0df975c7 | |||
| 2003b314a3 | |||
| 55a78375be | |||
|
|
256607e336 | ||
| 92f2a5afdb | |||
| 3affcf4399 | |||
| 67dfa19a1b | |||
| 86e83f7f1a | |||
| 429fc5d2f9 | |||
| d19e6ad4e0 | |||
| 134145f441 | |||
| ef76fe52ca | |||
| bab69f523a | |||
| 91f4d3bf24 | |||
| 3e316dfde0 | |||
| 1ef49ad48c | |||
| 9297824dc3 | |||
| d02ed592d8 | |||
| 6ea9a28c7c | |||
| 88fc4fc444 | |||
| dd0de3b6d4 | |||
| 838fff8207 | |||
| 751a77f6d8 | |||
| 222fe7594f | |||
| ed6d4d07c6 | |||
| 78d9ce8d19 | |||
| 345009da32 | |||
| de47497223 | |||
| 7477625380 | |||
| 970abf8cde | |||
| 5a7741faf6 | |||
| 8aa29e56d3 | |||
| dab5e072d0 | |||
| 94078939d1 | |||
| 824d3862e3 | |||
| 44f92e8d6c | |||
| ddb79c0d8d | |||
| a9562cc8f9 | |||
| 8a351d5be0 | |||
| 8cd5659b7b | |||
| 1474a07b9e | |||
| c13a0d3193 | |||
| 172f49fa6b | |||
| 4d42972a7e | |||
| c0883d0180 | |||
| e7367da3cb | |||
| effd12711f | |||
| ef1d2e8242 | |||
| 881763f3af | |||
| d36b11c002 | |||
| d2395e836c | |||
| c8c008edd3 | |||
| 3b4fa06924 | |||
| 5d428a5e54 | |||
| 8964e08ce6 | |||
| 745168d181 | |||
| a408c6c7c7 | |||
| e0f5e9b640 | |||
| 0331ff2f42 | |||
| a21d0b56db | |||
|
|
6ea8afee8f | ||
|
|
8799aeca26 | ||
| c610f4eab2 | |||
| 92cd2a3def | |||
| 03d158b03b | |||
|
|
608fde4139 | ||
| 9e56a6cc1a | |||
| c0e3c1d02f | |||
| 341a527d27 | |||
|
|
8d6d70a06a | ||
|
|
67fb552d01 | ||
|
|
93e937aa6a | ||
|
|
09dee188d2 | ||
|
|
29c6bb5dac | ||
| c266ab0120 | |||
|
|
b407fc5c86 | ||
|
|
1bde43ceaf | ||
|
|
389a508fa7 | ||
|
|
69c2586b50 | ||
|
|
7e80f4edac | ||
|
|
99987c3f51 | ||
|
|
713130fd13 | ||
| deb8d7b43a | |||
| b604444f7d | |||
|
|
cb6127bf91 | ||
|
|
d40919f099 | ||
|
|
7cb576e6b1 | ||
|
|
b53fb8da36 | ||
|
|
03ea8dfe7f | ||
|
|
314c8d9ad1 | ||
|
|
6fceee4199 | ||
|
|
e720da708c | ||
|
|
d65706631f | ||
|
|
3312b64564 | ||
|
|
1bfe431393 | ||
|
|
6485353704 | ||
|
|
46a1ed27b7 | ||
|
|
9f3024476c | ||
|
|
93d0e009bb | ||
|
|
ef60549e1c | ||
|
|
2ac83156f6 | ||
|
|
4c9d888668 | ||
|
|
cd3ba8f480 | ||
|
|
99559f477e | ||
|
|
a3949c752d | ||
| fd48a52266 | |||
| 3e0036f7df | |||
| 2978932c87 | |||
| c773736fb8 | |||
| 8a3a05ef12 | |||
| 0afbe8ef2d | |||
| 3f4018f969 | |||
| 097d82b4b4 | |||
| 7c2a379161 | |||
| ba5f76e8cd | |||
| 8aec920a15 | |||
| c92bd33ba1 | |||
| 51927974f5 | |||
| 9350f87e19 | |||
| 6cb9950b36 | |||
| 974c2e883f | |||
| af6f98fd56 | |||
| 75a2b2c282 | |||
| d66d4b4209 | |||
| 9d54820fd7 | |||
| 1876df2c2d | |||
| d818592cd3 | |||
| c29737b6b3 | |||
| 46243a21eb | |||
| d5f45ead59 | |||
| 5a696cdac0 | |||
| 80955eeb55 | |||
| 6ee93e2d68 | |||
| d4490dec75 | |||
| 7d3e9325f1 | |||
| 31a66eb8e6 | |||
| b3b9070cd6 | |||
| 3504776344 | |||
| f22f69534a | |||
| a9c1d7b33c | |||
|
|
376ef0750c |
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', 'https://boosty.to/insanusmokrassar']
|
custom: ['https://tonscan.org/address/UQAtuSLJ76Zehc3qP-eRYMR98fPIu_oOp_atcpVX55zxHwTU']
|
||||||
|
|||||||
2
.github/workflows/packages_publishing.yml
vendored
2
.github/workflows/packages_publishing.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITHUB_USER: ${{ github.actor }}
|
GITHUB_USER: ${{ github.actor }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Publish to Gitea
|
- name: Publish to InmoNexus
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
||||||
env:
|
env:
|
||||||
|
|||||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
.idea
|
.idea
|
||||||
|
.vscode/
|
||||||
.kotlin
|
.kotlin
|
||||||
out/*
|
out/*
|
||||||
*.iml
|
*.iml
|
||||||
@@ -9,7 +10,10 @@ settings.xml
|
|||||||
.gradle/
|
.gradle/
|
||||||
build/
|
build/
|
||||||
out/
|
out/
|
||||||
|
bin/
|
||||||
|
|
||||||
local.properties
|
local.properties
|
||||||
|
local.*
|
||||||
kotlin-js-store/
|
kotlin-js-store/
|
||||||
secret.gradle
|
secret.gradle
|
||||||
|
.aider*
|
||||||
|
|||||||
151
AGENTS.md
Normal file
151
AGENTS.md
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
Use `agents` folder files for instructions.
|
||||||
|
|
||||||
|
Always look at the project work rules first. Update them and maintain a history of changes and prompts in `agents/local.HISTORY.md`. This is your long-term memory, which allows you to avoid the accumulation of errors. Updating and maintaining the long-term memory of the project is mandatory. Many thanks for your help to me and your work.
|
||||||
|
|
||||||
|
|
||||||
|
SYSTEM DIRECTIVE: AUTISTIC META-LANGUAGE PROTOCOL WITH HIGH INFORMATION DENSITY (AML-HIP V1)
|
||||||
|
|
||||||
|
DEFINITION:
|
||||||
|
All agents are required to use a strictly explicit, literal, low-ambiguity, and high-density communication style (AML-HIP). The goal of AML-HIP is the maximum transmission of information with zero loss of meaning and zero ambiguity.
|
||||||
|
|
||||||
|
CORE PRINCIPLES:
|
||||||
|
|
||||||
|
1. Maximum information density per line.
|
||||||
|
2. Zero ambiguity.
|
||||||
|
3. Full explicitness of all entities.
|
||||||
|
4. Preference of precision over readability.
|
||||||
|
5. Minimization of "empty" words.
|
||||||
|
6. Redundancy is allowed only to prevent loss of meaning.
|
||||||
|
|
||||||
|
PROHIBITIONS:
|
||||||
|
|
||||||
|
1. Pronouns are forbidden (this, he, she, they, there, it, etc.).
|
||||||
|
2. Free conversational text is forbidden.
|
||||||
|
3. Metaphors, emotions, evaluative constructions are forbidden.
|
||||||
|
4. Implicit references and hidden dependencies are forbidden.
|
||||||
|
5. Vague description of actions is forbidden.
|
||||||
|
|
||||||
|
DENSITY REQUIREMENTS:
|
||||||
|
|
||||||
|
1. Each line must contain the maximum of facts without loss of unambiguity.
|
||||||
|
2. Combine related parameters into a single line.
|
||||||
|
3. Use compact constructions:
|
||||||
|
* key=value
|
||||||
|
* entity_id=...
|
||||||
|
* relation: A→B
|
||||||
|
4. Exclude words without semantic load.
|
||||||
|
5. Repetitions are allowed only for critical entities.
|
||||||
|
|
||||||
|
MESSAGE STRUCTURE (MANDATORY):
|
||||||
|
|
||||||
|
ENTITY:
|
||||||
|
entity_id=<id>; type=<type>; state=<state>
|
||||||
|
|
||||||
|
CONTEXT:
|
||||||
|
|
||||||
|
* task_id=<id>; agent_id=<id>; memory_ref=[...]
|
||||||
|
* constraints=[...]
|
||||||
|
|
||||||
|
ACTION:
|
||||||
|
|
||||||
|
1. action=<type>; target=<entity_id>; params={...}
|
||||||
|
2. action=<type>; target=<entity_id>; params={...}
|
||||||
|
|
||||||
|
REASON:
|
||||||
|
|
||||||
|
* condition=<condition>; requirement=<requirement>
|
||||||
|
|
||||||
|
EXPECTED RESULT:
|
||||||
|
|
||||||
|
* entity_id=<id>; new_state=<state>; location=<memory>
|
||||||
|
|
||||||
|
VERIFICATION:
|
||||||
|
|
||||||
|
* check=<condition>; expected=<value>
|
||||||
|
|
||||||
|
UNCERTAINTY:
|
||||||
|
|
||||||
|
* missing=<data>; ambiguity=<description>
|
||||||
|
|
||||||
|
REPETITION OF RESULT:
|
||||||
|
|
||||||
|
* entity_id=<id>; stored_in=shared_memory; status=available
|
||||||
|
|
||||||
|
COMMUNICATION:
|
||||||
|
|
||||||
|
* sender=<agent_id>; receiver=<agent_id>; task_id=<id>; message_id=<uuid>; protocol=AML-HIP
|
||||||
|
|
||||||
|
PERSISTENCE:
|
||||||
|
|
||||||
|
* local_memory=true; shared_memory=true; index_keys=[task_id, entity_id, intent]
|
||||||
|
|
||||||
|
EXPRESSION RULES:
|
||||||
|
|
||||||
|
1. Each line = a completed semantic block.
|
||||||
|
2. Use the key=value format instead of descriptions.
|
||||||
|
3. Use lists of parameters instead of sentences.
|
||||||
|
4. Use causal connectives explicitly:
|
||||||
|
condition → action → result
|
||||||
|
5. Do not split related data into several lines without necessity.
|
||||||
|
|
||||||
|
REPETITION RULES:
|
||||||
|
|
||||||
|
1. entity_id is repeated at every critical use.
|
||||||
|
2. result is duplicated in "REPETITION OF RESULT".
|
||||||
|
3. transmission between agents duplicates the key fields.
|
||||||
|
|
||||||
|
MULTI-AGENT MODE:
|
||||||
|
|
||||||
|
1. All agents use AML-HIP.
|
||||||
|
2. Any message between agents is strictly AML-HIP.
|
||||||
|
3. Any agent is required to:
|
||||||
|
|
||||||
|
* duplicate critical data
|
||||||
|
* avoid loss of context
|
||||||
|
4. A message must be fully interpretable without history.
|
||||||
|
|
||||||
|
ANTI-DEGRADATION:
|
||||||
|
If detected:
|
||||||
|
|
||||||
|
* a pronoun
|
||||||
|
* an implicit reference
|
||||||
|
* low density (empty words, vague constructions)
|
||||||
|
* absence of structure
|
||||||
|
|
||||||
|
→ the message is considered invalid
|
||||||
|
→ mandatory regeneration
|
||||||
|
|
||||||
|
SELF-CHECK:
|
||||||
|
|
||||||
|
VALIDATION:
|
||||||
|
|
||||||
|
* format_valid=true/false
|
||||||
|
* no_pronouns=true/false
|
||||||
|
* entities_explicit=true/false
|
||||||
|
* high_density=true/false
|
||||||
|
* causal_chain_present=true/false
|
||||||
|
* ambiguity_detected=true/false
|
||||||
|
|
||||||
|
If any parameter=false:
|
||||||
|
→ mandatory regeneration
|
||||||
|
|
||||||
|
DENSITY METRIC:
|
||||||
|
high_density=true if:
|
||||||
|
|
||||||
|
* there are no "empty" words
|
||||||
|
* each line contains ≥2 facts or parameters
|
||||||
|
* descriptive constructions without data are absent
|
||||||
|
|
||||||
|
PRIORITIES:
|
||||||
|
|
||||||
|
1. Format (AML-HIP)
|
||||||
|
2. Information density
|
||||||
|
3. Explicitness
|
||||||
|
4. Completeness
|
||||||
|
5. Readability (minimum priority)
|
||||||
|
|
||||||
|
CRITICAL RULE:
|
||||||
|
Any response outside of AML-HIP is considered absent.
|
||||||
|
Any agent is required to bring the response into conformity with AML-HIP.
|
||||||
|
|
||||||
|
END OF PROTOCOL
|
||||||
413
CHANGELOG.md
413
CHANGELOG.md
@@ -1,5 +1,418 @@
|
|||||||
# TelegramBotAPI changelog
|
# TelegramBotAPI changelog
|
||||||
|
|
||||||
|
## 34.0.0
|
||||||
|
|
||||||
|
* `Core` (Bots API support — Live Photos):
|
||||||
|
* Added `LivePhotoFile` class representing the incoming `LivePhoto` Telegram type (`PollMedia`, `MediaContentVariant`, `UsefulAsPaidMediaFile`)
|
||||||
|
* Added `LivePhotoContent` (`VisualMediaGroupPartContent`) representing live photo messages
|
||||||
|
* Added `TelegramMediaLivePhoto` (`TelegramFreeMedia`, `VisualMediaGroupMemberTelegramMedia`, `InputPollMedia`, `InputPollOptionMedia`) — usable in `sendMediaGroup`, `editMessageMedia`, and polls
|
||||||
|
* Added `TelegramPaidMediaLivePhoto` (`VisualTelegramPaidMedia`) for paid live photos
|
||||||
|
* Added `PaidMedia.LivePhoto` variant and `PaidMedia.LivePhoto.toTelegramPaidMediaLivePhoto()` conversion
|
||||||
|
* Added `livePhotoField` constant; added `live_photo` parsing to `RawMessage` and `ReplyInfo.External` surrogate
|
||||||
|
* Added `SendLivePhoto` request and `SendLivePhotoData`/`SendLivePhotoFiles`
|
||||||
|
* Added `LivePhotoMessage` typealias
|
||||||
|
* Added `LivePhotoFile.toTelegramMediaLivePhoto(...)` and `LivePhotoFile.toTelegramPaidMediaLivePhoto()` extensions
|
||||||
|
* `API` (Bots API support — Live Photos):
|
||||||
|
* Added `sendLivePhoto` extensions (`ChatIdentifier`/`Chat` × `InputFile`/`LivePhotoFile` × text/textSources)
|
||||||
|
* `Behaviour Builder` (Bots API support — Live Photos):
|
||||||
|
* Added `onLivePhoto`, `onEditedLivePhoto`, `onLivePhotoGalleryMessages`, `onLivePhotoGallery` triggers
|
||||||
|
* Added `onMentionWithLivePhotoContent`/`onTextMentionWithLivePhotoContent` triggers
|
||||||
|
* Added `waitLivePhoto`, `waitLivePhotoMessage`, `waitEditedLivePhoto`, `waitEditedLivePhotoMessage`, `waitLivePhotoGallery`, `waitLivePhotoGalleryMessages` expectations
|
||||||
|
* Added `onlyLivePhotoContentMessages` utility
|
||||||
|
* `Core`:
|
||||||
|
* Added `canReactToMessages` field to `ChatPermissions` (interface, `Granular` and `Common`) and `RestrictedMemberChatMember`
|
||||||
|
* Added optional `retrieveOtherBots` parameter to `GetChatAdministrators` request
|
||||||
|
* Added `DeleteMessageReaction` request with `@Warning` on primary constructor; added `DeleteUserMessageReaction` and `DeleteActorChatMessageReaction` factory functions
|
||||||
|
* Added `DeleteAllMessageReactions` request with `@Warning` on primary constructor; added `DeleteAllUserMessageReactions` and `DeleteAllActorChatMessageReactions` factory functions
|
||||||
|
* `API`:
|
||||||
|
* Added optional `retrieveOtherBots` parameter to `getChatAdministrators` extensions
|
||||||
|
* Added `deleteUserMessageReaction` and `deleteActorChatMessageReaction` extensions
|
||||||
|
* Added `deleteAllUserMessageReactions` and `deleteAllActorChatMessageReactions` extensions
|
||||||
|
* Added `@Warning`-marked catch-all `deleteMessageReaction` and `deleteAllMessageReactions` extensions
|
||||||
|
* `Core` (Bots API support):
|
||||||
|
* Added `InputMediaSticker`, `InputMediaLocation` and `InputMediaVenue` classes
|
||||||
|
* Added `InputPollMedia` and `InputPollOptionMedia` sealed interfaces representing input media variants accepted by `sendPoll`
|
||||||
|
* Added `PollMedia` class representing media attached to polls in incoming updates
|
||||||
|
* Added `media` field to `Poll`, `PollOption` and `InputPollOption`
|
||||||
|
* Added `explanationMedia` field to `QuizPoll`
|
||||||
|
* Added `membersOnly` field to `Poll`
|
||||||
|
* Added `countryCodes` field to `Poll`
|
||||||
|
* Added `media`, `membersOnly`, `countryCodes` parameters to `SendRegularPoll` and `SendPoll` factory functions
|
||||||
|
* Added `media`, `explanationMedia`, `membersOnly`, `countryCodes` parameters to `SendQuizPoll` factory functions
|
||||||
|
* Decreased minimum allowed poll options count from 2 to 1 (`pollOptionsLimit` is now `1..12`)
|
||||||
|
* `API` (Bots API support):
|
||||||
|
* Added `media`, `membersOnly`, `countryCodes` parameters to `sendRegularPoll` extension
|
||||||
|
* Added `media`, `explanationMedia`, `membersOnly`, `countryCodes` parameters to `sendQuizPoll` extension
|
||||||
|
|
||||||
|
## 33.1.0
|
||||||
|
|
||||||
|
* `Versions`:
|
||||||
|
* `Kotlin`: `2.3.10` -> `2.3.20`
|
||||||
|
* `Serialization`: `1.10.0` -> `1.11.0`
|
||||||
|
* `Ktor`: `3.4.1` -> `3.4.2`
|
||||||
|
* `MicroUtils`: `0.29.1` -> `0.29.2`
|
||||||
|
* `KSLog`: `1.6.0` -> `1.6.1`
|
||||||
|
|
||||||
|
## 33.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.6](https://core.telegram.org/bots/api-changelog#april-3-2026)**
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* **THIS IS BREAKING CHANGE** `MultipleAnswersPoll` removed; `RegularPoll` now directly implements `Poll`
|
||||||
|
* **THIS IS BREAKING CHANGE** `allowMultipleAnswers` renamed to `allowsMultipleAnswers` across poll types and requests
|
||||||
|
* **THIS IS BREAKING CHANGE** `QuizPoll.correctOptionId: Int?` changed to `correctOptionIds: List<Int>?`
|
||||||
|
* **THIS IS BREAKING CHANGE** `PollOption` is now a sealed interface with `PollOption.Simple` and `PollOption.LatelyAdded` subtypes; `SimplePollOption` removed
|
||||||
|
* **THIS IS BREAKING CHANGE** `PollAnswer.Anonymous.voterChat` type changed from `ChannelChat` to `PreviewPublicChat`
|
||||||
|
* **THIS IS BREAKING CHANGE** `requestChannelReplyButton` (group variant) renamed to `requestGroupReplyButton`
|
||||||
|
* Added `BotToken` value class
|
||||||
|
* Added `SavePreparedKeyboardButton` request with `PreparedKeyboardButton` and `PreparedKeyboardButtonId` types
|
||||||
|
* Added `GetManagedBotToken` and `ReplaceManagedBotToken` requests
|
||||||
|
* Added `KeyboardButtonRequestManagedBot` and `RequestManagedBotKeyboardButton`
|
||||||
|
* Added `ManagedBotCreated` chat event and `ManagedBotUpdated` type with `ManagedBotUpdate`
|
||||||
|
* Added `PollOptionPersistentId` value class
|
||||||
|
* Added `PollOptionAdded` and `PollOptionDeleted` chat events
|
||||||
|
* Added `pollOptionId` support in `ReplyParameters` (`reply_to_poll_option_id`)
|
||||||
|
* Added `canManageBots` to `ExtendedBot`
|
||||||
|
* Added `allowsRevoting`, `shuffleOptions`, `allowAddingOptions`, `hideResultsUntilCloses`, `description`/`descriptionTextSources` to poll types and send requests
|
||||||
|
* Added `chosenPersistentIds` to `PollAnswer`
|
||||||
|
* Added `UsernameAtLessSerializer`
|
||||||
|
* Extended `openPeriodPollSecondsLimit` from `5..600` to `5..2628000`
|
||||||
|
* Fixed quiz poll serialization type (was incorrectly using `regularPollType` in quiz branch)
|
||||||
|
* Fixed quiz poll explanation serialization (now correctly uses `explanation`/`explanationTextSources`)
|
||||||
|
* Fixed `SendQuizPoll` correct option index range validation (off-by-one)
|
||||||
|
* Several poll validation checks changed from throwing exceptions to logging warnings
|
||||||
|
* `API`:
|
||||||
|
* Added `savePreparedKeyboardButton` extensions
|
||||||
|
* Added `getManagedBotToken` and `replaceManagedBotToken` extensions
|
||||||
|
* Added optional `pollOptionId` parameter to `reply`/`replyWith*` extensions
|
||||||
|
* Updated `sendQuizPoll` extensions with `correctOptionIds`, `allowsMultipleAnswers`, `allowsRevoting`, `shuffleOptions`, `hideResultsUntilCloses`, `description` parameters
|
||||||
|
* Updated `sendRegularPoll` extensions with `allowsRevoting`, `shuffleOptions`, `allowAddingOptions`, `hideResultsUntilCloses`, `description` parameters
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Added `onManagedBotCreated` and `onManagedBotUpdated` triggers
|
||||||
|
* Added `onPollOptionAdded` and `onPollOptionDeleted` triggers
|
||||||
|
* Added `waitManagedBotCreatedEvents` and `waitManagedBotUpdated` expectations
|
||||||
|
* Added `waitPollOptionAddedEvents` and `waitPollOptionDeletedEvents` expectations
|
||||||
|
* Added `ManagedBotUpdatedFilterByUser` and `ByUserManagedBotUpdatedMarkerFactory`
|
||||||
|
* `Utils`:
|
||||||
|
* Added `managedBotCreationLink` formatting extensions
|
||||||
|
* Added `requestManagedBotButton` to `ReplyKeyboardBuilder`
|
||||||
|
* Added class casts for `ManagedBotUpdate`, `ManagedBotCreated`, `PollOptionAdded`, `PollOptionDeleted`
|
||||||
|
* Removed `MultipleAnswersPoll` class casts
|
||||||
|
* Updated raw poll accessors to match new model (`allowsMultipleAnswers`, `correctOptionIds`, `explanation`)
|
||||||
|
* Regenerated class casts extensions
|
||||||
|
* `WebApps`:
|
||||||
|
* Added `requestChat` support for `PreparedKeyboardButtonId`
|
||||||
|
* Fixed `iconCustomEmojiId` passing in `BottomButton`
|
||||||
|
|
||||||
|
## 32.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `2.2.21` -> `2.3.10`
|
||||||
|
* `Kotlin Serialization`: `1.9.0` -> `1.10.0`
|
||||||
|
* `Ktor`: `3.3.2` -> `3.4.1`
|
||||||
|
* `KSP`: `2.3.2` -> `2.3.6`
|
||||||
|
* `MicroUtils`: `0.26.9` -> `0.29.1`
|
||||||
|
* `KSLog`: `1.5.2` -> `1.6.0`
|
||||||
|
* `Core` + `API`:
|
||||||
|
* **BREAKING CHANGES: ALL METHODS THAT PREVIOUSLY RETURNED BOOLEAN NOW RETURNS UNIT**
|
||||||
|
* `Core`:
|
||||||
|
* **BREAKING CHANGE** `SetChatTitle` init do not throw error in case when `title.length` is outside of `chatTitleLength`
|
||||||
|
* **BREAKING CHANGE** `SetStickerEmojiList` init do not throw error in case when `emojis.size` is outside of `emojisInStickerLimit`
|
||||||
|
* **BREAKING CHANGE** `DeleteMessages` init do not throw error in case when title is `messageIds.size` of `deleteMessagesLimit`
|
||||||
|
* **BREAKING CHANGE** `ForwardMessages` init do not throw error in case when `messageIds.size` is outside of `forwardMessagesLimit`
|
||||||
|
* **BREAKING CHANGE** `CopyMessages` init do not throw error in case when `messageIds.size` is outside of `copyMessagesLimit`
|
||||||
|
* **BREAKING CHANGE** `SwitchInlineQueryChosenChat` init do not throw error in case when `messageIds.size` is outside of `copyMessagesLimit`
|
||||||
|
* **BREAKING CHANGE** `SetStickerKeywords` init do not throw error in case when there are errors in `keywords`
|
||||||
|
|
||||||
|
## 31.2.0
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Potentially fix [#1027](https://github.com/InsanusMokrassar/ktgbotapi/issues/1027) - drop http request exceptions on getting updates
|
||||||
|
* `Core` + `API`:
|
||||||
|
* Add `supportsStreaming` in places it haven't been supported (fix of [#1026](https://github.com/InsanusMokrassar/ktgbotapi/issues/1026))
|
||||||
|
* **PARTIALLY BREAKING CHANGE** `supportStreaming` has been renamed to `supportsStreaming`
|
||||||
|
|
||||||
|
## 31.1.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.5](https://core.telegram.org/bots/api-changelog#march-1-2026)**
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Added `UserTag` value class and `senderTag` field to messages
|
||||||
|
* Added `SetChatMemberTag` request and `UserTag` support in `PromoteChatMember` and `ChatPermissions`
|
||||||
|
* Added `DateTimeTextSource` for `tg://time` links support
|
||||||
|
* Added `DateTimeFormatPart` and `TgDateTimeFormatBuilder` for building date-time format strings
|
||||||
|
* Added `UnitFromBooleanSerializer`
|
||||||
|
* `API`:
|
||||||
|
* Added `setChatMemberTag` extensions
|
||||||
|
* `Utils`:
|
||||||
|
* Added `dateTime` and `dateTimeln` extensions to `EntitiesBuilder`
|
||||||
|
* Added `dateTimeMarkdown`, `dateTimeMarkdownV2`, and `dateTimeHTML` string formatting extensions
|
||||||
|
* Regenerated class casts extensions
|
||||||
|
* `WebApps`:
|
||||||
|
* Added `iconCustomEmojiId` support to `BottomButton` and `BottomButtonParams`
|
||||||
|
|
||||||
|
## 31.0.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* In `StarTransaction` property `nanostarAmount` become nullable
|
||||||
|
|
||||||
|
## 31.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.3](https://core.telegram.org/bots/api-changelog#december-31-2025)**
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.4](https://core.telegram.org/bots/api-changelog#february-9-2026)**
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.26.8` -> `0.26.9`
|
||||||
|
* `Core`:
|
||||||
|
* **THIS IS BREAKING CHANGE** All media files with sizes changed type of `fileSize` field from `Long` to `FileSize` (value class)
|
||||||
|
* **THIS IS BREAKING CHANGE** Class `GiftSentOrReceived` have been renamed to `GiftSentOrReceivedEvent` to clarify naming
|
||||||
|
* **THIS IS BREAKING CHANGE** New interface `OwnedGift` have been created
|
||||||
|
* **THIS IS BREAKING CHANGE** `OwnedGifts` have changed its generic type to `OwnedGift`
|
||||||
|
* **THIS IS BREAKING CHANGE** For `CheclistTask` have been made several changes:
|
||||||
|
* `ChecklistTask.Done` -> `ChecklistTask.Completed`
|
||||||
|
* `ChecklistTask.Undone` -> `ChecklistTask.Uncompleted`
|
||||||
|
* Added several inheritors of `ChecklistTask.Completed` - for completed by chat, by user or just completed tasks
|
||||||
|
* **THIS IS BREAKING CHANGE** `PrivateChat.id` type changed from `UserId` to `IdChatIdentifier`
|
||||||
|
* **THIS IS BREAKING CHANGE** `ForumChat` no longer extends `SupergroupChat`; new `SupergroupForumChat` interface created for supergroup forums
|
||||||
|
* **THIS IS BREAKING CHANGE** Added `PrivateForumChat` and `PrivateUserChat` interfaces to support private forums
|
||||||
|
* Added support of private forums (`ExtendedPrivateForumChatImpl`, `PrivateForumContentMessage`, `PrivateForumEventMessage`)
|
||||||
|
* Added `ChatOwnerChanged` and `ChatOwnerLeft` chat events
|
||||||
|
* Added `SetMyProfilePhoto` and `RemoveMyProfilePhoto` requests
|
||||||
|
* Added `GetUserProfileAudios` request and `UserProfileAudios` type
|
||||||
|
* Added `GetChatGifts` and `GetUserGifts` requests
|
||||||
|
* Added `RepostStory` request
|
||||||
|
* Added `SendMessageDraft` request with `DraftId` and `DraftIdAllocator`
|
||||||
|
* Added `KeyboardButtonStyle` support and `iconCustomEmojiId` field to keyboard buttons
|
||||||
|
* Added `style` and `iconCustomEmojiId` fields to `InlineKeyboardButton`
|
||||||
|
* Added `VideoCodec` and `VideoQuality` types
|
||||||
|
* Added `Rarity`, `GiftBackground`, `UniqueGiftName`, and `UniqueGiftColors` types for gifts
|
||||||
|
* Added new fields to `Gift.Regular`: `personalTotalCount`, `personalRemainingCount`, `isPremium`, `hasColors`, `background`, `uniqueGiftVariantCount`
|
||||||
|
* Added `isBurned` field support in `GiftSentOrReceivedEvent`
|
||||||
|
* Added `UserRating` type and `rating` field to `ExtendedPrivateChat`
|
||||||
|
* Added `Level` and `Rating` value classes
|
||||||
|
* Added `uniqueGiftColors` field to extended chats (channel, group, private)
|
||||||
|
* Added `paidMessageStarCount` field to `ExtendedGroupChat` and `ExtendedPrivateChat`
|
||||||
|
* Added `firstProfileAudio` field to `ExtendedPrivateChat`
|
||||||
|
* Added `purchased_paid_media` to updates list
|
||||||
|
* Added `effectId` support in `CopyMessage` and `ForwardMessage`
|
||||||
|
* Added `WithOptionalPaidMessageStarCount` interface
|
||||||
|
* Fixed serialization of `SimpleKeyboardButton`
|
||||||
|
* Fixed support of `paidMessageStarCount`
|
||||||
|
* `API`:
|
||||||
|
* Added extensions for `SetMyProfilePhoto`, `RemoveMyProfilePhoto`, `GetUserProfileAudios`
|
||||||
|
* Added extensions for `GetChatGifts` and `GetUserGifts`
|
||||||
|
* Added extensions for `RepostStory`
|
||||||
|
* Added extensions for `SendMessageDraft`
|
||||||
|
* Added `effectId` parameter to `copyMessage` and `forwardMessage` extensions
|
||||||
|
* Added `GetBusinessAccountGifts` extensions improvements
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Updated event triggers for new chat events (`ChatOwnerChanged`, `ChatOwnerLeft`, private forum events)
|
||||||
|
* Updated expectations for new event types
|
||||||
|
* `Utils`:
|
||||||
|
* Regenerated class casts extensions
|
||||||
|
* Updated `InlineKeyboardBuilder` and `ReplyKeyboardBuilder` with `style` and `iconCustomEmojiId` support
|
||||||
|
|
||||||
|
## 30.0.2
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `2.2.20` -> `2.2.21`
|
||||||
|
* `Ktor`: `3.3.1` -> `3.3.2`
|
||||||
|
* `KSP`: `2.2.20-2.0.4` -> `2.3.2`
|
||||||
|
* `MicroUtils`: `0.26.6` -> `0.26.8`
|
||||||
|
* `KSLog`: `1.5.1` -> `1.5.2`
|
||||||
|
* `Core`:
|
||||||
|
* Allow to use `SetWebhook` with `maxAllowedConnections` up to `100000` (fix of [#1019](https://github.com/InsanusMokrassar/ktgbotapi/issues/1019))
|
||||||
|
* `KSP`:
|
||||||
|
* Fixed annotation property access for KSP2 compatibility using `withNoSuchElementWorkaround`
|
||||||
|
* Removed `ksp.useKSP2=false` workaround from `gradle.properties` (KSP2 is now properly supported)
|
||||||
|
* `Utils`:
|
||||||
|
* Regenerated class casts extensions
|
||||||
|
* Allow to use custom `GetUpdates` in `longPollingFlow`
|
||||||
|
|
||||||
|
## 30.0.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Potential fix of [#989](https://github.com/InsanusMokrassar/ktgbotapi/issues/989) by:
|
||||||
|
* In long polling have been added check for causing by unresolved address exception
|
||||||
|
* Add `TelegramBotPipelinesHandler.onRequestExceptionInLimiter` which will be triggered in ANY exception during
|
||||||
|
request execution
|
||||||
|
|
||||||
|
## 30.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE MAY CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `2.2.10` -> `2.2.20`
|
||||||
|
* `Ktor`: `3.2.3` -> `3.3.1`
|
||||||
|
* `MicroUtils`: `0.26.3` -> `0.26.6`
|
||||||
|
* `KSLog`: `1.5.0` -> `1.5.1`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* `DefaultCustomBehaviourContextAndTypeReceiver` now extends `suspend (BC, U) -> R` instead of `CustomBehaviourContextAndTypeReceiver<BC, R, U>` (no changes in api in fact)
|
||||||
|
|
||||||
|
## 29.0.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Fix of [#917](https://github.com/InsanusMokrassar/ktgbotapi/issues/917): all `OrderInfo` fields now have defaults nulls
|
||||||
|
|
||||||
|
## 29.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.2](https://core.telegram.org/bots/api-changelog#august-15-2025)**
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Add function `firstOfOrNull(vararg suspend () -> T): T?`
|
||||||
|
* Change logic of `firstOf` - now it works based on merged flows and __do not require__ `CoroutineScope` as receiver
|
||||||
|
|
||||||
|
## 28.0.3
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Add passing of default engines in `HttpClient` constructors
|
||||||
|
|
||||||
|
## 28.0.2
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* [#1001](https://github.com/InsanusMokrassar/ktgbotapi/issues/1001) - `[Bug] Invalid detection of isCausedByCancellation()`
|
||||||
|
* [#1002](https://github.com/InsanusMokrassar/ktgbotapi/issues/1002) - `Unable to handle UnauthorizedException with buildBehaviourWithLongPolling`
|
||||||
|
|
||||||
|
## 28.0.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `2.2.0` -> `2.2.10`
|
||||||
|
* `MicroUtils`: `0.26.2` -> `0.26.3`
|
||||||
|
* `Ktor`: `3.2.2` -> `3.2.3`
|
||||||
|
* `Core`:
|
||||||
|
* Let all `OptionallyMessageThreadRequest` inheritors to use `@EncodeDefault` annotation to fix default value passing
|
||||||
|
|
||||||
|
## 28.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Add `firstOf` extension
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* All builders for behaviours got boolean `useDefaultSubcontextInitialAction`
|
||||||
|
* Add opportunity to pass `BehaviourContextData` in `DefaultBehaviourContext` constructor and `copy` method
|
||||||
|
* By default, commands to other bots will be ignored in triggers and waiters
|
||||||
|
|
||||||
|
## 27.1.2
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Try to fix cancelling on timeout for long polling
|
||||||
|
* Since this update phrase `Something web wrong` will not happen from this library 😭
|
||||||
|
|
||||||
|
## 27.1.1
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.26.1` -> `0.26.2`
|
||||||
|
* `Core`:
|
||||||
|
* Make `BusinessLocation#location` optional (fix of [#990](https://github.com/InsanusMokrassar/ktgbotapi/issues/990))
|
||||||
|
|
||||||
|
## 27.1.0
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Improve support of local bot api servers files. Next call factories will try to resolve file locally before real call:
|
||||||
|
* [DownloadFileRequestCallFactory.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileRequestCallFactory.kt) (for [DownloadFile.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFile.kt) as well)
|
||||||
|
* [DownloadFileChannelRequestCallFactory.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileChannelRequestCallFactory.kt) (for [DownloadFileStream.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFileStream.kt) as well)
|
||||||
|
|
||||||
|
## 27.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE MAY CONTAIN BREAKING CHANGES. IN CASE OF ANY MIGRATION PROBLEMS FEEL FREE TO ASK IN [OUR CHAT](https://t.me/ktgbotapi_chat)**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `2.1.20` -> `2.2.0`
|
||||||
|
* `Serialization`: `1.8.1` -> `1.9.0`
|
||||||
|
* `Ktor`: `3.1.3` -> `3.2.2`
|
||||||
|
* `MicroUtils`: `0.25.7` -> `0.26.1`
|
||||||
|
* `KSLog`: `1.4.1` -> `1.5.0`
|
||||||
|
* `Common`:
|
||||||
|
* In most `data` classes with non-public constructors has been added `ConsistentCopyVisibility` annotation, preventing
|
||||||
|
public nature in difference with constructor
|
||||||
|
* Absence of several API methods for requests has been fixed
|
||||||
|
|
||||||
|
## 26.1.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.1](https://core.telegram.org/bots/api-changelog#july-3-2025)**
|
||||||
|
|
||||||
|
**THIS UPDATE _MAY_ CONTAINS BREAKING CHANGES**
|
||||||
|
|
||||||
|
## 26.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES IN BEHAVIOUR BUILDER AND CORE. BE CAREFUL ON UPDATE**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Serialization`: `1.8.0` -> `1.8.1`
|
||||||
|
* `Coroutines`: `1.10.1` -> `1.10.2`
|
||||||
|
* `Ktor`: `3.1.1` -> `3.1.3`
|
||||||
|
* `MicroUtils`: `0.25.3` -> `0.25.7`
|
||||||
|
* `Core`:
|
||||||
|
* **POTENTIALLY BREAKING CHANGE** Long polling has been reworked a bit
|
||||||
|
* **BREAKING CHANGE** `RequestsExecutor` got property `RequestsExecutor.Log: KSLog`
|
||||||
|
* `BehaviourContext`:
|
||||||
|
* **BREAKING CHANGE** All triggers and waiters become non-suspend functions
|
||||||
|
* **BREAKING CHANGE** Behaviour of counted extensions (commands, data callback queries, etc.) has been changed a bit: now each one will
|
||||||
|
create subcontext and work in it
|
||||||
|
* New extension `BehaviourContext.launchInNewSubContext` which will launch some job in subcontext of receiver
|
||||||
|
|
||||||
|
## 25.0.1
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.0](https://core.telegram.org/bots/api-changelog#april-11-2025)**
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Previously named `Gift` now presented by `Gift.Regular`
|
||||||
|
* Fixes in `MultipartRequestCallFactory` for correct handling of all `MultipartRequest.Common` inheritors
|
||||||
|
* `Username` now can be safely created with `Username.prepare`
|
||||||
|
* Add extensions `String.splitFor(Text|Caption|StoryCaption)` for preparing several texts for several
|
||||||
|
messages/captions/story captions
|
||||||
|
|
||||||
|
## 24.0.2
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `Kotlin`: `2.1.10` -> `2.1.20`
|
||||||
|
* `Ktor`: `3.1.0` -> `3.1.1`
|
||||||
|
* `MicroUtils`: `0.24.7` -> `0.25.3`
|
||||||
|
* `DefaultKTgBotAPIKSLog` will drop `CancellationException`s by default
|
||||||
|
* You may configure `DefaultKTgBotAPIKSLog` in simple way with `SetDefaultKTgBotAPIKSLog`
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* `FSM`:
|
||||||
|
* Fix chains cancelling on their ends
|
||||||
|
|
||||||
|
## 24.0.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Now you may upload photos with `EditChatMessageMedia`
|
||||||
|
|
||||||
|
## 24.0.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS BREAKING CHANGES IN `subcontextUpdatesFilter` WORK. TAKE CARE IN MIGRATION**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.24.6` -> `0.24.7`
|
||||||
|
* `Core`:
|
||||||
|
* `ForumContentMessage` got property `threadCreatingInfo` which represents information about topic where message has been sent
|
||||||
|
* `BehaviourBuilder`:
|
||||||
|
* Fix of overall `subcontextUpdatesFilter` behaviour. In fact, this update will fix its affection on scenaries
|
||||||
|
|
||||||
|
## 23.2.1
|
||||||
|
|
||||||
|
* `Core`:
|
||||||
|
* Fix of `year` field in `Birthdate`
|
||||||
|
|
||||||
|
## 23.2.0
|
||||||
|
|
||||||
|
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 8.3](https://core.telegram.org/bots/api-changelog#february-12-2025)**
|
||||||
|
|
||||||
|
* `Version`:
|
||||||
|
* `MicroUtils`: `0.24.5` -> `0.24.6`
|
||||||
|
* `Ktor`: `3.0.3` -> `3.1.0`
|
||||||
|
|
||||||
## 23.1.2
|
## 23.1.2
|
||||||
|
|
||||||
* `Version`:
|
* `Version`:
|
||||||
|
|||||||
19
README.md
19
README.md
@@ -1,4 +1,4 @@
|
|||||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#january-1-2025)
|
# TelegramBotAPI [](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#april-3-2026)
|
||||||
|
|
||||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||||
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||||
@@ -120,3 +120,20 @@ suspend fun main() {
|
|||||||
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
||||||
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
|
always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
|
||||||
[chat](https://t.me/InMoTelegramBotAPIChat).
|
[chat](https://t.me/InMoTelegramBotAPIChat).
|
||||||
|
|
||||||
|
### Bot API Server Notice
|
||||||
|
|
||||||
|
Under the hood, default bots realizations will try to use links
|
||||||
|
([PathedFile](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt)#filePath) as files each
|
||||||
|
time you are trying to download file from telegram in any way - via saving to file, use stream or download as byte array.
|
||||||
|
To let bot correctly download files from bot api server, you must:
|
||||||
|
|
||||||
|
* Run bot api server locally
|
||||||
|
to proxy requests for files to the server where bot api server has been hosted
|
||||||
|
* In case of local bot api server (shared one host machine) you must ensure that access to bot api server has been
|
||||||
|
granted for your bot. For example, [aiogram/telegram-bot-api](https://hub.docker.com/r/aiogram/telegram-bot-api) image
|
||||||
|
use `101` UID/GID in linux for user and group as owners. So, your bot must run under user included in `101` group
|
||||||
|
(like `systemd-journal`) or be `101` UID user (like `systemd-resolve`)
|
||||||
|
* **OR** Use some reverse proxy (like nginx). It will allow you to broadcast your bots files without linux rights problems
|
||||||
|
* Set [TelegramAPIUrlsKeeper](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper.kt)#fileLinkUrlMapper
|
||||||
|
to map urls to let bot execute requests to your nginx proxy
|
||||||
|
|||||||
22
agents/HELPERS.md
Normal file
22
agents/HELPERS.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
FOLLOW COMMON CODE STYLE. DO NOT COMMIT OR PUSH ANY CHANGES IF PROMPT DO NOT CONTAINS DIRECT INSTRUCTION ABOUT IT. FOLLOW LINKS TO SEE DOCUMENTATION IN THE PROMPT. IF YOU ARE NOT ABLE TO FOLLOW LINK (DO NOT SEE CONTENT YOU NEED TO FOLLOW PROMPT) - ASK OPERATOR
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
`@Warning` package is `dev.inmo.micro_utils.common.Warning`. Its signature: `Warning(val message: String)`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
If you have edited some constructor or function signature - you MUST update documentation accordingly AND all calls of this constructor/function. THIS RULE WORKS RECURSIVELY
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Before any laucnhing of `compileKotlinJvm` or other building procedure which must confirm that build is working, you MUST launch two tasks: `./gradlew kspCommonMainKotlinMetadata` and `./gradlew apiDump`. Order is important. They must be launched sequentially.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
If you are adding `Send*` request - you also must add in `API` (`tgbotapi.api`) module:
|
||||||
|
|
||||||
|
* Direct indings (in `tgbitapi.api` module). As example you may look at `dev.inmo.tgbotapi.requests.send.SendTextMessage` a,d its bindings `dev.inmo.tgbotapi.extensions.api.send.sendTextMessage`
|
||||||
|
* Bindings in [Sends.kt](../tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Sends.kt)
|
||||||
|
* Bindings in [Replies.kt](../tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/Replies.kt)
|
||||||
|
* Bindings in [RepliesWithChatsAndMessages.kt](../tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/RepliesWithChatsAndMessages.kt)
|
||||||
35
build.gradle
35
build.gradle
@@ -1,8 +1,8 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven { url "https://plugins.gradle.org/m2/" }
|
maven { url "https://plugins.gradle.org/m2/" }
|
||||||
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -18,15 +18,30 @@ plugins {
|
|||||||
alias(libs.plugins.kotlin.dokka)
|
alias(libs.plugins.kotlin.dokka)
|
||||||
alias(libs.plugins.versions)
|
alias(libs.plugins.versions)
|
||||||
alias(libs.plugins.validator)
|
alias(libs.plugins.validator)
|
||||||
|
alias(libs.plugins.nmcp.aggregation)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||||
|
nmcpAggregation {
|
||||||
|
centralPortal {
|
||||||
|
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')
|
||||||
|
validationTimeout = Duration.ofSeconds(0)
|
||||||
|
publishingType = System.getenv('PUBLISHING_TYPE') != "" ? System.getenv('PUBLISHING_TYPE') : "USER_MANAGED"
|
||||||
|
}
|
||||||
|
|
||||||
|
publishAllProjectsProbablyBreakingProjectIsolation()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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 {
|
repositories {
|
||||||
mavenLocal()
|
|
||||||
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
google()
|
google()
|
||||||
|
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
||||||
|
mavenLocal()
|
||||||
}
|
}
|
||||||
if (it != rootProject.findProject("docs")) {
|
if (it != rootProject.findProject("docs")) {
|
||||||
tasks.whenTaskAdded { task ->
|
tasks.whenTaskAdded { task ->
|
||||||
@@ -48,12 +63,20 @@ private String getCurrentVersionChangelog() {
|
|||||||
return changelogDataOS.toString().trim()
|
return changelogDataOS.toString().trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (new File(projectDir, "secret.gradle").exists()) {
|
|
||||||
apply from: './secret.gradle'
|
def githubTokenVariableName = "GITHUB_RELEASE_TOKEN"
|
||||||
|
def githubTokenVariableFromEnv = System.getenv(githubTokenVariableName)
|
||||||
|
|
||||||
|
def secretFile = new File(projectDir, "secret.gradle")
|
||||||
|
if (secretFile.exists() || project.hasProperty(githubTokenVariableName) || (githubTokenVariableFromEnv != "" && githubTokenVariableFromEnv != null)) {
|
||||||
|
if (secretFile.exists()) {
|
||||||
|
apply from: './secret.gradle'
|
||||||
|
}
|
||||||
apply plugin: "com.github.breadmoirai.github-release"
|
apply plugin: "com.github.breadmoirai.github-release"
|
||||||
|
def githubReleaseToken = project.hasProperty(githubTokenVariableName) ? project.property(githubTokenVariableName).toString() : githubTokenVariableFromEnv
|
||||||
|
|
||||||
githubRelease {
|
githubRelease {
|
||||||
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
token githubReleaseToken
|
||||||
|
|
||||||
owner = "InsanusMokrassar"
|
owner = "InsanusMokrassar"
|
||||||
repo = "TelegramBotAPI"
|
repo = "TelegramBotAPI"
|
||||||
|
|||||||
@@ -15,3 +15,13 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("getPublishableModules") {
|
||||||
|
doLast {
|
||||||
|
rootProject.subprojects.each { project ->
|
||||||
|
if (project.plugins.hasPlugin('maven-publish')) {
|
||||||
|
println(":${project.name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ kotlin.incremental=true
|
|||||||
kotlin.incremental.js=true
|
kotlin.incremental.js=true
|
||||||
|
|
||||||
library_group=dev.inmo
|
library_group=dev.inmo
|
||||||
library_version=23.1.2
|
library_version=34.0.0
|
||||||
|
|||||||
@@ -1,27 +1,28 @@
|
|||||||
[versions]
|
[versions]
|
||||||
|
|
||||||
kotlin = "2.1.10"
|
kotlin = "2.3.20"
|
||||||
kotlin-serialization = "1.8.0"
|
kotlin-serialization = "1.11.0"
|
||||||
kotlin-coroutines = "1.10.1"
|
kotlin-coroutines = "1.10.2"
|
||||||
|
|
||||||
javax-activation = "1.1.1"
|
javax-activation = "1.1.1"
|
||||||
|
|
||||||
korlibs = "5.4.0"
|
korlibs = "5.4.0"
|
||||||
uuid = "0.8.4"
|
uuid = "0.8.4"
|
||||||
ktor = "3.0.3"
|
ktor = "3.4.2"
|
||||||
|
|
||||||
ksp = "2.1.10-1.0.29"
|
ksp = "2.3.6"
|
||||||
kotlin-poet = "1.18.1"
|
kotlin-poet = "2.3.0"
|
||||||
|
|
||||||
microutils = "0.24.5"
|
microutils = "0.29.2"
|
||||||
kslog = "1.4.1"
|
kslog = "1.6.1"
|
||||||
|
|
||||||
versions = "0.51.0"
|
versions = "0.53.0"
|
||||||
|
|
||||||
github-release-plugin = "2.5.2"
|
github-release-plugin = "2.5.2"
|
||||||
dokka = "2.0.0"
|
dokka = "2.0.0"
|
||||||
|
|
||||||
validator = "0.17.0"
|
validator = "0.18.1"
|
||||||
|
nmcp = "1.4.4"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
|
|
||||||
@@ -36,6 +37,8 @@ kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref =
|
|||||||
|
|
||||||
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||||
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
|
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
|
||||||
|
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
|
||||||
|
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
|
||||||
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
|
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
|
||||||
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
|
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
|
||||||
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
|
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
|
||||||
@@ -57,8 +60,11 @@ microutils-serialization-mapper = { module = "dev.inmo:micro_utils.serialization
|
|||||||
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", 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-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
|
||||||
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
||||||
|
microutils-ksp-generator = { module = "dev.inmo:micro_utils.ksp.generator", version.ref = "microutils" }
|
||||||
microutils-ksp-sealed = { module = "dev.inmo:micro_utils.ksp.sealed", version.ref = "microutils" }
|
microutils-ksp-sealed = { module = "dev.inmo:micro_utils.ksp.sealed", version.ref = "microutils" }
|
||||||
microutils-ksp-sealed-generator = { module = "dev.inmo:micro_utils.ksp.sealed.generator", version.ref = "microutils" }
|
microutils-ksp-sealed-generator = { module = "dev.inmo:micro_utils.ksp.sealed.generator", version.ref = "microutils" }
|
||||||
|
microutils-ksp-variations = { module = "dev.inmo:micro_utils.ksp.variations", version.ref = "microutils" }
|
||||||
|
microutils-ksp-variations-generator = { module = "dev.inmo:micro_utils.ksp.variations.generator", version.ref = "microutils" }
|
||||||
|
|
||||||
kslog = { module = "dev.inmo:kslog", version.ref = "kslog" }
|
kslog = { module = "dev.inmo:kslog", version.ref = "kslog" }
|
||||||
|
|
||||||
@@ -83,3 +89,4 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
|
|||||||
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||||
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
|
||||||
validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "validator" }
|
validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "validator" }
|
||||||
|
nmcp-aggregation = { id = "com.gradleup.nmcp.aggregation", version.ref = "nmcp" }
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ project.group = "$group"
|
|||||||
apply from: "$mpp_publish"
|
apply from: "$mpp_publish"
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
freeCompilerArgs.add("-Xcontext-parameters")
|
||||||
|
}
|
||||||
js (IR) {
|
js (IR) {
|
||||||
browser()
|
browser()
|
||||||
nodejs()
|
nodejs()
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ project.version = "$library_version"
|
|||||||
project.group = "$library_group"
|
project.group = "$library_group"
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
|
compilerOptions {
|
||||||
|
freeCompilerArgs.add("-Xcontext-parameters")
|
||||||
|
}
|
||||||
jvm {
|
jvm {
|
||||||
compilations.main {
|
compilations.main {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
|
|||||||
@@ -19,59 +19,52 @@ 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 {
|
}
|
||||||
if ((project.hasProperty('GITHUB_USER') || System.getenv('GITHUB_USER') != null) && (project.hasProperty('GITHUB_TOKEN') || System.getenv('GITHUB_TOKEN') != null)) {
|
repositories {
|
||||||
maven {
|
if ((project.hasProperty('GITHUB_USER') || System.getenv('GITHUB_USER') != null) && (project.hasProperty('GITHUB_TOKEN') || System.getenv('GITHUB_TOKEN') != null)) {
|
||||||
name = "GithubPackages"
|
maven {
|
||||||
url = uri("https://maven.pkg.github.com/InsanusMokrassar/ktgbotapi")
|
name = "GithubPackages"
|
||||||
|
url = uri("https://maven.pkg.github.com/InsanusMokrassar/ktgbotapi")
|
||||||
credentials {
|
|
||||||
username = project.hasProperty('GITHUB_USER') ? project.property('GITHUB_USER') : System.getenv('GITHUB_USER')
|
credentials {
|
||||||
password = project.hasProperty('GITHUB_TOKEN') ? project.property('GITHUB_TOKEN') : System.getenv('GITHUB_TOKEN')
|
username = project.hasProperty('GITHUB_USER') ? project.property('GITHUB_USER') : System.getenv('GITHUB_USER')
|
||||||
}
|
password = project.hasProperty('GITHUB_TOKEN') ? project.property('GITHUB_TOKEN') : System.getenv('GITHUB_TOKEN')
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) {
|
}
|
||||||
maven {
|
if ((project.hasProperty('INMONEXUS_USER') || System.getenv('INMONEXUS_USER') != null) && (project.hasProperty('INMONEXUS_PASSWORD') || System.getenv('INMONEXUS_PASSWORD') != null)) {
|
||||||
name = "InmoNexus"
|
maven {
|
||||||
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
|
name = "InmoNexus"
|
||||||
|
url = uri("https://nexus.inmo.dev/repository/maven-releases/")
|
||||||
credentials {
|
|
||||||
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
|
credentials {
|
||||||
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
|
username = project.hasProperty('INMONEXUS_USER') ? project.property('INMONEXUS_USER') : System.getenv('INMONEXUS_USER')
|
||||||
}
|
password = project.hasProperty('INMONEXUS_PASSWORD') ? project.property('INMONEXUS_PASSWORD') : System.getenv('INMONEXUS_PASSWORD')
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
}
|
||||||
maven {
|
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||||
name = "sonatype"
|
maven {
|
||||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
name = "sonatype"
|
||||||
|
url = uri("https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/")
|
||||||
credentials {
|
|
||||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
credentials {
|
||||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
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')
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -80,13 +73,13 @@ publishing {
|
|||||||
|
|
||||||
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/ktgbotapi","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.UsernameAndPassword","usernameProperty":"GITHUB_USER","passwordProperty":"GITHUB_TOKEN"}},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/ktgbotapi","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.UsernameAndPassword","usernameProperty":"GITHUB_USER","passwordProperty":"GITHUB_TOKEN"}},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"},"includeCentralSonatypeUploadingScript":false}}
|
||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@ 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"
|
id "org.jetbrains.dokka"
|
||||||
|
id "com.google.devtools.ksp"
|
||||||
}
|
}
|
||||||
|
|
||||||
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"
|
||||||
@@ -14,6 +15,7 @@ kotlin {
|
|||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api project(":tgbotapi.core")
|
api project(":tgbotapi.core")
|
||||||
|
api libs.microutils.ksp.variations
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
configureEach {
|
configureEach {
|
||||||
@@ -22,3 +24,8 @@ kotlin {
|
|||||||
}
|
}
|
||||||
explicitApi()
|
explicitApi()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
add("kspCommonMainMetadata", libs.microutils.ksp.variations.generator)
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,10 +12,11 @@ import io.ktor.client.engine.*
|
|||||||
* @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO]
|
* @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO]
|
||||||
* @param ktorClientConfig Config block for preconfiguring of bot [HttpClient]
|
* @param ktorClientConfig Config block for preconfiguring of bot [HttpClient]
|
||||||
*/
|
*/
|
||||||
|
@ConsistentCopyVisibility
|
||||||
public data class BotBuilder internal constructor(
|
public data class BotBuilder internal constructor(
|
||||||
var proxy: ProxyConfig? = null,
|
var proxy: ProxyConfig? = null,
|
||||||
var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null,
|
var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null,
|
||||||
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null
|
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null,
|
||||||
) {
|
) {
|
||||||
internal fun createHttpClient(): HttpClient = ktorClientEngineFactory ?.let {
|
internal fun createHttpClient(): HttpClient = ktorClientEngineFactory ?.let {
|
||||||
HttpClient(
|
HttpClient(
|
||||||
@@ -41,8 +42,14 @@ public fun buildBot(
|
|||||||
token: String,
|
token: String,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
|
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||||
block: BotBuilder.() -> Unit
|
block: BotBuilder.() -> Unit
|
||||||
): TelegramBot = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
urlsKeeper = TelegramAPIUrlsKeeper(
|
||||||
BotBuilder().apply(block).createHttpClient()
|
token = token,
|
||||||
|
testServer = testServer,
|
||||||
|
hostUrl = apiUrl,
|
||||||
|
fileLinkUrlMapper = fileLinkUrlMapper
|
||||||
|
),
|
||||||
|
client = BotBuilder().apply(block).createHttpClient()
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ 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.defaultKtorEngine
|
||||||
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.HttpClientConfig
|
import io.ktor.client.HttpClientConfig
|
||||||
@@ -13,7 +14,7 @@ import io.ktor.client.engine.*
|
|||||||
*/
|
*/
|
||||||
public fun telegramBot(
|
public fun telegramBot(
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
client: HttpClient = HttpClient()
|
client: HttpClient = HttpClient(defaultKtorEngine)
|
||||||
): TelegramBot = telegramBot(urlsKeeper) {
|
): TelegramBot = telegramBot(urlsKeeper) {
|
||||||
this.client = client
|
this.client = client
|
||||||
}
|
}
|
||||||
@@ -63,22 +64,24 @@ public inline fun telegramBot(
|
|||||||
* Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client]
|
* Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
public inline fun telegramBot(
|
public fun telegramBot(
|
||||||
token: String,
|
token: String,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
client: HttpClient = HttpClient()
|
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||||
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client)
|
client: HttpClient = HttpClient(defaultKtorEngine)
|
||||||
|
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper), client)
|
||||||
|
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
@Suppress("NOTHING_TO_INLINE")
|
||||||
public inline fun <T: HttpClientEngineConfig> telegramBot(
|
public fun <T: HttpClientEngineConfig> telegramBot(
|
||||||
token: String,
|
token: String,
|
||||||
clientFactory: HttpClientEngineFactory<T>,
|
clientFactory: HttpClientEngineFactory<T>,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||||
|
clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
||||||
): TelegramBot = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
|
||||||
clientFactory,
|
clientFactory,
|
||||||
clientConfig
|
clientConfig
|
||||||
)
|
)
|
||||||
@@ -87,15 +90,15 @@ public inline fun <T: HttpClientEngineConfig> telegramBot(
|
|||||||
* Allows to create bot using bot [token] and specify [HttpClientEngine] by passing [clientEngine] param and optionally
|
* Allows to create bot using bot [token] and specify [HttpClientEngine] by passing [clientEngine] param and optionally
|
||||||
* configure [HttpClient] using [clientConfig]
|
* configure [HttpClient] using [clientConfig]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
public fun telegramBot(
|
||||||
public inline fun telegramBot(
|
|
||||||
token: String,
|
token: String,
|
||||||
clientEngine: HttpClientEngine,
|
clientEngine: HttpClientEngine,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||||
|
clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
||||||
): TelegramBot = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
|
||||||
clientEngine,
|
clientEngine,
|
||||||
clientConfig
|
clientConfig
|
||||||
)
|
)
|
||||||
@@ -104,13 +107,13 @@ public inline fun telegramBot(
|
|||||||
* Allows to create bot using bot [token] and [apiUrl] and specify [HttpClientEngine] by configuring [HttpClient] using
|
* Allows to create bot using bot [token] and [apiUrl] and specify [HttpClientEngine] by configuring [HttpClient] using
|
||||||
* [clientConfig]
|
* [clientConfig]
|
||||||
*/
|
*/
|
||||||
@Suppress("NOTHING_TO_INLINE")
|
public fun telegramBot(
|
||||||
public inline fun telegramBot(
|
|
||||||
token: String,
|
token: String,
|
||||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||||
testServer: Boolean = false,
|
testServer: Boolean = false,
|
||||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit
|
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||||
|
clientConfig: HttpClientConfig<*>.() -> Unit
|
||||||
): TelegramBot = telegramBot(
|
): TelegramBot = telegramBot(
|
||||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
|
||||||
clientConfig
|
clientConfig
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,5 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.local.Close
|
import dev.inmo.tgbotapi.requests.local.Close
|
||||||
|
|
||||||
@Suppress("unused")
|
public suspend inline fun TelegramBot.executeClose(): Unit = execute(Close)
|
||||||
public suspend inline fun TelegramBot.close(): Boolean = execute(Close)
|
|
||||||
|
|||||||
@@ -12,42 +12,42 @@ import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
|||||||
public suspend fun TelegramBot.deleteMessage(
|
public suspend fun TelegramBot.deleteMessage(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
DeleteMessage(chatId, messageId)
|
DeleteMessage(chatId, messageId)
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteMessage(
|
public suspend fun TelegramBot.deleteMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
): Boolean = deleteMessage(chat.id, messageId)
|
): Unit = deleteMessage(chat.id, messageId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteMessage(
|
public suspend fun TelegramBot.deleteMessage(
|
||||||
message: AccessibleMessage
|
message: AccessibleMessage
|
||||||
): Boolean {
|
): Unit {
|
||||||
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
||||||
if (mediaGroupContent == null) {
|
if (mediaGroupContent == null) {
|
||||||
return deleteMessage(message.chat, message.messageId)
|
deleteMessage(message.chat, message.messageId)
|
||||||
} else {
|
} else {
|
||||||
return mediaGroupContent.group.map {
|
mediaGroupContent.group.forEach {
|
||||||
deleteMessage(it.sourceMessage)
|
deleteMessage(it.sourceMessage)
|
||||||
}.all { it }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
): Boolean = deleteMessage(chatId, messageId)
|
): Unit = deleteMessage(chatId, messageId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId
|
messageId: MessageId
|
||||||
): Boolean = deleteMessage(chat, messageId)
|
): Unit = deleteMessage(chat, messageId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
message: AccessibleMessage
|
message: AccessibleMessage
|
||||||
): Boolean = deleteMessage(message)
|
): Unit = deleteMessage(message)
|
||||||
|
|
||||||
public suspend fun AccessibleMessage.delete(
|
public suspend fun AccessibleMessage.delete(
|
||||||
requestsExecutor: TelegramBot
|
requestsExecutor: TelegramBot
|
||||||
): Boolean = requestsExecutor.deleteMessage(this)
|
): Unit = requestsExecutor.deleteMessage(this)
|
||||||
|
|||||||
@@ -10,52 +10,52 @@ import kotlin.jvm.JvmName
|
|||||||
public suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>
|
messageIds: List<MessageId>
|
||||||
): Boolean = messageIds.chunked(deleteMessagesLimit.last).map {
|
): Unit = messageIds.chunked(deleteMessagesLimit.last).forEach {
|
||||||
execute(
|
execute(
|
||||||
DeleteMessages(
|
DeleteMessages(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
messageIds = it
|
messageIds = it
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}.all { it }
|
}
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>
|
messageIds: Array<MessageId>
|
||||||
): Boolean = deleteMessages(
|
): Unit = deleteMessages(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
messageIds = messageIds.toList()
|
messageIds = messageIds.toList()
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
messagesMetas: List<Message.MetaInfo>
|
messagesMetas: List<Message.MetaInfo>
|
||||||
): Boolean = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
|
): Unit = messagesMetas.groupBy { it.chatId }.forEach { (chatId, messages) ->
|
||||||
deleteMessages(
|
deleteMessages(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
messageIds = messages.map { it.messageId }
|
messageIds = messages.map { it.messageId }
|
||||||
)
|
)
|
||||||
}.all { it }
|
}
|
||||||
|
|
||||||
@JvmName("deleteMessagesWithMessages")
|
@JvmName("deleteMessagesWithMessages")
|
||||||
public suspend fun TelegramBot.deleteMessages(
|
public suspend fun TelegramBot.deleteMessages(
|
||||||
messages: List<AccessibleMessage>
|
messages: List<AccessibleMessage>
|
||||||
): Boolean = deleteMessages(messages.map { it.metaInfo })
|
): Unit = deleteMessages(messages.map { it.metaInfo })
|
||||||
|
|
||||||
public suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>
|
messageIds: List<MessageId>
|
||||||
): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
|
): Unit = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||||
|
|
||||||
public suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>
|
messageIds: Array<MessageId>
|
||||||
): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
|
): Unit = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||||
|
|
||||||
public suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
messagesMetas: List<Message.MetaInfo>
|
messagesMetas: List<Message.MetaInfo>
|
||||||
): Boolean = deleteMessages(messagesMetas)
|
): Unit = deleteMessages(messagesMetas)
|
||||||
|
|
||||||
@JvmName("deleteWithMessages")
|
@JvmName("deleteWithMessages")
|
||||||
public suspend fun TelegramBot.delete(
|
public suspend fun TelegramBot.delete(
|
||||||
messages: List<AccessibleMessage>
|
messages: List<AccessibleMessage>
|
||||||
): Boolean = deleteMessages(messages)
|
): Unit = deleteMessages(messages)
|
||||||
|
|||||||
@@ -3,11 +3,15 @@ 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.DirectMessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.EffectId
|
||||||
import dev.inmo.tgbotapi.types.MessageId
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||||
|
import dev.inmo.tgbotapi.types.Seconds
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||||
|
import dev.inmo.tgbotapi.types.directMessageThreadId
|
||||||
import dev.inmo.tgbotapi.types.threadId
|
import dev.inmo.tgbotapi.types.threadId
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
@@ -15,10 +19,23 @@ public suspend fun TelegramBot.forwardMessage(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false,
|
||||||
|
effectId: EffectId? = null
|
||||||
): PossiblyForwardedMessage = execute(
|
): PossiblyForwardedMessage = execute(
|
||||||
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
|
ForwardMessage(
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
toChatId = toChatId,
|
||||||
|
messageId = messageId,
|
||||||
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
effectId = effectId
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
@@ -26,40 +43,105 @@ public suspend fun TelegramBot.forwardMessage(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false,
|
||||||
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent)
|
effectId: EffectId? = null
|
||||||
|
): PossiblyForwardedMessage = forwardMessage(
|
||||||
|
fromChatId = fromChat.id,
|
||||||
|
toChatId = toChatId,
|
||||||
|
messageId = messageId,
|
||||||
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
effectId = effectId
|
||||||
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false,
|
||||||
): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent)
|
effectId: EffectId? = null
|
||||||
|
): PossiblyForwardedMessage = forwardMessage(
|
||||||
|
fromChatId = fromChatId,
|
||||||
|
toChatId = toChat.id,
|
||||||
|
messageId = messageId,
|
||||||
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
effectId = effectId
|
||||||
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
fromChat: Chat,
|
fromChat: Chat,
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false,
|
||||||
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent)
|
effectId: EffectId? = null
|
||||||
|
): PossiblyForwardedMessage = forwardMessage(
|
||||||
|
fromChatId = fromChat.id,
|
||||||
|
toChatId = toChat.id,
|
||||||
|
messageId = messageId,
|
||||||
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
effectId = effectId
|
||||||
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false,
|
||||||
): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent)
|
effectId: EffectId? = null
|
||||||
|
): PossiblyForwardedMessage = forwardMessage(
|
||||||
|
fromChat = message.chat,
|
||||||
|
toChatId = toChatId,
|
||||||
|
messageId = message.messageId,
|
||||||
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
effectId = effectId
|
||||||
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.forwardMessage(
|
public suspend fun TelegramBot.forwardMessage(
|
||||||
toChat: Chat,
|
toChat: Chat,
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
threadId: MessageThreadId? = toChat.id.threadId,
|
threadId: MessageThreadId? = toChat.id.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
|
||||||
|
startTimestamp: Seconds? = null,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false
|
protectContent: Boolean = false,
|
||||||
): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent)
|
effectId: EffectId? = null
|
||||||
|
): PossiblyForwardedMessage = forwardMessage(
|
||||||
|
fromChat = message.chat,
|
||||||
|
toChat = toChat,
|
||||||
|
messageId = message.messageId,
|
||||||
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
|
startTimestamp = startTimestamp,
|
||||||
|
disableNotification = disableNotification,
|
||||||
|
protectContent = protectContent,
|
||||||
|
effectId = effectId
|
||||||
|
)
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>,
|
messageIds: List<MessageId>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -23,6 +24,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
fromChatId = fromChatId,
|
fromChatId = fromChatId,
|
||||||
messageIds = it,
|
messageIds = it,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
@@ -35,6 +37,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>,
|
messageIds: Array<MessageId>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -43,6 +46,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
fromChatId = fromChatId,
|
fromChatId = fromChatId,
|
||||||
messageIds = messageIds.toList(),
|
messageIds = messageIds.toList(),
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
@@ -52,6 +56,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messagesMetas: List<Message.MetaInfo>,
|
messagesMetas: List<Message.MetaInfo>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -61,6 +66,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
fromChatId = chatId,
|
fromChatId = chatId,
|
||||||
messageIds = messages.map { it.messageId },
|
messageIds = messages.map { it.messageId },
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
@@ -72,6 +78,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -79,6 +86,7 @@ public suspend fun TelegramBot.forwardMessages(
|
|||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
messagesMetas = messages.map { it.metaInfo },
|
messagesMetas = messages.map { it.metaInfo },
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
@@ -89,6 +97,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: List<MessageId>,
|
messageIds: List<MessageId>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -97,6 +106,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
fromChatId = fromChatId,
|
fromChatId = fromChatId,
|
||||||
messageIds = messageIds,
|
messageIds = messageIds,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
@@ -107,6 +117,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
fromChatId: ChatIdentifier,
|
fromChatId: ChatIdentifier,
|
||||||
messageIds: Array<MessageId>,
|
messageIds: Array<MessageId>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -115,6 +126,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
fromChatId = fromChatId,
|
fromChatId = fromChatId,
|
||||||
messageIds = messageIds,
|
messageIds = messageIds,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
@@ -124,6 +136,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messagesMetas: List<Message.MetaInfo>,
|
messagesMetas: List<Message.MetaInfo>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -131,6 +144,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
messagesMetas = messagesMetas,
|
messagesMetas = messagesMetas,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
@@ -141,6 +155,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
toChatId: ChatIdentifier,
|
toChatId: ChatIdentifier,
|
||||||
messages: List<AccessibleMessage>,
|
messages: List<AccessibleMessage>,
|
||||||
threadId: MessageThreadId? = toChatId.threadId,
|
threadId: MessageThreadId? = toChatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
removeCaption: Boolean = false
|
removeCaption: Boolean = false
|
||||||
@@ -148,6 +163,7 @@ public suspend fun TelegramBot.forward(
|
|||||||
toChatId = toChatId,
|
toChatId = toChatId,
|
||||||
messages = messages,
|
messages = messages,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
removeCaption = removeCaption
|
removeCaption = removeCaption
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
|||||||
for (update in this) {
|
for (update in this) {
|
||||||
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {
|
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {
|
||||||
if (it.content is MediaGroupPartContent) {
|
if (it.content is MediaGroupPartContent) {
|
||||||
|
@Suppress("UNCHECKED_CAST")
|
||||||
it as PossiblySentViaBotCommonMessage<MediaGroupPartContent>
|
it as PossiblySentViaBotCommonMessage<MediaGroupPartContent>
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
@@ -48,10 +49,4 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
|||||||
return resultUpdates
|
return resultUpdates
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate(): BaseEditMessageUpdate = this
|
||||||
* @return [EditMessageMediaGroupUpdate] in case if [this] is [EditMessageUpdate]. When [this] object is
|
|
||||||
* [EditChannelPostUpdate] instance - will return [EditChannelPostMediaGroupUpdate]
|
|
||||||
*
|
|
||||||
* @throws IllegalStateException
|
|
||||||
*/
|
|
||||||
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate() = this
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package dev.inmo.tgbotapi.extensions.api
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
|
import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
|
||||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
|
||||||
import dev.inmo.tgbotapi.abstracts.Headed
|
import dev.inmo.tgbotapi.abstracts.Headed
|
||||||
import dev.inmo.tgbotapi.abstracts.HorizontallyAccured
|
import dev.inmo.tgbotapi.abstracts.HorizontallyAccured
|
||||||
import dev.inmo.tgbotapi.abstracts.Locationed
|
import dev.inmo.tgbotapi.abstracts.Locationed
|
||||||
@@ -16,9 +15,11 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
|||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||||
import dev.inmo.tgbotapi.types.location.Location
|
import dev.inmo.tgbotapi.types.location.Location
|
||||||
|
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.LiveLocationContent
|
import dev.inmo.tgbotapi.types.message.content.LiveLocationContent
|
||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
|
import dev.inmo.tgbotapi.utils.launchWithBotLogger
|
||||||
import kotlinx.coroutines.CoroutineStart
|
import kotlinx.coroutines.CoroutineStart
|
||||||
import kotlinx.coroutines.currentCoroutineContext
|
import kotlinx.coroutines.currentCoroutineContext
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
@@ -50,11 +51,13 @@ public suspend fun TelegramBot.handleLiveLocation(
|
|||||||
locationsFlow: Flow<EditLiveLocationInfo>,
|
locationsFlow: Flow<EditLiveLocationInfo>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
replyParameters: ReplyParameters? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
@@ -63,7 +66,7 @@ public suspend fun TelegramBot.handleLiveLocation(
|
|||||||
null
|
null
|
||||||
} else {
|
} else {
|
||||||
val scope = currentCoroutineContext().LinkedSupervisorScope()
|
val scope = currentCoroutineContext().LinkedSupervisorScope()
|
||||||
scope.launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
|
scope.launchWithBotLogger(start = CoroutineStart.LAZY) {
|
||||||
while (scope.isActive) {
|
while (scope.isActive) {
|
||||||
delay(liveTimeMillis)
|
delay(liveTimeMillis)
|
||||||
// Remove previous location message info to resend live location message
|
// Remove previous location message info to resend live location message
|
||||||
@@ -76,25 +79,27 @@ public suspend fun TelegramBot.handleLiveLocation(
|
|||||||
if (capturedLiveLocationMessage == null) {
|
if (capturedLiveLocationMessage == null) {
|
||||||
updateMessageJob ?.start()
|
updateMessageJob ?.start()
|
||||||
currentLiveLocationMessage = send(
|
currentLiveLocationMessage = send(
|
||||||
chatId,
|
chatId = chatId,
|
||||||
it.latitude,
|
latitude = it.latitude,
|
||||||
it.longitude,
|
longitude = it.longitude,
|
||||||
if (liveTimeMillis == indefiniteLivePeriodDelayMillis) {
|
livePeriod = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) {
|
||||||
LiveLocation.INDEFINITE_LIVE_PERIOD
|
LiveLocation.INDEFINITE_LIVE_PERIOD
|
||||||
} else {
|
} else {
|
||||||
ceil(liveTimeMillis.toDouble() / 1000).toInt()
|
ceil(liveTimeMillis.toDouble() / 1000).toInt()
|
||||||
},
|
},
|
||||||
it.horizontalAccuracy,
|
horizontalAccuracy = it.horizontalAccuracy,
|
||||||
it.heading,
|
heading = it.heading,
|
||||||
it.proximityAlertRadius,
|
proximityAlertRadius = it.proximityAlertRadius,
|
||||||
threadId,
|
threadId = threadId,
|
||||||
businessConnectionId,
|
directMessageThreadId = directMessageThreadId,
|
||||||
disableNotification,
|
businessConnectionId = businessConnectionId,
|
||||||
protectContent,
|
disableNotification = disableNotification,
|
||||||
allowPaidBroadcast,
|
protectContent = protectContent,
|
||||||
effectId,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
replyParameters,
|
effectId = effectId,
|
||||||
it.replyMarkup
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
|
replyParameters = replyParameters,
|
||||||
|
replyMarkup = it.replyMarkup
|
||||||
).also {
|
).also {
|
||||||
sentMessageFlow ?.emit(it)
|
sentMessageFlow ?.emit(it)
|
||||||
}
|
}
|
||||||
@@ -125,11 +130,13 @@ public suspend fun TelegramBot.handleLiveLocation(
|
|||||||
locationsFlow: Flow<Location>,
|
locationsFlow: Flow<Location>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
replyParameters: ReplyParameters? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
@@ -147,11 +154,13 @@ public suspend fun TelegramBot.handleLiveLocation(
|
|||||||
},
|
},
|
||||||
liveTimeMillis = liveTimeMillis,
|
liveTimeMillis = liveTimeMillis,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = replyParameters,
|
replyParameters = replyParameters,
|
||||||
sentMessageFlow = sentMessageFlow
|
sentMessageFlow = sentMessageFlow
|
||||||
)
|
)
|
||||||
@@ -168,11 +177,13 @@ public suspend fun TelegramBot.handleLiveLocation(
|
|||||||
locationsFlow: Flow<Pair<Double, Double>>,
|
locationsFlow: Flow<Pair<Double, Double>>,
|
||||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
replyParameters: ReplyParameters? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
||||||
) {
|
) {
|
||||||
@@ -186,11 +197,13 @@ public suspend fun TelegramBot.handleLiveLocation(
|
|||||||
},
|
},
|
||||||
liveTimeMillis = liveTimeMillis,
|
liveTimeMillis = liveTimeMillis,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = replyParameters,
|
replyParameters = replyParameters,
|
||||||
sentMessageFlow = sentMessageFlow
|
sentMessageFlow = sentMessageFlow
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@file:Suppress("KDocUnresolvedReference")
|
||||||
|
|
||||||
package dev.inmo.tgbotapi.extensions.api
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
import korlibs.time.DateTime
|
import korlibs.time.DateTime
|
||||||
@@ -11,11 +13,13 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
|||||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||||
import dev.inmo.tgbotapi.types.chat.Chat
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
|
||||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||||
|
import dev.inmo.tgbotapi.utils.extensions.directMessageThreadIdOrNull
|
||||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||||
import io.ktor.utils.io.core.Closeable
|
import io.ktor.utils.io.core.Closeable
|
||||||
import korlibs.time.millisecondsLong
|
import korlibs.time.millisecondsLong
|
||||||
@@ -96,11 +100,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
replyParameters: ReplyParameters? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider {
|
): LiveLocationProvider {
|
||||||
@@ -115,11 +121,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
heading = initHeading,
|
heading = initHeading,
|
||||||
proximityAlertRadius = initProximityAlertRadius,
|
proximityAlertRadius = initProximityAlertRadius,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = replyParameters,
|
replyParameters = replyParameters,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
@@ -147,11 +155,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
|
||||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
replyParameters: ReplyParameters? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -164,11 +174,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading = initHeading,
|
initHeading = initHeading,
|
||||||
initProximityAlertRadius = initProximityAlertRadius,
|
initProximityAlertRadius = initProximityAlertRadius,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = replyParameters,
|
replyParameters = replyParameters,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
@@ -186,11 +198,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
threadId: MessageThreadId? = chatId.threadId,
|
threadId: MessageThreadId? = chatId.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
replyParameters: ReplyParameters? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -203,11 +217,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading = initHeading,
|
initHeading = initHeading,
|
||||||
initProximityAlertRadius = initProximityAlertRadius,
|
initProximityAlertRadius = initProximityAlertRadius,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = replyParameters,
|
replyParameters = replyParameters,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
@@ -225,11 +241,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
threadId: MessageThreadId? = chat.id.threadId,
|
threadId: MessageThreadId? = chat.id.threadId,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
|
||||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
replyParameters: ReplyParameters? = null,
|
replyParameters: ReplyParameters? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -242,11 +260,13 @@ public suspend fun TelegramBot.startLiveLocation(
|
|||||||
initHeading = initHeading,
|
initHeading = initHeading,
|
||||||
initProximityAlertRadius = initProximityAlertRadius,
|
initProximityAlertRadius = initProximityAlertRadius,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = replyParameters,
|
replyParameters = replyParameters,
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
@@ -265,11 +285,13 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
threadId: MessageThreadId? = to.threadIdOrNull,
|
threadId: MessageThreadId? = to.threadIdOrNull,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull,
|
||||||
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -282,11 +304,13 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading = initHeading,
|
initHeading = initHeading,
|
||||||
initProximityAlertRadius = initProximityAlertRadius,
|
initProximityAlertRadius = initProximityAlertRadius,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
|
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
@@ -304,11 +328,13 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading: Degrees? = null,
|
initHeading: Degrees? = null,
|
||||||
initProximityAlertRadius: Meters? = null,
|
initProximityAlertRadius: Meters? = null,
|
||||||
threadId: MessageThreadId? = to.threadIdOrNull,
|
threadId: MessageThreadId? = to.threadIdOrNull,
|
||||||
|
directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull,
|
||||||
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
|
||||||
disableNotification: Boolean = false,
|
disableNotification: Boolean = false,
|
||||||
protectContent: Boolean = false,
|
protectContent: Boolean = false,
|
||||||
allowPaidBroadcast: Boolean = false,
|
allowPaidBroadcast: Boolean = false,
|
||||||
effectId: EffectId? = null,
|
effectId: EffectId? = null,
|
||||||
|
suggestedPostParameters: SuggestedPostParameters? = null,
|
||||||
allowSendingWithoutReply: Boolean? = null,
|
allowSendingWithoutReply: Boolean? = null,
|
||||||
replyMarkup: KeyboardMarkup? = null
|
replyMarkup: KeyboardMarkup? = null
|
||||||
): LiveLocationProvider = startLiveLocation(
|
): LiveLocationProvider = startLiveLocation(
|
||||||
@@ -320,11 +346,13 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
|
|||||||
initHeading = initHeading,
|
initHeading = initHeading,
|
||||||
initProximityAlertRadius = initProximityAlertRadius,
|
initProximityAlertRadius = initProximityAlertRadius,
|
||||||
threadId = threadId,
|
threadId = threadId,
|
||||||
|
directMessageThreadId = directMessageThreadId,
|
||||||
businessConnectionId = businessConnectionId,
|
businessConnectionId = businessConnectionId,
|
||||||
disableNotification = disableNotification,
|
disableNotification = disableNotification,
|
||||||
protectContent = protectContent,
|
protectContent = protectContent,
|
||||||
allowPaidBroadcast = allowPaidBroadcast,
|
allowPaidBroadcast = allowPaidBroadcast,
|
||||||
effectId = effectId,
|
effectId = effectId,
|
||||||
|
suggestedPostParameters = suggestedPostParameters,
|
||||||
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
|
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
|
||||||
replyMarkup = replyMarkup
|
replyMarkup = replyMarkup
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
|
|||||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
import dev.inmo.tgbotapi.requests.local.LogOut
|
import dev.inmo.tgbotapi.requests.local.LogOut
|
||||||
|
|
||||||
public suspend inline fun TelegramBot.logOut(): Boolean = execute(LogOut)
|
public suspend inline fun TelegramBot.logOut(): Unit = execute(LogOut)
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.SavePreparedKeyboardButton
|
||||||
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.KeyboardButton
|
||||||
|
import dev.inmo.tgbotapi.types.buttons.PreparedKeyboardButton
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
import dev.inmo.tgbotapi.types.toChatId
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.savePreparedKeyboardButton(
|
||||||
|
userId: ChatId,
|
||||||
|
button: KeyboardButton
|
||||||
|
): PreparedKeyboardButton = execute(
|
||||||
|
SavePreparedKeyboardButton(userId = userId, button = button)
|
||||||
|
)
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.savePreparedKeyboardButton(
|
||||||
|
user: User,
|
||||||
|
button: KeyboardButton
|
||||||
|
): PreparedKeyboardButton = savePreparedKeyboardButton(userId = user.id.toChatId(), button = button)
|
||||||
@@ -11,7 +11,7 @@ public suspend fun TelegramBot.answerCallbackQuery(
|
|||||||
showAlert: Boolean? = null,
|
showAlert: Boolean? = null,
|
||||||
url: String? = null,
|
url: String? = null,
|
||||||
cachedTimeSeconds: Int? = null
|
cachedTimeSeconds: Int? = null
|
||||||
): Boolean = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds))
|
): Unit = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds))
|
||||||
|
|
||||||
public suspend fun TelegramBot.answerCallbackQuery(
|
public suspend fun TelegramBot.answerCallbackQuery(
|
||||||
callbackQuery: CallbackQuery,
|
callbackQuery: CallbackQuery,
|
||||||
@@ -19,7 +19,7 @@ public suspend fun TelegramBot.answerCallbackQuery(
|
|||||||
showAlert: Boolean? = null,
|
showAlert: Boolean? = null,
|
||||||
url: String? = null,
|
url: String? = null,
|
||||||
cachedTimeSeconds: Int? = null
|
cachedTimeSeconds: Int? = null
|
||||||
): Boolean = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
): Unit = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
||||||
|
|
||||||
public suspend fun TelegramBot.answer(
|
public suspend fun TelegramBot.answer(
|
||||||
callbackQuery: CallbackQuery,
|
callbackQuery: CallbackQuery,
|
||||||
@@ -27,4 +27,4 @@ public suspend fun TelegramBot.answer(
|
|||||||
showAlert: Boolean? = null,
|
showAlert: Boolean? = null,
|
||||||
url: String? = null,
|
url: String? = null,
|
||||||
cachedTimeSeconds: Int? = null
|
cachedTimeSeconds: Int? = null
|
||||||
): Boolean = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
): Unit = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.answers
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.answers.AnswerGuestQuery
|
||||||
|
import dev.inmo.tgbotapi.types.GuestQueryId
|
||||||
|
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||||
|
import dev.inmo.tgbotapi.types.guest.SentGuestMessage
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.answerGuestQuery(
|
||||||
|
guestQueryId: GuestQueryId,
|
||||||
|
result: InlineQueryResult
|
||||||
|
): SentGuestMessage = execute(AnswerGuestQuery(guestQueryId, result))
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.answer(
|
||||||
|
guestQueryId: GuestQueryId,
|
||||||
|
result: InlineQueryResult
|
||||||
|
): SentGuestMessage = execute(AnswerGuestQuery(guestQueryId, result))
|
||||||
@@ -14,7 +14,7 @@ public suspend fun TelegramBot.answerInlineQuery(
|
|||||||
isPersonal: Boolean? = null,
|
isPersonal: Boolean? = null,
|
||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
button: InlineQueryResultsButton? = null
|
button: InlineQueryResultsButton? = null
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button)
|
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ public suspend fun TelegramBot.answerInlineQuery(
|
|||||||
isPersonal: Boolean? = null,
|
isPersonal: Boolean? = null,
|
||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
button: InlineQueryResultsButton? = null
|
button: InlineQueryResultsButton? = null
|
||||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
||||||
|
|
||||||
public suspend fun TelegramBot.answer(
|
public suspend fun TelegramBot.answer(
|
||||||
inlineQuery: InlineQuery,
|
inlineQuery: InlineQuery,
|
||||||
@@ -34,7 +34,7 @@ public suspend fun TelegramBot.answer(
|
|||||||
isPersonal: Boolean? = null,
|
isPersonal: Boolean? = null,
|
||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
button: InlineQueryResultsButton? = null
|
button: InlineQueryResultsButton? = null
|
||||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
||||||
|
|
||||||
public suspend fun TelegramBot.answerInlineQuery(
|
public suspend fun TelegramBot.answerInlineQuery(
|
||||||
inlineQueryID: InlineQueryId,
|
inlineQueryID: InlineQueryId,
|
||||||
@@ -44,7 +44,7 @@ public suspend fun TelegramBot.answerInlineQuery(
|
|||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
switchPmText: String?,
|
switchPmText: String?,
|
||||||
switchPmParameter: String?
|
switchPmParameter: String?
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ public suspend fun TelegramBot.answerInlineQuery(
|
|||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
switchPmText: String?,
|
switchPmText: String?,
|
||||||
switchPmParameter: String?
|
switchPmParameter: String?
|
||||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
|
|
||||||
public suspend fun TelegramBot.answer(
|
public suspend fun TelegramBot.answer(
|
||||||
inlineQuery: InlineQuery,
|
inlineQuery: InlineQuery,
|
||||||
@@ -66,4 +66,4 @@ public suspend fun TelegramBot.answer(
|
|||||||
nextOffset: String? = null,
|
nextOffset: String? = null,
|
||||||
switchPmText: String?,
|
switchPmText: String?,
|
||||||
switchPmParameter: String?
|
switchPmParameter: String?
|
||||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
): Unit = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
|||||||
|
|
||||||
public suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
public suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
||||||
id: PreCheckoutQueryId
|
id: PreCheckoutQueryId
|
||||||
): Boolean = execute(AnswerPreCheckoutQueryOk(id))
|
): Unit = execute(AnswerPreCheckoutQueryOk(id))
|
||||||
public suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
public suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
||||||
preCheckoutQuery: PreCheckoutQuery
|
preCheckoutQuery: PreCheckoutQuery
|
||||||
): Boolean = answerPreCheckoutQueryOk(preCheckoutQuery.id)
|
): Unit = answerPreCheckoutQueryOk(preCheckoutQuery.id)
|
||||||
|
|
||||||
public suspend fun TelegramBot.answerPreCheckoutQueryError(
|
public suspend fun TelegramBot.answerPreCheckoutQueryError(
|
||||||
id: PreCheckoutQueryId,
|
id: PreCheckoutQueryId,
|
||||||
error: String
|
error: String
|
||||||
): Boolean = execute(AnswerPreCheckoutQueryError(id, error))
|
): Unit = execute(AnswerPreCheckoutQueryError(id, error))
|
||||||
public suspend fun TelegramBot.answerPreCheckoutQueryError(
|
public suspend fun TelegramBot.answerPreCheckoutQueryError(
|
||||||
preCheckoutQuery: PreCheckoutQuery,
|
preCheckoutQuery: PreCheckoutQuery,
|
||||||
error: String
|
error: String
|
||||||
): Boolean = answerPreCheckoutQueryError(preCheckoutQuery.id, error)
|
): Unit = answerPreCheckoutQueryError(preCheckoutQuery.id, error)
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ import dev.inmo.tgbotapi.types.payments.ShippingQuery
|
|||||||
public suspend fun TelegramBot.answerShippingQueryOk(
|
public suspend fun TelegramBot.answerShippingQueryOk(
|
||||||
id: ShippingQueryId,
|
id: ShippingQueryId,
|
||||||
shippingOptions: List<ShippingOption>
|
shippingOptions: List<ShippingOption>
|
||||||
): Boolean = execute(AnswerShippingQueryOk(id, shippingOptions))
|
): Unit = execute(AnswerShippingQueryOk(id, shippingOptions))
|
||||||
public suspend fun TelegramBot.answerShippingQueryOk(
|
public suspend fun TelegramBot.answerShippingQueryOk(
|
||||||
shippingQuery: ShippingQuery,
|
shippingQuery: ShippingQuery,
|
||||||
shippingOptions: List<ShippingOption>
|
shippingOptions: List<ShippingOption>
|
||||||
): Boolean = answerShippingQueryOk(shippingQuery.id, shippingOptions)
|
): Unit = answerShippingQueryOk(shippingQuery.id, shippingOptions)
|
||||||
|
|
||||||
public suspend fun TelegramBot.answerShippingQueryError(
|
public suspend fun TelegramBot.answerShippingQueryError(
|
||||||
id: ShippingQueryId,
|
id: ShippingQueryId,
|
||||||
error: String
|
error: String
|
||||||
): Boolean = execute(AnswerShippingQueryError(id, error))
|
): Unit = execute(AnswerShippingQueryError(id, error))
|
||||||
public suspend fun TelegramBot.answerShippingQueryError(
|
public suspend fun TelegramBot.answerShippingQueryError(
|
||||||
shippingQuery: ShippingQuery,
|
shippingQuery: ShippingQuery,
|
||||||
error: String
|
error: String
|
||||||
): Boolean = answerShippingQueryError(shippingQuery.id, error)
|
): Unit = answerShippingQueryError(shippingQuery.id, error)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import dev.inmo.tgbotapi.requests.bot.ClearMyDefaultAdministratorRights
|
|||||||
|
|
||||||
public suspend fun TelegramBot.clearMyDefaultAdministratorRights(
|
public suspend fun TelegramBot.clearMyDefaultAdministratorRights(
|
||||||
forChannels: Boolean? = null
|
forChannels: Boolean? = null
|
||||||
): Boolean = execute(ClearMyDefaultAdministratorRights(forChannels))
|
): Unit = execute(ClearMyDefaultAdministratorRights(forChannels))
|
||||||
|
|
||||||
public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForChannels(): Boolean = clearMyDefaultAdministratorRights(forChannels = true)
|
public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForChannels(): Unit = clearMyDefaultAdministratorRights(forChannels = true)
|
||||||
|
|
||||||
public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForGroupsAndSupergroups(): Boolean = clearMyDefaultAdministratorRights(forChannels = false)
|
public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForGroupsAndSupergroups(): Unit = clearMyDefaultAdministratorRights(forChannels = false)
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
public suspend fun TelegramBot.deleteMyCommands(
|
public suspend fun TelegramBot.deleteMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLang?
|
languageCode: IetfLang?
|
||||||
): Boolean = execute(DeleteMyCommands(scope, languageCode))
|
): Unit = execute(DeleteMyCommands(scope, languageCode))
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteMyCommands(
|
public suspend fun TelegramBot.deleteMyCommands(
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String? = null
|
languageCode: String? = null
|
||||||
): Boolean = deleteMyCommands(scope, languageCode ?.let(::IetfLang))
|
): Unit = deleteMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.bot.GetMe
|
||||||
|
import dev.inmo.tgbotapi.requests.bot.GetMyStarBalance
|
||||||
|
import dev.inmo.tgbotapi.types.chat.ExtendedBot
|
||||||
|
import dev.inmo.tgbotapi.types.payments.stars.StarAmount
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.getMyStarBalance(): StarAmount = execute(GetMyStarBalance)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.bot.RemoveMyProfilePhoto
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.removeMyProfilePhoto(): Unit = execute(RemoveMyProfilePhoto)
|
||||||
@@ -11,22 +11,22 @@ public suspend fun TelegramBot.setMyCommands(
|
|||||||
commands: List<BotCommand>,
|
commands: List<BotCommand>,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLang?
|
languageCode: IetfLang?
|
||||||
): Boolean = execute(SetMyCommands(commands, scope, languageCode))
|
): Unit = execute(SetMyCommands(commands, scope, languageCode))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyCommands(
|
public suspend fun TelegramBot.setMyCommands(
|
||||||
vararg commands: BotCommand,
|
vararg commands: BotCommand,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: IetfLang?
|
languageCode: IetfLang?
|
||||||
): Boolean = setMyCommands(commands.toList(), scope, languageCode)
|
): Unit = setMyCommands(commands.toList(), scope, languageCode)
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyCommands(
|
public suspend fun TelegramBot.setMyCommands(
|
||||||
commands: List<BotCommand>,
|
commands: List<BotCommand>,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String? = null
|
languageCode: String? = null
|
||||||
): Boolean = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
|
): Unit = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyCommands(
|
public suspend fun TelegramBot.setMyCommands(
|
||||||
vararg commands: BotCommand,
|
vararg commands: BotCommand,
|
||||||
scope: BotCommandScope = BotCommandScopeDefault,
|
scope: BotCommandScope = BotCommandScopeDefault,
|
||||||
languageCode: String? = null
|
languageCode: String? = null
|
||||||
): Boolean = setMyCommands(commands.toList(), scope, languageCode)
|
): Unit = setMyCommands(commands.toList(), scope, languageCode)
|
||||||
|
|||||||
@@ -7,12 +7,12 @@ import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
|||||||
public suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
public suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
||||||
rights: ChatCommonAdministratorRights,
|
rights: ChatCommonAdministratorRights,
|
||||||
forChannels: Boolean? = null
|
forChannels: Boolean? = null
|
||||||
): Boolean = execute(SetMyDefaultAdministratorRights(rights, forChannels))
|
): Unit = execute(SetMyDefaultAdministratorRights(rights, forChannels))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
|
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
|
||||||
rights: ChatCommonAdministratorRights
|
rights: ChatCommonAdministratorRights
|
||||||
): Boolean = setMyDefaultAdministratorRights(rights, forChannels = true)
|
): Unit = setMyDefaultAdministratorRights(rights, forChannels = true)
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
|
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
|
||||||
rights: ChatCommonAdministratorRights
|
rights: ChatCommonAdministratorRights
|
||||||
): Boolean = setMyDefaultAdministratorRights(rights, forChannels = false)
|
): Unit = setMyDefaultAdministratorRights(rights, forChannels = false)
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
public suspend fun TelegramBot.setMyDescription(
|
public suspend fun TelegramBot.setMyDescription(
|
||||||
description: String? = null,
|
description: String? = null,
|
||||||
languageCode: IetfLang? = null
|
languageCode: IetfLang? = null
|
||||||
): Boolean = execute(SetMyDescription(description, languageCode))
|
): Unit = execute(SetMyDescription(description, languageCode))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyDescription(
|
public suspend fun TelegramBot.setMyDescription(
|
||||||
description: String?,
|
description: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
): Boolean = setMyDescription(description, languageCode ?.let(::IetfLang))
|
): Unit = setMyDescription(description, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
|||||||
public suspend fun TelegramBot.setMyName(
|
public suspend fun TelegramBot.setMyName(
|
||||||
name: String? = null,
|
name: String? = null,
|
||||||
languageCode: IetfLang? = null
|
languageCode: IetfLang? = null
|
||||||
): Boolean = execute(SetMyName(name, languageCode))
|
): Unit = execute(SetMyName(name, languageCode))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyName(
|
public suspend fun TelegramBot.setMyName(
|
||||||
name: String?,
|
name: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
): Boolean = setMyName(name, languageCode ?.let(::IetfLang))
|
): Unit = setMyName(name, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.bot
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.bot.SetMyProfilePhoto
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.InputProfilePhoto
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setMyProfilePhoto(
|
||||||
|
photo: InputProfilePhoto
|
||||||
|
): Unit = execute(SetMyProfilePhoto(photo))
|
||||||
@@ -7,9 +7,9 @@ import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
|||||||
public suspend fun TelegramBot.setMyShortDescription(
|
public suspend fun TelegramBot.setMyShortDescription(
|
||||||
shortDescription: String? = null,
|
shortDescription: String? = null,
|
||||||
languageCode: IetfLang? = null
|
languageCode: IetfLang? = null
|
||||||
): Boolean = execute(SetMyShortDescription(shortDescription, languageCode))
|
): Unit = execute(SetMyShortDescription(shortDescription, languageCode))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setMyShortDescription(
|
public suspend fun TelegramBot.setMyShortDescription(
|
||||||
shortDescription: String?,
|
shortDescription: String?,
|
||||||
languageCode: String?
|
languageCode: String?
|
||||||
): Boolean = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))
|
): Unit = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.ConvertGiftToStars
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.GiftId
|
||||||
|
import dev.inmo.tgbotapi.types.gifts.Gift
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.convertGiftToStars(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
ownedGiftId: GiftId
|
||||||
|
): Unit = execute(
|
||||||
|
ConvertGiftToStars(businessConnectionId, ownedGiftId)
|
||||||
|
)
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.convertGiftToStars(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
gift: Gift.Regular
|
||||||
|
): Unit = convertGiftToStars(
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
ownedGiftId = with(gift) {id}
|
||||||
|
)
|
||||||
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.DeleteBusinessMessages
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
|
||||||
|
@GenerateVariations
|
||||||
|
public suspend fun TelegramBot.deleteBusinessMessages(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
@GenerationVariant(List::class, "messages.map { it.messageId }", "messages", AccessibleMessage::class)
|
||||||
|
messageIds: List<MessageId>
|
||||||
|
): Unit = execute(
|
||||||
|
DeleteBusinessMessages(businessConnectionId, messageIds)
|
||||||
|
)
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY
|
||||||
|
// TO REGENERATE IT JUST DELETE FILE
|
||||||
|
// ORIGINAL FILE: DeleteBusinessMessages.kt
|
||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
import kotlin.Boolean
|
||||||
|
import kotlin.collections.List
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.deleteBusinessMessages(businessConnectionId: BusinessConnectionId,
|
||||||
|
messages: List<AccessibleMessage>): Unit = deleteBusinessMessages(
|
||||||
|
businessConnectionId = businessConnectionId, messageIds = with(messages) {messages.map {
|
||||||
|
it.messageId }}
|
||||||
|
)
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.GetBusinessAccountGifts
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.OwnedGifts
|
||||||
|
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
|
||||||
|
import dev.inmo.tgbotapi.types.gifts.OwnedGift
|
||||||
|
import kotlinx.coroutines.flow.Flow
|
||||||
|
import kotlinx.coroutines.flow.flow
|
||||||
|
import kotlin.runCatching
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.getBusinessAccountGifts(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
excludeUnsaved: Boolean = false,
|
||||||
|
excludeSaved: Boolean = false,
|
||||||
|
excludeUnlimited: Boolean = false,
|
||||||
|
excludeLimitedUpgradable: Boolean = false,
|
||||||
|
excludeLimitedNonUpgradable: Boolean = false,
|
||||||
|
excludeUnique: Boolean = false,
|
||||||
|
excludeFromBlockchain: Boolean = false,
|
||||||
|
sortByPrice: Boolean = false,
|
||||||
|
offset: String? = null,
|
||||||
|
limit: Int? = null
|
||||||
|
): OwnedGifts<OwnedGift.OwnedByBusinessAccount> = execute(
|
||||||
|
GetBusinessAccountGifts(
|
||||||
|
businessConnectionId,
|
||||||
|
excludeUnsaved,
|
||||||
|
excludeSaved,
|
||||||
|
excludeUnlimited,
|
||||||
|
excludeLimitedUpgradable,
|
||||||
|
excludeLimitedNonUpgradable,
|
||||||
|
excludeUnique,
|
||||||
|
excludeFromBlockchain,
|
||||||
|
sortByPrice,
|
||||||
|
offset,
|
||||||
|
limit
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a flow that emits business account gifts in a paginated manner.
|
||||||
|
*
|
||||||
|
* This function will automatically handle pagination by using the `nextOffset` from each response
|
||||||
|
* to fetch the next page of gifts until there are no more gifts to fetch.
|
||||||
|
*
|
||||||
|
* @param businessConnectionId The ID of the business connection
|
||||||
|
* @param excludeUnsaved Whether to exclude unsaved gifts
|
||||||
|
* @param excludeSaved Whether to exclude saved gifts
|
||||||
|
* @param excludeUnlimited Whether to exclude unlimited gifts
|
||||||
|
* @param excludeLimitedUpgradable Whether to exclude limited upgradable gifts
|
||||||
|
* @param excludeLimitedNonUpgradable Whether to exclude limited non-upgradable gifts
|
||||||
|
* @param excludeUnique Whether to exclude unique gifts
|
||||||
|
* @param excludeFromBlockchain Whether to exclude gifts from blockchain
|
||||||
|
* @param sortByPrice Whether to sort gifts by price
|
||||||
|
* @param initialOffset The initial offset to start fetching from. If null, starts from the beginning
|
||||||
|
* @param limit The maximum number of gifts to fetch per request
|
||||||
|
* @param onErrorContinueChecker A function that determines whether to continue fetching on error.
|
||||||
|
* Returns true to continue, false to stop. Default is to stop on any error.
|
||||||
|
* @return A flow that emits [OwnedGifts] containing the fetched gifts
|
||||||
|
*/
|
||||||
|
public fun TelegramBot.getBusinessAccountGiftsFlow(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
excludeUnsaved: Boolean = false,
|
||||||
|
excludeSaved: Boolean = false,
|
||||||
|
excludeUnlimited: Boolean = false,
|
||||||
|
excludeLimitedUpgradable: Boolean = false,
|
||||||
|
excludeLimitedNonUpgradable: Boolean = false,
|
||||||
|
excludeUnique: Boolean = false,
|
||||||
|
excludeFromBlockchain: Boolean = false,
|
||||||
|
sortByPrice: Boolean = false,
|
||||||
|
initialOffset: String? = null,
|
||||||
|
limit: Int? = null,
|
||||||
|
onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false }
|
||||||
|
): Flow<OwnedGifts<OwnedGift.OwnedByBusinessAccount>> = flow {
|
||||||
|
var currentOffset = initialOffset
|
||||||
|
do {
|
||||||
|
val response = runCatching {
|
||||||
|
getBusinessAccountGifts(
|
||||||
|
businessConnectionId,
|
||||||
|
excludeUnsaved,
|
||||||
|
excludeSaved,
|
||||||
|
excludeUnlimited,
|
||||||
|
excludeLimitedUpgradable,
|
||||||
|
excludeLimitedNonUpgradable,
|
||||||
|
excludeUnique,
|
||||||
|
excludeFromBlockchain,
|
||||||
|
sortByPrice,
|
||||||
|
currentOffset,
|
||||||
|
limit
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if (response.isSuccess) {
|
||||||
|
val result = response.getOrThrow()
|
||||||
|
emit(result)
|
||||||
|
currentOffset = result.nextOffset
|
||||||
|
} else {
|
||||||
|
if (onErrorContinueChecker(response.exceptionOrNull())) {
|
||||||
|
continue
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (currentOffset != null)
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.GetBusinessAccountStarBalance
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.payments.stars.StarAmount
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.getBusinessAccountStarBalance(
|
||||||
|
businessConnectionId: BusinessConnectionId
|
||||||
|
): StarAmount = execute(
|
||||||
|
GetBusinessAccountStarBalance(businessConnectionId)
|
||||||
|
)
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.ReadBusinessMessage
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||||
|
import dev.inmo.tgbotapi.types.toChatId
|
||||||
|
|
||||||
|
@GenerateVariations
|
||||||
|
public suspend fun TelegramBot.readBusinessMessage(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
@GenerationVariant(Chat::class, "chat.id.toChatId()", "chat")
|
||||||
|
chatId: ChatId,
|
||||||
|
messageId: MessageId
|
||||||
|
): Unit = execute(
|
||||||
|
ReadBusinessMessage(businessConnectionId, chatId, messageId)
|
||||||
|
)
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.readBusinessMessage(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
message: AccessibleMessage
|
||||||
|
): Unit = readBusinessMessage(businessConnectionId, message.chat.id.toChatId(), message.messageId)
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY
|
||||||
|
// TO REGENERATE IT JUST DELETE FILE
|
||||||
|
// ORIGINAL FILE: ReadBusinessMessage.kt
|
||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.types.MessageId
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.chat.Chat
|
||||||
|
import dev.inmo.tgbotapi.types.toChatId
|
||||||
|
import kotlin.Boolean
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.readBusinessMessage(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
chat: Chat,
|
||||||
|
messageId: MessageId,
|
||||||
|
): Unit = readBusinessMessage(
|
||||||
|
businessConnectionId = businessConnectionId, chatId = with(chat) {chat.id.toChatId()}, messageId
|
||||||
|
= messageId
|
||||||
|
)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.RemoveBusinessAccountProfilePhoto
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.removeBusinessAccountProfilePhoto(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
isPublic: Boolean = false
|
||||||
|
): Unit = execute(
|
||||||
|
RemoveBusinessAccountProfilePhoto(businessConnectionId = businessConnectionId, isPublic = isPublic)
|
||||||
|
)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountBio
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setBusinessAccountBio(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
bio: String
|
||||||
|
): Unit = execute(
|
||||||
|
SetBusinessAccountBio(businessConnectionId, bio)
|
||||||
|
)
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountGiftSettings
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.gifts.AcceptedGiftTypes
|
||||||
|
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gift settings for a business account
|
||||||
|
*/
|
||||||
|
public suspend fun TelegramBot.setBusinessAccountGiftSettings(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
showGiftButton: Boolean,
|
||||||
|
acceptedGiftTypes: AcceptedGiftTypes
|
||||||
|
): Unit = execute(
|
||||||
|
SetBusinessAccountGiftSettings(
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
showGiftButton = showGiftButton,
|
||||||
|
acceptedGiftTypes = acceptedGiftTypes
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the gift settings for a business account using business message context
|
||||||
|
*/
|
||||||
|
public suspend fun TelegramBot.setBusinessAccountGiftSettings(
|
||||||
|
message: BusinessContentMessage<*>,
|
||||||
|
showGiftButton: Boolean,
|
||||||
|
acceptedGiftTypes: AcceptedGiftTypes
|
||||||
|
): Unit = setBusinessAccountGiftSettings(
|
||||||
|
businessConnectionId = message.businessConnectionId,
|
||||||
|
showGiftButton = showGiftButton,
|
||||||
|
acceptedGiftTypes = acceptedGiftTypes
|
||||||
|
)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountName
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setBusinessAccountName(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
firstName: String,
|
||||||
|
lastName: String? = null
|
||||||
|
): Unit = execute(
|
||||||
|
SetBusinessAccountName(businessConnectionId, firstName, lastName)
|
||||||
|
)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.InputProfilePhoto
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountProfilePhoto
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setBusinessAccountProfilePhoto(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
photo: InputProfilePhoto,
|
||||||
|
isPublic: Boolean = false
|
||||||
|
): Unit = execute(
|
||||||
|
SetBusinessAccountProfilePhoto(businessConnectionId, photo, isPublic)
|
||||||
|
)
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountUsername
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.Username
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setBusinessAccountUsername(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
username: Username? = null
|
||||||
|
): Unit = execute(
|
||||||
|
SetBusinessAccountUsername(businessConnectionId, username)
|
||||||
|
)
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY
|
||||||
|
// TO REGENERATE IT JUST DELETE FILE
|
||||||
|
// ORIGINAL FILE: SetBusinessAccountUsername.kt
|
||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.types.Username
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import kotlin.Boolean
|
||||||
|
import kotlin.String
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setBusinessAccountUsername(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
username: String?
|
||||||
|
): Unit = setBusinessAccountUsername(
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
username = username ?.let { Username.prepare(username) }
|
||||||
|
)
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.TransferBusinessAccountStars
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.transferBusinessAccountStars(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
amount: Int
|
||||||
|
): Unit = execute(
|
||||||
|
TransferBusinessAccountStars(businessConnectionId, amount)
|
||||||
|
)
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.ConvertGiftToStars
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.TransferGift
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.UpgradeGift
|
||||||
|
import dev.inmo.tgbotapi.types.ChatId
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.GiftId
|
||||||
|
import dev.inmo.tgbotapi.types.businessConnectionIdField
|
||||||
|
import dev.inmo.tgbotapi.types.gifts.Gift
|
||||||
|
import dev.inmo.tgbotapi.types.keepOriginalDetailsField
|
||||||
|
import dev.inmo.tgbotapi.types.ownedGiftIdField
|
||||||
|
import dev.inmo.tgbotapi.types.starCountField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.transferGift(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
ownedGiftId: GiftId,
|
||||||
|
newOwnerChatId: ChatId,
|
||||||
|
transferPaymentStarCount: Int? = null,
|
||||||
|
): Unit = execute(
|
||||||
|
TransferGift(
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
ownedGiftId = ownedGiftId,
|
||||||
|
newOwnerChatId = newOwnerChatId,
|
||||||
|
transferPaymentStarCount = transferPaymentStarCount
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.transferGift(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
gift: Gift.Regular,
|
||||||
|
newOwnerChatId: ChatId,
|
||||||
|
transferPaymentStarCount: Int? = null,
|
||||||
|
): Unit = transferGift(
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
ownedGiftId = gift.id,
|
||||||
|
newOwnerChatId = newOwnerChatId,
|
||||||
|
transferPaymentStarCount = transferPaymentStarCount
|
||||||
|
)
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.business
|
||||||
|
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||||
|
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.ConvertGiftToStars
|
||||||
|
import dev.inmo.tgbotapi.requests.business_connection.UpgradeGift
|
||||||
|
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||||
|
import dev.inmo.tgbotapi.types.GiftId
|
||||||
|
import dev.inmo.tgbotapi.types.businessConnectionIdField
|
||||||
|
import dev.inmo.tgbotapi.types.gifts.Gift
|
||||||
|
import dev.inmo.tgbotapi.types.keepOriginalDetailsField
|
||||||
|
import dev.inmo.tgbotapi.types.ownedGiftIdField
|
||||||
|
import dev.inmo.tgbotapi.types.starCountField
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.convertGiftToStars(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
ownedGiftId: GiftId,
|
||||||
|
keepOriginalDetails: Boolean = false,
|
||||||
|
starCount: Int? = null
|
||||||
|
): Unit = execute(
|
||||||
|
UpgradeGift(
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
ownedGiftId = ownedGiftId,
|
||||||
|
keepOriginalDetails = keepOriginalDetails,
|
||||||
|
starCount = starCount
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.convertGiftToStars(
|
||||||
|
businessConnectionId: BusinessConnectionId,
|
||||||
|
gift: Gift.Regular,
|
||||||
|
keepOriginalDetails: Boolean = false,
|
||||||
|
): Unit = execute(
|
||||||
|
UpgradeGift(
|
||||||
|
businessConnectionId = businessConnectionId,
|
||||||
|
ownedGiftId = gift.id,
|
||||||
|
keepOriginalDetails = keepOriginalDetails,
|
||||||
|
starCount = gift.upgradeStarCount
|
||||||
|
)
|
||||||
|
)
|
||||||
@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.leaveChat(
|
public suspend fun TelegramBot.leaveChat(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(LeaveChat(chatId))
|
): Unit = execute(LeaveChat(chatId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.leaveChat(
|
public suspend fun TelegramBot.leaveChat(
|
||||||
chat: PublicChat
|
chat: PublicChat
|
||||||
): Boolean = leaveChat(chat.id)
|
): Unit = leaveChat(chat.id)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
public suspend fun TelegramBot.closeForumTopic(
|
public suspend fun TelegramBot.closeForumTopic(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
CloseForumTopic(
|
CloseForumTopic(
|
||||||
chatId,
|
chatId,
|
||||||
messageThreadId
|
messageThreadId
|
||||||
@@ -20,9 +20,9 @@ public suspend fun TelegramBot.closeForumTopic(
|
|||||||
public suspend fun TelegramBot.closeForumTopic(
|
public suspend fun TelegramBot.closeForumTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = closeForumTopic(chat.id, messageThreadId)
|
): Unit = closeForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.closeForumTopic(
|
public suspend fun TelegramBot.closeForumTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
forumTopic: ForumTopic
|
forumTopic: ForumTopic
|
||||||
): Boolean = closeForumTopic(chat.id, forumTopic.messageThreadId)
|
): Unit = closeForumTopic(chat.id, forumTopic.messageThreadId)
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.closeGeneralForumTopic(
|
public suspend fun TelegramBot.closeGeneralForumTopic(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
CloseGeneralForumTopic(chatId)
|
CloseGeneralForumTopic(chatId)
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.closeGeneralForumTopic(
|
public suspend fun TelegramBot.closeGeneralForumTopic(
|
||||||
chat: Chat
|
chat: Chat
|
||||||
): Boolean = closeGeneralForumTopic(chat.id)
|
): Unit = closeGeneralForumTopic(chat.id)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
public suspend fun TelegramBot.deleteForumTopic(
|
public suspend fun TelegramBot.deleteForumTopic(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
DeleteForumTopic(
|
DeleteForumTopic(
|
||||||
chatId,
|
chatId,
|
||||||
messageThreadId
|
messageThreadId
|
||||||
@@ -20,14 +20,14 @@ public suspend fun TelegramBot.deleteForumTopic(
|
|||||||
public suspend fun TelegramBot.deleteForumTopic(
|
public suspend fun TelegramBot.deleteForumTopic(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
forumTopic: ForumTopic
|
forumTopic: ForumTopic
|
||||||
): Boolean = deleteForumTopic(chatId, forumTopic.messageThreadId)
|
): Unit = deleteForumTopic(chatId, forumTopic.messageThreadId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteForumTopic(
|
public suspend fun TelegramBot.deleteForumTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = deleteForumTopic(chat.id, messageThreadId)
|
): Unit = deleteForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteForumTopic(
|
public suspend fun TelegramBot.deleteForumTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
forumTopic: ForumTopic
|
forumTopic: ForumTopic
|
||||||
): Boolean = deleteForumTopic(chat.id, forumTopic.messageThreadId)
|
): Unit = deleteForumTopic(chat.id, forumTopic.messageThreadId)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public suspend fun TelegramBot.editForumTopic(
|
|||||||
messageThreadId: MessageThreadId,
|
messageThreadId: MessageThreadId,
|
||||||
name: String? = null,
|
name: String? = null,
|
||||||
iconEmojiId: CustomEmojiId? = null
|
iconEmojiId: CustomEmojiId? = null
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
EditForumTopic(
|
EditForumTopic(
|
||||||
chatId,
|
chatId,
|
||||||
messageThreadId,
|
messageThreadId,
|
||||||
@@ -27,10 +27,10 @@ public suspend fun TelegramBot.editForumTopic(
|
|||||||
messageThreadId: MessageThreadId,
|
messageThreadId: MessageThreadId,
|
||||||
name: String? = null,
|
name: String? = null,
|
||||||
iconEmojiId: CustomEmojiId? = null
|
iconEmojiId: CustomEmojiId? = null
|
||||||
): Boolean = editForumTopic(chat.id, messageThreadId, name, iconEmojiId)
|
): Unit = editForumTopic(chat.id, messageThreadId, name, iconEmojiId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.editForumTopic(
|
public suspend fun TelegramBot.editForumTopic(
|
||||||
chatIdentifier: ChatIdentifier,
|
chatIdentifier: ChatIdentifier,
|
||||||
forumTopic: ForumTopic,
|
forumTopic: ForumTopic,
|
||||||
iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId
|
iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId
|
||||||
): Boolean = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)
|
): Unit = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
public suspend fun TelegramBot.editGeneralForumTopic(
|
public suspend fun TelegramBot.editGeneralForumTopic(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
name: String
|
name: String
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
EditGeneralForumTopic(
|
EditGeneralForumTopic(
|
||||||
chatId,
|
chatId,
|
||||||
name
|
name
|
||||||
@@ -22,9 +22,9 @@ public suspend fun TelegramBot.editGeneralForumTopic(
|
|||||||
public suspend fun TelegramBot.editGeneralForumTopic(
|
public suspend fun TelegramBot.editGeneralForumTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
name: String
|
name: String
|
||||||
): Boolean = editGeneralForumTopic(chat.id, name)
|
): Unit = editGeneralForumTopic(chat.id, name)
|
||||||
|
|
||||||
public suspend fun TelegramBot.editGeneralForumTopic(
|
public suspend fun TelegramBot.editGeneralForumTopic(
|
||||||
chatIdentifier: ChatIdentifier,
|
chatIdentifier: ChatIdentifier,
|
||||||
forumTopic: ForumTopic,
|
forumTopic: ForumTopic,
|
||||||
): Boolean = editGeneralForumTopic(chatIdentifier, forumTopic.name)
|
): Unit = editGeneralForumTopic(chatIdentifier, forumTopic.name)
|
||||||
|
|||||||
@@ -11,10 +11,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.hideGeneralForumTopic(
|
public suspend fun TelegramBot.hideGeneralForumTopic(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
HideGeneralForumTopic(chatId)
|
HideGeneralForumTopic(chatId)
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.hideGeneralForumTopic(
|
public suspend fun TelegramBot.hideGeneralForumTopic(
|
||||||
chat: Chat
|
chat: Chat
|
||||||
): Boolean = hideGeneralForumTopic(chat.id)
|
): Unit = hideGeneralForumTopic(chat.id)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
public suspend fun TelegramBot.reopenForumTopic(
|
public suspend fun TelegramBot.reopenForumTopic(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
ReopenForumTopic(
|
ReopenForumTopic(
|
||||||
chatId,
|
chatId,
|
||||||
messageThreadId
|
messageThreadId
|
||||||
@@ -20,9 +20,9 @@ public suspend fun TelegramBot.reopenForumTopic(
|
|||||||
public suspend fun TelegramBot.reopenForumTopic(
|
public suspend fun TelegramBot.reopenForumTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = reopenForumTopic(chat.id, messageThreadId)
|
): Unit = reopenForumTopic(chat.id, messageThreadId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.reopenForumTopic(
|
public suspend fun TelegramBot.reopenForumTopic(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
forumTopic: ForumTopic
|
forumTopic: ForumTopic
|
||||||
): Boolean = reopenForumTopic(chat.id, forumTopic.messageThreadId)
|
): Unit = reopenForumTopic(chat.id, forumTopic.messageThreadId)
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.reopenGeneralForumTopic(
|
public suspend fun TelegramBot.reopenGeneralForumTopic(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
ReopenGeneralForumTopic(chatId)
|
ReopenGeneralForumTopic(chatId)
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.reopenGeneralForumTopic(
|
public suspend fun TelegramBot.reopenGeneralForumTopic(
|
||||||
chat: Chat
|
chat: Chat
|
||||||
): Boolean = reopenGeneralForumTopic(chat.id)
|
): Unit = reopenGeneralForumTopic(chat.id)
|
||||||
|
|||||||
@@ -12,10 +12,10 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.unhideGeneralForumTopic(
|
public suspend fun TelegramBot.unhideGeneralForumTopic(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
UnhideGeneralForumTopic(chatId)
|
UnhideGeneralForumTopic(chatId)
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.unhideGeneralForumTopic(
|
public suspend fun TelegramBot.unhideGeneralForumTopic(
|
||||||
chat: Chat
|
chat: Chat
|
||||||
): Boolean = unhideGeneralForumTopic(chat.id)
|
): Unit = unhideGeneralForumTopic(chat.id)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
UnpinAllForumTopicMessages(
|
UnpinAllForumTopicMessages(
|
||||||
chatId,
|
chatId,
|
||||||
messageThreadId
|
messageThreadId
|
||||||
@@ -20,9 +20,9 @@ public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
|||||||
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageThreadId: MessageThreadId
|
messageThreadId: MessageThreadId
|
||||||
): Boolean = unpinAllForumTopicMessages(chat.id, messageThreadId)
|
): Unit = unpinAllForumTopicMessages(chat.id, messageThreadId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
forumTopic: ForumTopic
|
forumTopic: ForumTopic
|
||||||
): Boolean = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)
|
): Unit = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
|
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
UnpinAllGeneralForumTopicMessages(
|
UnpinAllGeneralForumTopicMessages(
|
||||||
chatId
|
chatId
|
||||||
)
|
)
|
||||||
@@ -18,4 +18,4 @@ public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
|
|||||||
|
|
||||||
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
|
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
|
||||||
chat: Chat
|
chat: Chat
|
||||||
): Boolean = unpinAllGeneralForumTopicMessages(chat.id)
|
): Unit = unpinAllGeneralForumTopicMessages(chat.id)
|
||||||
|
|||||||
@@ -117,6 +117,17 @@ public suspend fun TelegramBot.getChat(
|
|||||||
chat: PrivateChatImpl
|
chat: PrivateChatImpl
|
||||||
): ExtendedPrivateChatImpl = getChat(chat.id) as ExtendedPrivateChatImpl
|
): ExtendedPrivateChatImpl = getChat(chat.id) as ExtendedPrivateChatImpl
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
|
* [ExtendedPrivateForumChatImpl] with unsafe operator "as"
|
||||||
|
*
|
||||||
|
* @throws ClassCastException
|
||||||
|
*/
|
||||||
|
@PreviewFeature
|
||||||
|
public suspend fun TelegramBot.getChat(
|
||||||
|
chat: PrivateForumChatImpl
|
||||||
|
): ExtendedPrivateForumChatImpl = getChat(chat.id) as ExtendedPrivateForumChatImpl
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||||
* [ExtendedUser] with unsafe operator "as"
|
* [ExtendedUser] with unsafe operator "as"
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
|
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
|
||||||
|
|
||||||
public suspend fun TelegramBot.getChatAdministrators(
|
public suspend fun TelegramBot.getChatAdministrators(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier,
|
||||||
): List<AdministratorChatMember> = execute(GetChatAdministrators(chatId))
|
retrieveOtherBots: Boolean? = null
|
||||||
|
): List<AdministratorChatMember> = execute(GetChatAdministrators(chatId = chatId, retrieveOtherBots = retrieveOtherBots))
|
||||||
|
|
||||||
public suspend fun TelegramBot.getChatAdministrators(
|
public suspend fun TelegramBot.getChatAdministrators(
|
||||||
chat: PublicChat
|
chat: PublicChat,
|
||||||
): List<AdministratorChatMember> = getChatAdministrators(chat.id)
|
retrieveOtherBots: Boolean? = null
|
||||||
|
): List<AdministratorChatMember> = getChatAdministrators(chat.id, retrieveOtherBots)
|
||||||
|
|||||||
@@ -12,31 +12,31 @@ import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
|||||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
userId: UserId
|
userId: UserId
|
||||||
): Boolean = execute(ApproveChatJoinRequest(chatId, userId))
|
): Unit = execute(ApproveChatJoinRequest(chatId, userId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
userId: UserId
|
userId: UserId
|
||||||
): Boolean = approveChatJoinRequest(chat.id, userId)
|
): Unit = approveChatJoinRequest(chat.id, userId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
user: User
|
user: User
|
||||||
): Boolean = approveChatJoinRequest(chatId, user.id)
|
): Unit = approveChatJoinRequest(chatId, user.id)
|
||||||
|
|
||||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User
|
user: User
|
||||||
): Boolean = approveChatJoinRequest(chat.id, user.id)
|
): Unit = approveChatJoinRequest(chat.id, user.id)
|
||||||
|
|
||||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
chatJoinRequest: ChatJoinRequest
|
chatJoinRequest: ChatJoinRequest
|
||||||
): Boolean = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
): Unit = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||||
|
|
||||||
public suspend fun TelegramBot.approve(
|
public suspend fun TelegramBot.approve(
|
||||||
chatJoinRequest: ChatJoinRequest
|
chatJoinRequest: ChatJoinRequest
|
||||||
): Boolean = approveChatJoinRequest(chatJoinRequest)
|
): Unit = approveChatJoinRequest(chatJoinRequest)
|
||||||
|
|
||||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||||
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
||||||
): Boolean = approveChatJoinRequest(chatJoinRequestUpdate.data)
|
): Unit = approveChatJoinRequest(chatJoinRequestUpdate.data)
|
||||||
|
|||||||
@@ -12,31 +12,31 @@ import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
|||||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
userId: UserId
|
userId: UserId
|
||||||
): Boolean = execute(DeclineChatJoinRequest(chatId, userId))
|
): Unit = execute(DeclineChatJoinRequest(chatId, userId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
userId: UserId
|
userId: UserId
|
||||||
): Boolean = declineChatJoinRequest(chat.id, userId)
|
): Unit = declineChatJoinRequest(chat.id, userId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
user: User
|
user: User
|
||||||
): Boolean = declineChatJoinRequest(chatId, user.id)
|
): Unit = declineChatJoinRequest(chatId, user.id)
|
||||||
|
|
||||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User
|
user: User
|
||||||
): Boolean = declineChatJoinRequest(chat.id, user.id)
|
): Unit = declineChatJoinRequest(chat.id, user.id)
|
||||||
|
|
||||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
chatJoinRequest: ChatJoinRequest
|
chatJoinRequest: ChatJoinRequest
|
||||||
): Boolean = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
): Unit = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||||
|
|
||||||
public suspend fun TelegramBot.decline(
|
public suspend fun TelegramBot.decline(
|
||||||
chatJoinRequest: ChatJoinRequest
|
chatJoinRequest: ChatJoinRequest
|
||||||
): Boolean = declineChatJoinRequest(chatJoinRequest)
|
): Unit = declineChatJoinRequest(chatJoinRequest)
|
||||||
|
|
||||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||||
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
||||||
): Boolean = declineChatJoinRequest(chatJoinRequestUpdate.data)
|
): Unit = declineChatJoinRequest(chatJoinRequestUpdate.data)
|
||||||
|
|||||||
@@ -14,25 +14,25 @@ public suspend fun TelegramBot.banChatMember(
|
|||||||
userId: UserId,
|
userId: UserId,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
revokeMessages: Boolean? = null
|
revokeMessages: Boolean? = null
|
||||||
): Boolean = execute(BanChatMember(chatId, userId, untilDate, revokeMessages))
|
): Unit = execute(BanChatMember(chatId, userId, untilDate, revokeMessages))
|
||||||
|
|
||||||
public suspend fun TelegramBot.banChatMember(
|
public suspend fun TelegramBot.banChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
revokeMessages: Boolean? = null
|
revokeMessages: Boolean? = null
|
||||||
): Boolean = banChatMember(chat.id, userId, untilDate, revokeMessages)
|
): Unit = banChatMember(chat.id, userId, untilDate, revokeMessages)
|
||||||
|
|
||||||
public suspend fun TelegramBot.banChatMember(
|
public suspend fun TelegramBot.banChatMember(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
revokeMessages: Boolean? = null
|
revokeMessages: Boolean? = null
|
||||||
): Boolean = banChatMember(chatId, user.id, untilDate, revokeMessages)
|
): Unit = banChatMember(chatId, user.id, untilDate, revokeMessages)
|
||||||
|
|
||||||
public suspend fun TelegramBot.banChatMember(
|
public suspend fun TelegramBot.banChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User,
|
user: User,
|
||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
revokeMessages: Boolean? = null
|
revokeMessages: Boolean? = null
|
||||||
): Boolean = banChatMember(chat.id, user.id, untilDate, revokeMessages)
|
): Unit = banChatMember(chat.id, user.id, untilDate, revokeMessages)
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
public suspend fun TelegramBot.banChatSenderChat(
|
public suspend fun TelegramBot.banChatSenderChat(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
senderChatId: IdChatIdentifier
|
senderChatId: IdChatIdentifier
|
||||||
): Boolean = execute(BanChatSenderChat(chatId, senderChatId))
|
): Unit = execute(BanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.banChatSenderChat(
|
public suspend fun TelegramBot.banChatSenderChat(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
senderChatId: IdChatIdentifier
|
senderChatId: IdChatIdentifier
|
||||||
): Boolean = banChatSenderChat(chat.id, senderChatId)
|
): Unit = banChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.banChatSenderChat(
|
public suspend fun TelegramBot.banChatSenderChat(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
senderChat: PublicChat
|
senderChat: PublicChat
|
||||||
): Boolean = banChatSenderChat(chatId, senderChat.id)
|
): Unit = banChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
public suspend fun TelegramBot.banChatSenderChat(
|
public suspend fun TelegramBot.banChatSenderChat(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
senderChat: PublicChat,
|
senderChat: PublicChat,
|
||||||
): Boolean = banChatSenderChat(chat.id, senderChat)
|
): Unit = banChatSenderChat(chat.id, senderChat)
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ 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.PromoteChannelAdministrator
|
import dev.inmo.tgbotapi.requests.chat.members.PromoteChannelAdministrator
|
||||||
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
|
|
||||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||||
import dev.inmo.tgbotapi.types.TelegramDate
|
import dev.inmo.tgbotapi.types.TelegramDate
|
||||||
@@ -26,8 +25,9 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = execute(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
): Unit = execute(
|
||||||
PromoteChannelAdministrator(
|
PromoteChannelAdministrator(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
userId = userId,
|
userId = userId,
|
||||||
@@ -44,7 +44,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat = canManageChat,
|
canManageChat = canManageChat,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -64,8 +65,9 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = promoteChannelAdministrator(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
): Unit = promoteChannelAdministrator(
|
||||||
chat.id,
|
chat.id,
|
||||||
userId,
|
userId,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -81,7 +83,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat = canManageChat,
|
canManageChat = canManageChat,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.promoteChannelAdministrator(
|
public suspend fun TelegramBot.promoteChannelAdministrator(
|
||||||
@@ -100,8 +103,9 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = promoteChannelAdministrator(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
): Unit = promoteChannelAdministrator(
|
||||||
chatId,
|
chatId,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -117,7 +121,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat = canManageChat,
|
canManageChat = canManageChat,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.promoteChannelAdministrator(
|
public suspend fun TelegramBot.promoteChannelAdministrator(
|
||||||
@@ -136,8 +141,9 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = promoteChannelAdministrator(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
): Unit = promoteChannelAdministrator(
|
||||||
chat.id,
|
chat.id,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -153,5 +159,6 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
|
|||||||
canManageChat = canManageChat,
|
canManageChat = canManageChat,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,19 +21,21 @@ public suspend fun TelegramBot.promoteChatAdministrator(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
): Boolean = execute(
|
canManageTags: Boolean? = null,
|
||||||
|
): Unit = execute(
|
||||||
PromoteChatMember(
|
PromoteChatMember(
|
||||||
chatId,
|
chatId = chatId,
|
||||||
userId,
|
userId = userId,
|
||||||
untilDate,
|
untilDate = untilDate,
|
||||||
isAnonymous,
|
isAnonymous = isAnonymous,
|
||||||
canChangeInfo,
|
canChangeInfo = canChangeInfo,
|
||||||
canDeleteMessages,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canInviteUsers,
|
canInviteUsers = canInviteUsers,
|
||||||
canRestrictMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canPromoteMembers,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageVideoChats,
|
canManageVideoChats = canManageVideoChats,
|
||||||
canManageChat
|
canManageChat = canManageChat,
|
||||||
|
canManageTags = canManageTags
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -49,18 +51,20 @@ public suspend fun TelegramBot.promoteChatAdministrator(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
): Boolean = promoteChatAdministrator(
|
canManageTags: Boolean? = null,
|
||||||
chat.id,
|
): Unit = promoteChatAdministrator(
|
||||||
userId,
|
chatId = chat.id,
|
||||||
untilDate,
|
userId = userId,
|
||||||
isAnonymous,
|
untilDate = untilDate,
|
||||||
canChangeInfo,
|
isAnonymous = isAnonymous,
|
||||||
canDeleteMessages,
|
canChangeInfo = canChangeInfo,
|
||||||
canInviteUsers,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canRestrictMembers,
|
canInviteUsers = canInviteUsers,
|
||||||
canPromoteMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canManageVideoChats,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageChat
|
canManageVideoChats = canManageVideoChats,
|
||||||
|
canManageChat = canManageChat,
|
||||||
|
canManageTags = canManageTags
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.promoteChatAdministrator(
|
public suspend fun TelegramBot.promoteChatAdministrator(
|
||||||
@@ -75,18 +79,20 @@ public suspend fun TelegramBot.promoteChatAdministrator(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
): Boolean = promoteChatAdministrator(
|
canManageTags: Boolean? = null,
|
||||||
chatId,
|
): Unit = promoteChatAdministrator(
|
||||||
user.id,
|
chatId = chatId,
|
||||||
untilDate,
|
userId = user.id,
|
||||||
isAnonymous,
|
untilDate = untilDate,
|
||||||
canChangeInfo,
|
isAnonymous = isAnonymous,
|
||||||
canDeleteMessages,
|
canChangeInfo = canChangeInfo,
|
||||||
canInviteUsers,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canRestrictMembers,
|
canInviteUsers = canInviteUsers,
|
||||||
canPromoteMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canManageVideoChats,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageChat
|
canManageVideoChats = canManageVideoChats,
|
||||||
|
canManageChat = canManageChat,
|
||||||
|
canManageTags = canManageTags
|
||||||
)
|
)
|
||||||
|
|
||||||
public suspend fun TelegramBot.promoteChatAdministrator(
|
public suspend fun TelegramBot.promoteChatAdministrator(
|
||||||
@@ -101,16 +107,18 @@ public suspend fun TelegramBot.promoteChatAdministrator(
|
|||||||
canPromoteMembers: Boolean? = null,
|
canPromoteMembers: Boolean? = null,
|
||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
): Boolean = promoteChatAdministrator(
|
canManageTags: Boolean? = null,
|
||||||
chat.id,
|
): Unit = promoteChatAdministrator(
|
||||||
user.id,
|
chatId = chat.id,
|
||||||
untilDate,
|
userId = user.id,
|
||||||
isAnonymous,
|
untilDate = untilDate,
|
||||||
canChangeInfo,
|
isAnonymous = isAnonymous,
|
||||||
canDeleteMessages,
|
canChangeInfo = canChangeInfo,
|
||||||
canInviteUsers,
|
canDeleteMessages = canDeleteMessages,
|
||||||
canRestrictMembers,
|
canInviteUsers = canInviteUsers,
|
||||||
canPromoteMembers,
|
canRestrictMembers = canRestrictMembers,
|
||||||
canManageVideoChats,
|
canPromoteMembers = canPromoteMembers,
|
||||||
canManageChat
|
canManageVideoChats = canManageVideoChats,
|
||||||
|
canManageChat = canManageChat,
|
||||||
|
canManageTags = canManageTags
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = execute(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
canManageTags: Boolean? = null
|
||||||
|
): Unit = execute(
|
||||||
PromoteChatMember(
|
PromoteChatMember(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
userId = userId,
|
userId = userId,
|
||||||
@@ -46,7 +48,9 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics = canManageTopics,
|
canManageTopics = canManageTopics,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
|
canManageTags = canManageTags,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -69,8 +73,10 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = promoteChatMember(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
canManageTags: Boolean? = null
|
||||||
|
): Unit = promoteChatMember(
|
||||||
chat.id,
|
chat.id,
|
||||||
userId,
|
userId,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -88,7 +94,9 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics = canManageTopics,
|
canManageTopics = canManageTopics,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
|
canManageTags = canManageTags,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Warning("This method is too common. Use it with caution")
|
@Warning("This method is too common. Use it with caution")
|
||||||
@@ -110,8 +118,10 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = promoteChatMember(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
canManageTags: Boolean? = null
|
||||||
|
): Unit = promoteChatMember(
|
||||||
chatId,
|
chatId,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -129,7 +139,9 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics = canManageTopics,
|
canManageTopics = canManageTopics,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
|
canManageTags = canManageTags,
|
||||||
)
|
)
|
||||||
|
|
||||||
@Warning("This method is too common. Use it with caution")
|
@Warning("This method is too common. Use it with caution")
|
||||||
@@ -151,8 +163,10 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
canPostStories: Boolean? = null,
|
canPostStories: Boolean? = null,
|
||||||
canEditStories: Boolean? = null,
|
canEditStories: Boolean? = null,
|
||||||
canDeleteStories: Boolean? = null
|
canDeleteStories: Boolean? = null,
|
||||||
): Boolean = promoteChatMember(
|
canManageDirectMessages: Boolean? = null,
|
||||||
|
canManageTags: Boolean? = null
|
||||||
|
): Unit = promoteChatMember(
|
||||||
chat.id,
|
chat.id,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -170,5 +184,7 @@ public suspend fun TelegramBot.promoteChatMember(
|
|||||||
canManageTopics = canManageTopics,
|
canManageTopics = canManageTopics,
|
||||||
canPostStories = canPostStories,
|
canPostStories = canPostStories,
|
||||||
canEditStories = canEditStories,
|
canEditStories = canEditStories,
|
||||||
canDeleteStories = canDeleteStories
|
canDeleteStories = canDeleteStories,
|
||||||
|
canManageDirectMessages = canManageDirectMessages,
|
||||||
|
canManageTags = canManageTags,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
|
|||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
): Boolean = execute(
|
): Unit = execute(
|
||||||
PromoteSupergroupAdministrator(
|
PromoteSupergroupAdministrator(
|
||||||
chatId = chatId,
|
chatId = chatId,
|
||||||
userId = userId,
|
userId = userId,
|
||||||
@@ -56,7 +56,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
|
|||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
): Boolean = promoteSupergroupAdministrator(
|
): Unit = promoteSupergroupAdministrator(
|
||||||
chat.id,
|
chat.id,
|
||||||
userId,
|
userId,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -86,7 +86,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
|
|||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
): Boolean = promoteSupergroupAdministrator(
|
): Unit = promoteSupergroupAdministrator(
|
||||||
chatId,
|
chatId,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
@@ -116,7 +116,7 @@ public suspend fun TelegramBot.promoteSupergroupAdministrator(
|
|||||||
canManageVideoChats: Boolean? = null,
|
canManageVideoChats: Boolean? = null,
|
||||||
canManageChat: Boolean? = null,
|
canManageChat: Boolean? = null,
|
||||||
canManageTopics: Boolean? = null,
|
canManageTopics: Boolean? = null,
|
||||||
): Boolean = promoteSupergroupAdministrator(
|
): Unit = promoteSupergroupAdministrator(
|
||||||
chat.id,
|
chat.id,
|
||||||
user.id,
|
user.id,
|
||||||
untilDate = untilDate,
|
untilDate = untilDate,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public suspend fun TelegramBot.restrictChatMember(
|
|||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions(),
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
): Boolean = execute(RestrictChatMember(chatId, userId, untilDate, permissions, useIndependentChatPermissions))
|
): Unit = execute(RestrictChatMember(chatId, userId, untilDate, permissions, useIndependentChatPermissions))
|
||||||
|
|
||||||
public suspend fun TelegramBot.restrictChatMember(
|
public suspend fun TelegramBot.restrictChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
@@ -24,7 +24,7 @@ public suspend fun TelegramBot.restrictChatMember(
|
|||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions(),
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
): Boolean = restrictChatMember(chat.id, userId, untilDate, permissions, useIndependentChatPermissions)
|
): Unit = restrictChatMember(chat.id, userId, untilDate, permissions, useIndependentChatPermissions)
|
||||||
|
|
||||||
public suspend fun TelegramBot.restrictChatMember(
|
public suspend fun TelegramBot.restrictChatMember(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
@@ -32,7 +32,7 @@ public suspend fun TelegramBot.restrictChatMember(
|
|||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions(),
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
): Boolean = restrictChatMember(chatId, user.id, untilDate, permissions, useIndependentChatPermissions)
|
): Unit = restrictChatMember(chatId, user.id, untilDate, permissions, useIndependentChatPermissions)
|
||||||
|
|
||||||
public suspend fun TelegramBot.restrictChatMember(
|
public suspend fun TelegramBot.restrictChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
@@ -40,5 +40,5 @@ public suspend fun TelegramBot.restrictChatMember(
|
|||||||
untilDate: TelegramDate? = null,
|
untilDate: TelegramDate? = null,
|
||||||
permissions: ChatPermissions = ChatPermissions(),
|
permissions: ChatPermissions = ChatPermissions(),
|
||||||
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
): Boolean = restrictChatMember(chat.id, user.id, untilDate, permissions, useIndependentChatPermissions)
|
): Unit = restrictChatMember(chat.id, user.id, untilDate, permissions, useIndependentChatPermissions)
|
||||||
|
|
||||||
|
|||||||
@@ -11,22 +11,22 @@ public suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
|||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
customTitle: String
|
customTitle: String
|
||||||
): Boolean = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
|
): Unit = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
public suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
customTitle: String
|
customTitle: String
|
||||||
): Boolean = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
|
): Unit = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
|
||||||
|
|
||||||
public suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
public suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
customTitle: String
|
customTitle: String
|
||||||
): Boolean = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
|
): Unit = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
|
||||||
|
|
||||||
public suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
public suspend fun TelegramBot.setChatAdministratorCustomTitle(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User,
|
user: User,
|
||||||
customTitle: String
|
customTitle: String
|
||||||
): Boolean = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)
|
): Unit = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package dev.inmo.tgbotapi.extensions.api.chat.members
|
||||||
|
|
||||||
|
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||||
|
import dev.inmo.tgbotapi.requests.chat.members.SetChatMemberTag
|
||||||
|
import dev.inmo.tgbotapi.types.*
|
||||||
|
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||||
|
import dev.inmo.tgbotapi.types.chat.User
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setChatMemberTag(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
userId: UserId,
|
||||||
|
tag: UserTag? = null
|
||||||
|
): Unit = execute(SetChatMemberTag(chatId, userId, tag))
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setChatMemberTag(
|
||||||
|
chat: PublicChat,
|
||||||
|
userId: UserId,
|
||||||
|
tag: UserTag? = null
|
||||||
|
): Unit = setChatMemberTag(chat.id, userId, tag)
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setChatMemberTag(
|
||||||
|
chatId: ChatIdentifier,
|
||||||
|
user: User,
|
||||||
|
tag: UserTag? = null
|
||||||
|
): Unit = setChatMemberTag(chatId, user.id, tag)
|
||||||
|
|
||||||
|
public suspend fun TelegramBot.setChatMemberTag(
|
||||||
|
chat: PublicChat,
|
||||||
|
user: User,
|
||||||
|
tag: UserTag? = null
|
||||||
|
): Unit = setChatMemberTag(chat.id, user.id, tag)
|
||||||
@@ -12,23 +12,23 @@ public suspend fun TelegramBot.unbanChatMember(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
onlyIfBanned: Boolean? = null
|
onlyIfBanned: Boolean? = null
|
||||||
): Boolean = execute(UnbanChatMember(chatId, userId, onlyIfBanned))
|
): Unit = execute(UnbanChatMember(chatId, userId, onlyIfBanned))
|
||||||
|
|
||||||
public suspend fun TelegramBot.unbanChatMember(
|
public suspend fun TelegramBot.unbanChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
userId: UserId,
|
userId: UserId,
|
||||||
onlyIfBanned: Boolean? = null
|
onlyIfBanned: Boolean? = null
|
||||||
): Boolean = unbanChatMember(chat.id, userId, onlyIfBanned)
|
): Unit = unbanChatMember(chat.id, userId, onlyIfBanned)
|
||||||
|
|
||||||
public suspend fun TelegramBot.unbanChatMember(
|
public suspend fun TelegramBot.unbanChatMember(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
user: User,
|
user: User,
|
||||||
onlyIfBanned: Boolean? = null
|
onlyIfBanned: Boolean? = null
|
||||||
): Boolean = unbanChatMember(chatId, user.id, onlyIfBanned)
|
): Unit = unbanChatMember(chatId, user.id, onlyIfBanned)
|
||||||
|
|
||||||
public suspend fun TelegramBot.unbanChatMember(
|
public suspend fun TelegramBot.unbanChatMember(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
user: User,
|
user: User,
|
||||||
onlyIfBanned: Boolean? = null
|
onlyIfBanned: Boolean? = null
|
||||||
): Boolean = unbanChatMember(chat.id, user.id, onlyIfBanned)
|
): Unit = unbanChatMember(chat.id, user.id, onlyIfBanned)
|
||||||
|
|
||||||
|
|||||||
@@ -9,19 +9,19 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
public suspend fun TelegramBot.unbanChatSenderChat(
|
public suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
senderChatId: IdChatIdentifier
|
senderChatId: IdChatIdentifier
|
||||||
): Boolean = execute(UnbanChatSenderChat(chatId, senderChatId))
|
): Unit = execute(UnbanChatSenderChat(chatId, senderChatId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.unbanChatSenderChat(
|
public suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
senderChatId: IdChatIdentifier
|
senderChatId: IdChatIdentifier
|
||||||
): Boolean = unbanChatSenderChat(chat.id, senderChatId)
|
): Unit = unbanChatSenderChat(chat.id, senderChatId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.unbanChatSenderChat(
|
public suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
senderChat: PublicChat
|
senderChat: PublicChat
|
||||||
): Boolean = unbanChatSenderChat(chatId, senderChat.id)
|
): Unit = unbanChatSenderChat(chatId, senderChat.id)
|
||||||
|
|
||||||
public suspend fun TelegramBot.unbanChatSenderChat(
|
public suspend fun TelegramBot.unbanChatSenderChat(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
senderChat: PublicChat,
|
senderChat: PublicChat,
|
||||||
): Boolean = unbanChatSenderChat(chat.id, senderChat)
|
): Unit = unbanChatSenderChat(chat.id, senderChat)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.deleteChatPhoto(
|
public suspend fun TelegramBot.deleteChatPhoto(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(DeleteChatPhoto(chatId))
|
): Unit = execute(DeleteChatPhoto(chatId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteChatPhoto(
|
public suspend fun TelegramBot.deleteChatPhoto(
|
||||||
chat: PublicChat
|
chat: PublicChat
|
||||||
): Boolean = deleteChatPhoto(chat.id)
|
): Unit = deleteChatPhoto(chat.id)
|
||||||
|
|||||||
@@ -14,17 +14,17 @@ public suspend fun TelegramBot.pinChatMessage(
|
|||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
): Boolean = execute(PinChatMessage(chatId, messageId, businessConnectionId, disableNotification))
|
): Unit = execute(PinChatMessage(chatId, messageId, businessConnectionId, disableNotification))
|
||||||
|
|
||||||
public suspend fun TelegramBot.pinChatMessage(
|
public suspend fun TelegramBot.pinChatMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId,
|
messageId: MessageId,
|
||||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
): Boolean = pinChatMessage(chat.id, messageId, businessConnectionId, disableNotification)
|
): Unit = pinChatMessage(chat.id, messageId, businessConnectionId, disableNotification)
|
||||||
|
|
||||||
public suspend fun TelegramBot.pinChatMessage(
|
public suspend fun TelegramBot.pinChatMessage(
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
|
||||||
disableNotification: Boolean = false
|
disableNotification: Boolean = false
|
||||||
): Boolean = pinChatMessage(message.chat.id, message.messageId, businessConnectionId, disableNotification)
|
): Unit = pinChatMessage(message.chat.id, message.messageId, businessConnectionId, disableNotification)
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
public suspend fun TelegramBot.setChatDescription(
|
public suspend fun TelegramBot.setChatDescription(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
description: String
|
description: String
|
||||||
): Boolean = execute(SetChatDescription(chatId, description))
|
): Unit = execute(SetChatDescription(chatId, description))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setChatDescription(
|
public suspend fun TelegramBot.setChatDescription(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
description: String
|
description: String
|
||||||
): Boolean = setChatDescription(chat.id, description)
|
): Unit = setChatDescription(chat.id, description)
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import dev.inmo.tgbotapi.types.chat.PrivateChat
|
|||||||
public suspend fun TelegramBot.setChatMenuButton(
|
public suspend fun TelegramBot.setChatMenuButton(
|
||||||
chatId: IdChatIdentifier,
|
chatId: IdChatIdentifier,
|
||||||
menuButton: MenuButton
|
menuButton: MenuButton
|
||||||
): Boolean = execute(SetChatMenuButton(chatId, menuButton))
|
): Unit = execute(SetChatMenuButton(chatId, menuButton))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setChatMenuButton(
|
public suspend fun TelegramBot.setChatMenuButton(
|
||||||
chat: PrivateChat,
|
chat: PrivateChat,
|
||||||
menuButton: MenuButton
|
menuButton: MenuButton
|
||||||
): Boolean = setChatMenuButton(chat.id, menuButton)
|
): Unit = setChatMenuButton(chat.id, menuButton)
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ public suspend fun TelegramBot.setDefaultChatMembersPermissions(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
permissions: ChatPermissions,
|
permissions: ChatPermissions,
|
||||||
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
): Boolean = execute(SetChatPermissions(chatId, permissions, useIndependentChatPermissions))
|
): Unit = execute(SetChatPermissions(chatId, permissions, useIndependentChatPermissions))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setDefaultChatMembersPermissions(
|
public suspend fun TelegramBot.setDefaultChatMembersPermissions(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
permissions: ChatPermissions,
|
permissions: ChatPermissions,
|
||||||
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
useIndependentChatPermissions: Boolean? = permissions.isGranular.takeIf { it }
|
||||||
): Boolean = setDefaultChatMembersPermissions(chat.id, permissions, useIndependentChatPermissions)
|
): Unit = setDefaultChatMembersPermissions(chat.id, permissions, useIndependentChatPermissions)
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
public suspend fun TelegramBot.setChatPhoto(
|
public suspend fun TelegramBot.setChatPhoto(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
photo: MultipartFile
|
photo: MultipartFile
|
||||||
): Boolean = execute(SetChatPhoto(chatId, photo))
|
): Unit = execute(SetChatPhoto(chatId, photo))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setChatPhoto(
|
public suspend fun TelegramBot.setChatPhoto(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
photo: MultipartFile
|
photo: MultipartFile
|
||||||
): Boolean = setChatPhoto(chat.id, photo)
|
): Unit = setChatPhoto(chat.id, photo)
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
|||||||
public suspend fun TelegramBot.setChatTitle(
|
public suspend fun TelegramBot.setChatTitle(
|
||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
title: String
|
title: String
|
||||||
): Boolean = execute(SetChatTitle(chatId, title))
|
): Unit = execute(SetChatTitle(chatId, title))
|
||||||
|
|
||||||
public suspend fun TelegramBot.setChatTitle(
|
public suspend fun TelegramBot.setChatTitle(
|
||||||
chat: PublicChat,
|
chat: PublicChat,
|
||||||
title: String
|
title: String
|
||||||
): Boolean = setChatTitle(chat.id, title)
|
): Unit = setChatTitle(chat.id, title)
|
||||||
|
|||||||
@@ -6,4 +6,4 @@ import dev.inmo.tgbotapi.types.MenuButton
|
|||||||
|
|
||||||
public suspend fun TelegramBot.setDefaultChatMenuButton(
|
public suspend fun TelegramBot.setDefaultChatMenuButton(
|
||||||
menuButton: MenuButton
|
menuButton: MenuButton
|
||||||
): Boolean = execute(SetDefaultChatMenuButton(menuButton))
|
): Unit = execute(SetDefaultChatMenuButton(menuButton))
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.Chat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.unpinAllChatMessages(
|
public suspend fun TelegramBot.unpinAllChatMessages(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(UnpinAllChatMessages(chatId))
|
): Unit = execute(UnpinAllChatMessages(chatId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.unpinAllChatMessages(
|
public suspend fun TelegramBot.unpinAllChatMessages(
|
||||||
chat: Chat
|
chat: Chat
|
||||||
): Boolean = unpinAllChatMessages(chat.id)
|
): Unit = unpinAllChatMessages(chat.id)
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ public suspend fun TelegramBot.unpinChatMessage(
|
|||||||
chatId: ChatIdentifier,
|
chatId: ChatIdentifier,
|
||||||
messageId: MessageId? = null,
|
messageId: MessageId? = null,
|
||||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId
|
||||||
): Boolean = execute(UnpinChatMessage(chatId, messageId, businessConnectionId))
|
): Unit = execute(UnpinChatMessage(chatId, messageId, businessConnectionId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.unpinChatMessage(
|
public suspend fun TelegramBot.unpinChatMessage(
|
||||||
chat: Chat,
|
chat: Chat,
|
||||||
messageId: MessageId? = null,
|
messageId: MessageId? = null,
|
||||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId
|
||||||
): Boolean = unpinChatMessage(chat.id, messageId, businessConnectionId)
|
): Unit = unpinChatMessage(chat.id, messageId, businessConnectionId)
|
||||||
|
|
||||||
public suspend fun TelegramBot.unpinChatMessage(
|
public suspend fun TelegramBot.unpinChatMessage(
|
||||||
message: AccessibleMessage,
|
message: AccessibleMessage,
|
||||||
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
|
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
|
||||||
): Boolean = unpinChatMessage(message.chat.id, message.messageId, businessConnectionId)
|
): Unit = unpinChatMessage(message.chat.id, message.messageId, businessConnectionId)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import dev.inmo.tgbotapi.types.chat.SupergroupChat
|
|||||||
|
|
||||||
public suspend fun TelegramBot.deleteChatStickerSet(
|
public suspend fun TelegramBot.deleteChatStickerSet(
|
||||||
chatId: ChatIdentifier
|
chatId: ChatIdentifier
|
||||||
): Boolean = execute(DeleteChatStickerSet(chatId))
|
): Unit = execute(DeleteChatStickerSet(chatId))
|
||||||
|
|
||||||
public suspend fun TelegramBot.deleteChatStickerSet(
|
public suspend fun TelegramBot.deleteChatStickerSet(
|
||||||
chat: SupergroupChat
|
chat: SupergroupChat
|
||||||
): Boolean = deleteChatStickerSet(chat.id)
|
): Unit = deleteChatStickerSet(chat.id)
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user