1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-16 12:00:18 +00:00

Compare commits

...

451 Commits

Author SHA1 Message Date
b71b1414b9 fix of target version 2025-10-22 01:52:00 +06:00
f8ceab7640 small hotfix 2025-10-22 01:51:20 +06:00
68897c89c3 start 30.0.1 2025-10-21 23:27:43 +06:00
fb08b7044e Merge pull request #1012 from InsanusMokrassar/30.0.0
30.0.0
2025-10-21 22:25:26 +06:00
7ed021b5bc fill changelog 2025-10-21 22:24:58 +06:00
1cff533265 update dependencies and fix (?) build 2025-10-20 22:44:16 +06:00
8b08e11441 migrate onto 30.0.0 2025-10-20 21:21:31 +06:00
b69c8f1d8f update dependencies
com.github.ben-manes.versions: 0.52.0 -> 0.53.0
2025-10-19 23:33:10 +06:00
fdf393405c start 29.1.0 2025-10-19 22:57:12 +06:00
c951fc3353 Merge pull request #1010 from InsanusMokrassar/29.0.1
29.0.1
2025-10-13 23:10:42 +06:00
02f42c3f52 fix of name for publishing in nexus 2025-10-12 21:46:35 +06:00
0105e46a5f apiDump 2025-10-12 21:22:34 +06:00
325a189ebb fix of #917 2025-10-12 21:09:38 +06:00
1d021c8450 start 29.0.1 2025-10-12 21:07:55 +06:00
6eb9379e0a Merge pull request #998 from InsanusMokrassar/29.0.0
29.0.0
2025-09-25 15:07:02 +06:00
2d97d10ee1 fill changelog and readme 2025-09-25 14:25:22 +06:00
4b7d052ece rewrite firstOf 2025-09-25 14:25:08 +06:00
df512a917b Merge branch 'master' into 29.0.0 2025-09-23 18:21:13 +06:00
67cd836466 Merge pull request #1005 from InsanusMokrassar/28.0.3
28.0.3
2025-09-23 18:17:11 +06:00
eb1fb16117 add support of custom publishing type 2025-09-23 18:13:04 +06:00
ee4cf7c626 add passing of default engines in HttpClient constructors 2025-09-23 17:53:21 +06:00
74d8b31437 start 28.0.3 2025-09-23 17:46:54 +06:00
3f61cfdefb fix of paid message building 2025-09-23 16:12:40 +06:00
91339fc839 rewrite firstof 2025-09-23 13:37:59 +06:00
2e23f48350 fixes in CommonChannelDirectMessagesEventMessage creating 2025-09-23 12:47:58 +06:00
f6211d33bb change events hierarchy of ChannelDirectMessagesEvent 2025-09-23 12:16:30 +06:00
2ff11ad73c improve messages hierarchy 2025-09-22 12:19:34 +06:00
2695b03968 fix of direct message typing 2025-09-17 23:31:08 +06:00
03d23a938e fixes of inheritance of messages for direct ones 2025-09-17 22:46:51 +06:00
719fb1f4a9 complete adding of suggestedPostParameters 2025-09-17 20:21:55 +06:00
c3c69f3e7f some step 2025-09-17 16:30:41 +06:00
4fb662c560 third stage of suggested_post_parameters implementation 2025-09-15 18:14:51 +06:00
cc967c2981 add suggestedPostParameters in contents 2025-09-15 17:53:59 +06:00
aa7bf426f1 second stage of suggested_post_parameters implementation 2025-09-15 17:49:33 +06:00
0b2735ca1e add support of suggestedPostParameters in requests 2025-09-15 16:46:44 +06:00
48bfa76b9e implemented direct message thread id????? 2025-09-15 12:32:35 +06:00
79a0e202d8 fix of directMessageThreadId passes 2025-09-15 12:32:35 +06:00
152bf2af02 fix of apiDump 2025-09-15 12:32:35 +06:00
0163e5ce8c fix of apiDump 2025-09-15 00:32:25 +06:00
62b4a21650 some progress on support of directMessageThreadId 2025-09-15 00:12:53 +06:00
f312e04c0d add directMessageThreadId parameter in create resend 2025-09-14 23:19:54 +06:00
1c36c0a2f7 add directMessageThreadId in factories of sending classes 2025-09-14 15:14:38 +06:00
bd73852253 let forwardMessage(s) extend OptionallyDirectMessageThreadRequest 2025-09-14 14:48:20 +06:00
fbb2511fca Merge branch 'master' into 29.0.0 2025-09-14 14:43:49 +06:00
f22d571484 Merge pull request #1003 from InsanusMokrassar/28.0.2
28.0.2
2025-09-10 15:59:20 +06:00
9be5ebb036 refactor changelog 2025-09-10 15:58:43 +06:00
da4cd527ec fix of #1002 2025-09-10 15:45:45 +06:00
4117288b21 fix of #1001 2025-09-10 15:33:07 +06:00
458bdd3ee4 start 28.0.2 2025-09-10 15:29:55 +06:00
8101c4c9fb add publisher_chat support 2025-09-09 18:00:53 +06:00
255416f72a add support of appriveSuggestedPost and declineSuggestedPost 2025-09-09 17:34:48 +06:00
6eb7563c70 add support of is_paid_post field 2025-09-09 17:15:59 +06:00
b9bdf7cc72 add is_paid_post as simple boolean 2025-09-09 17:12:16 +06:00
4a8e1ee7b7 upfix for updating of chat member rights 2025-09-09 17:02:54 +06:00
23bfe02e6f add support of can_manage_direct_messages right 2025-09-09 16:58:47 +06:00
658c19092c Merge branch 'master' into 29.0.0 2025-09-04 16:39:36 +06:00
d469a88791 Merge pull request #1000 from InsanusMokrassar/28.0.1
28.0.1
2025-09-04 16:38:10 +06:00
514bc699dd update dependencies 2025-09-04 16:37:57 +06:00
bec72b8cf8 fix of default thread id 2025-09-04 16:24:54 +06:00
fb0014dffa start 28.0.1 2025-09-04 16:10:16 +06:00
ebc1c07404 small improvements 2025-09-04 16:09:30 +06:00
989d33acb8 start separate channel direct messages thread id insttead of one merged message thread id 2025-09-03 19:44:42 +06:00
5aa6ac3320 separate messageThreadId with direct_messages_topic in chats creation 2025-08-25 16:48:01 +06:00
048f65b8d4 Partially add DirectMessagesTopic 2025-08-25 16:39:23 +06:00
b69be31362 add a lot of things from update 2025-08-25 15:43:42 +06:00
b92288d7cc add realization of several suggested post events 2025-08-23 16:09:17 +06:00
6c02d57197 add support of reply_to_checklist_task_id 2025-08-19 12:59:29 +06:00
e977c865ea add ReplyParameters#checklistTaskId -.- 2025-08-19 12:30:12 +06:00
18b459fdf8 start 29.0.0 2025-08-19 11:46:36 +06:00
2bbd2e0679 Merge pull request #993 from InsanusMokrassar/28.0.0
28.0.0
2025-08-11 15:55:27 +06:00
bcf7e835e6 add breaking changes note 2025-08-11 15:55:01 +06:00
4dd9740fec fill changelog and add kdocs for firstOf 2025-08-11 15:50:06 +06:00
2182e44bc2 add overloads for containsCommand 2025-08-11 15:28:21 +06:00
08c885de2f add extension of containsCommand 2025-08-11 01:02:22 +06:00
facecf35fb add firstOf 2025-08-11 00:47:35 +06:00
b13f24153f add filtering of waiters with commands for other usernames 2025-08-10 23:28:30 +06:00
12ee862dad small fix in filter of commands 2025-08-10 23:03:17 +06:00
0726574852 improvements in copying of behaviour contexts 2025-08-10 22:50:21 +06:00
9a00193e59 improvements in data filling 2025-08-10 22:47:52 +06:00
0fd8c1e2f3 add filtering out of other bots commands by default 2025-08-10 18:24:34 +06:00
c09d089707 add lazy loadable bot info 2025-08-10 18:05:48 +06:00
ff39271afd start 28.0.0 2025-08-10 17:02:41 +06:00
35a4edd643 start 27.2.0 2025-08-10 16:51:23 +06:00
ba647ee5ab Update README.md 2025-08-06 17:46:43 +06:00
d2924ce1f2 Merge pull request #992 from InsanusMokrassar/27.1.2
27.1.2
2025-08-06 15:59:17 +06:00
72781487f0 add note about Something web wrong 2025-08-06 14:00:29 +06:00
de435e5dbc Merge pull request #986 from BlackBaroness/patch-1
fix: typo in default error messages
2025-08-06 13:57:59 +06:00
f975754058 try to fix cancelling on timeout for long polling 2025-08-06 13:14:22 +06:00
0f7536a21c start 27.1.2 2025-08-06 13:10:42 +06:00
d4c085c9b6 Merge pull request #991 from InsanusMokrassar/27.1.1
27.1.1
2025-08-04 01:59:53 +06:00
667c49f13d update dependencies 2025-08-04 01:36:56 +06:00
e1d9ebff90 jvmApiDump 2025-08-04 01:33:12 +06:00
fbc7088dad fix of #990 2025-08-04 01:25:16 +06:00
4ba9c8ee97 start 27.1.1 2025-08-04 01:24:02 +06:00
92611b5c26 Merge pull request #985 from InsanusMokrassar/27.1.0
27.1.0
2025-07-28 20:23:07 +06:00
2e1c0d41ec update service dependencies 2025-07-28 20:09:58 +06:00
3ce56745f4 add fileLinkUrlMapper to all callers of TelegramAPIUrlsKeeper constructors 2025-07-28 20:04:59 +06:00
1bc9ee4d5a add TelegramAPIUrlsKeeper#fileLinkUrlMapper and fill readme Bot API Server Notice 2025-07-27 15:06:47 +06:00
BlackBaroness
0650fc594f fix: typo in default error messages 2025-07-27 07:34:56 +03:00
2f4de37489 fix build 2025-07-25 21:53:08 +06:00
cec5a0af12 improve support of local bot api servers 2025-07-25 21:35:38 +06:00
5e5dc6b36b start 27.1.0 2025-07-25 21:00:44 +06:00
19265357a2 Merge pull request #981 from InsanusMokrassar/27.0.0
27.0.0
2025-07-22 20:32:37 +06:00
49c2836e62 fill changelog and update dependencies 2025-07-22 19:42:23 +06:00
f7476188eb so, now? 2025-07-21 22:55:36 +06:00
2ba447b126 fix of cancellation exception throwing? 2025-07-21 20:41:51 +06:00
3bd4fab3fe migrate onto 27.0.0 due to potentially breaking changes 2025-07-12 15:44:39 +06:00
9e4d7dd9f9 WAT A HUGE REFACTOR 2025-07-12 15:42:48 +06:00
586a61157d update dependencies 2025-07-12 13:20:02 +06:00
045265f0f8 update dependencies 2025-07-12 13:06:35 +06:00
c125eadaa4 Update README.md 2025-07-10 17:39:40 +06:00
3dd0a91c54 Merge pull request #979 from InsanusMokrassar/26.1.0
26.1.0
2025-07-10 16:44:46 +06:00
2ecd42c859 fill changelog (-.-) and remove redundant file 2025-07-10 16:13:19 +06:00
3857950141 fixes 2025-07-08 18:38:12 +06:00
6d5bedd315 add workarounds for checklists 2025-07-08 11:47:05 +06:00
69a9e8f820 several fixes 2025-07-08 11:43:13 +06:00
6d8693a003 add typed origin, nextTransferDate and last_resale_star_count in GiftSentOrReceived 2025-07-07 22:18:16 +06:00
c990d987f5 add support of general changes 2025-07-07 21:48:23 +06:00
b8530f14ca add checklist as field in ExternalReplyInfo and add support of EditMessageChecklist 2025-07-07 21:29:29 +06:00
db8bac9b52 add ChecklistTasksAdded and ChecklistTasksDone events 2025-07-07 21:19:17 +06:00
e53b3b8198 improve support of send checklist 2025-07-07 21:03:04 +06:00
71ccfc88cc start add SendChecklist 2025-07-07 16:25:21 +06:00
dd2923f92d complete base checklists? 2025-07-07 15:39:48 +06:00
ff78153591 small improvements 2025-07-07 15:18:22 +06:00
e2ce9cfebf preview version of inputs for tasks 2025-07-07 14:38:39 +06:00
0a01d2567e add checklist 2025-07-04 11:53:16 +06:00
e4fb45c09b start realize Bots API 9.1 2025-07-03 22:25:47 +06:00
db0df975c7 start 26.1.0 2025-07-03 22:07:16 +06:00
2003b314a3 update maven badge 2025-06-30 14:00:07 +06:00
55a78375be Merge pull request #977 from centralhardware/PR1
docs: make buildEntities usage more obvious to anyone not familiar with Telegram Bot API or ktgbotapi
2025-06-23 21:20:33 +06:00
alex
256607e336 docs: make buildEntities usage more obvious to anyone not familiar with Telegram Bot API or ktgbotapi 2025-06-23 18:58:08 +08:00
92f2a5afdb Merge pull request #974 from InsanusMokrassar/26.0.0
26.0.0
2025-06-15 19:46:05 +06:00
3affcf4399 Update build.gradle 2025-06-15 19:37:59 +06:00
67dfa19a1b Update CHANGELOG.md 2025-06-15 19:37:26 +06:00
86e83f7f1a refactor: expectFlow 2025-06-15 12:24:23 +06:00
429fc5d2f9 small improvements in long polling and behaviour buildr 2025-06-15 11:38:17 +06:00
d19e6ad4e0 fill changelog 2025-06-15 10:34:42 +06:00
134145f441 fix version in gradle.properties -.- 2025-06-14 23:41:23 +06:00
ef76fe52ca fill changelog 2025-06-14 19:40:05 +06:00
bab69f523a small refactor 2025-06-14 19:36:17 +06:00
91f4d3bf24 build fix :) 2025-06-14 19:33:34 +06:00
3e316dfde0 fix in build?:) 2025-06-14 19:28:58 +06:00
1ef49ad48c remove suspend in all triggers 2025-06-14 19:11:18 +06:00
9297824dc3 make changes almost not breaking 2025-06-14 17:58:58 +06:00
d02ed592d8 fix of build 2025-06-14 16:31:11 +06:00
6ea9a28c7c start migration to non-suspend expect flow 2025-06-14 11:36:17 +06:00
88fc4fc444 fix of build 2025-06-13 14:05:56 +06:00
dd0de3b6d4 add RequestsExecutor.Log 2025-06-13 13:53:44 +06:00
838fff8207 fill changelog 2025-06-11 09:25:22 +06:00
751a77f6d8 start 25.0.2 2025-06-11 08:58:56 +06:00
222fe7594f Merge pull request #972 from InsanusMokrassar/25.0.1
25.0.1
2025-06-08 18:54:25 +06:00
ed6d4d07c6 create 25.0.1 branch for release 2025-06-08 18:53:30 +06:00
78d9ce8d19 add nmcp 2025-06-08 18:52:40 +06:00
345009da32 Update build.gradle 2025-06-08 13:49:29 +06:00
de47497223 Merge pull request #965 from InsanusMokrassar/25.0.0
25.0.0
2025-06-01 22:36:53 +06:00
7477625380 fill changelog and readme 2025-06-01 22:32:58 +06:00
970abf8cde more improvements :) 2025-06-01 22:07:35 +06:00
5a7741faf6 fix of captionLength 2025-06-01 22:03:03 +06:00
8aa29e56d3 add extensions splitFor(Text|Caption) and fix captionLength 2025-06-01 22:01:28 +06:00
dab5e072d0 fixes in GiftPremiumSubscription and TransferBusinessAccountStars 2025-06-01 21:47:40 +06:00
94078939d1 add EditStory with builder of text 2025-06-01 21:24:17 +06:00
824d3862e3 fixes in stories 2025-06-01 20:23:38 +06:00
44f92e8d6c fixes in new multipart api 2025-06-01 19:24:58 +06:00
ddb79c0d8d update publishing way 2025-05-31 17:04:51 +06:00
a9562cc8f9 fix signature of removeBusinessAccountProfilePhoto 2025-05-31 09:48:38 +06:00
8a351d5be0 one more fix in SetBusinessAccountUsername 2025-05-25 19:24:41 +06:00
8cd5659b7b updates in Username 2025-05-25 19:24:41 +06:00
1474a07b9e updates in Username 2025-05-25 18:28:45 +06:00
c13a0d3193 add special error type for device and secure sorages 2025-05-25 13:33:34 +06:00
172f49fa6b update publication scripts 2025-05-25 12:41:34 +06:00
4d42972a7e add css variables names in webapps 2025-05-25 12:30:16 +06:00
c0883d0180 update github publishing part 2025-05-16 12:41:45 +06:00
e7367da3cb add support of PostStory and EditStory 2025-05-10 22:32:38 +06:00
effd12711f add support of transferGift 2025-05-10 17:59:29 +06:00
ef1d2e8242 add support of convertGiftToStars and upgradeGift 2025-05-10 17:53:49 +06:00
881763f3af add support of gift things 2025-05-10 13:25:21 +06:00
d36b11c002 add support of getBusinessAccountGifts 2025-05-10 10:58:17 +06:00
d2395e836c add support of setBusinessAccountGiftSettings 2025-05-10 10:35:26 +06:00
c8c008edd3 add support of deleteStory 2025-05-10 10:28:32 +06:00
3b4fa06924 several fixes of build: jvmApiDump, TransactionType.Unknown @JvmInline 2025-05-10 10:17:15 +06:00
5d428a5e54 add LocationAddress and StoryAreaPosition 2025-05-01 16:06:16 +06:00
8964e08ce6 add support of InputStoryContent 2025-05-01 15:38:07 +06:00
745168d181 refactor: small change of arguments passing order in TransactionPartner serializer 2025-04-30 18:18:54 +06:00
a408c6c7c7 overwrite TransactionType 2025-04-30 08:46:13 +06:00
e0f5e9b640 Merge pull request #967 from bpavuk/api-v9.0-premium
API v9.0 - Telegram Premium
2025-04-30 08:22:07 +06:00
0331ff2f42 make TelegramBot.giftPremiumSubscription parseMode parameter nullable 2025-04-30 08:21:11 +06:00
a21d0b56db start add InputStoryContent 2025-04-23 17:58:01 +06:00
Bodya
6ea8afee8f Merge branch '25.0.0' into api-v9.0-premium 2025-04-22 22:48:26 +03:00
Bodya
8799aeca26 fix: corrected method name 2025-04-21 10:34:21 +03:00
c610f4eab2 update classcasts 2025-04-21 12:16:17 +06:00
92cd2a3def Merge pull request #966 from bpavuk/api-v9.0-gifts
API v9.0 - Gifts
2025-04-21 10:14:10 +06:00
03d158b03b Merge branch '25.0.0' into api-v9.0-gifts 2025-04-21 10:13:06 +06:00
bpavuk
608fde4139 refactor: replace transactionType String with TransactionType enum 2025-04-19 16:11:44 +03:00
9e56a6cc1a small updates in DeviceStorage 2025-04-19 13:01:52 +06:00
c0e3c1d02f update classcasts and api dumps 2025-04-19 12:58:18 +06:00
341a527d27 add support of paid messages 2025-04-19 12:56:10 +06:00
bpavuk
8d6d70a06a refactor: replaced Gift with Gift.Regular across APIs and data models 2025-04-17 18:31:56 +03:00
bpavuk
67fb552d01 refactor: moved unique gift properties into separate package 2025-04-17 18:18:17 +03:00
bpavuk
93e937aa6a refactor: merged UniqueGift and regular Gift types into one interface 2025-04-17 18:16:52 +03:00
bpavuk
09dee188d2 refactor: merged GiftInfo and UniqueGiftInfo into one sealed interface 2025-04-17 17:38:16 +03:00
bpavuk
29c6bb5dac fix: made entities field optional for GiftInfo 2025-04-17 17:27:34 +03:00
c266ab0120 add support of DeviceStorage and SecureStorage 2025-04-17 18:56:32 +06:00
bpavuk
b407fc5c86 feat: added the giftPremiumSubscription method 2025-04-16 19:49:49 +03:00
bpavuk
1bde43ceaf feat: added the transactionType field to TransactionPartner.User 2025-04-16 18:51:55 +03:00
bpavuk
389a508fa7 feat: added premiumSubscriptionDuration field to TransactionPartner 2025-04-16 18:36:02 +03:00
bpavuk
69c2586b50 aider init 2025-04-16 18:20:03 +03:00
bpavuk
7e80f4edac fix: removed leftovers of merge conflict resolving on GitHub 2025-04-16 17:57:27 +03:00
Bodya
99987c3f51 Merge branch '25.0.0' into api-v9.0-gifts 2025-04-16 16:37:24 +03:00
bpavuk
713130fd13 fix: brought back the canReceiveGifts field, marked as deprecated 2025-04-16 16:34:33 +03:00
deb8d7b43a add api bindings to new requests 2025-04-16 18:42:13 +06:00
b604444f7d add core requests for business account (excluding gifts) 2025-04-16 18:07:45 +06:00
Bodya
cb6127bf91 fix: accepted_gift_types field is not optional anymore 2025-04-13 17:14:24 +03:00
Bodya
d40919f099 style: separated annotations and values with line breaks in GiftInfo.kt 2025-04-13 17:11:31 +03:00
Bodya
7cb576e6b1 fix: fixed defaults in AcceptedGiftTypes 2025-04-13 17:10:10 +03:00
bpavuk
b53fb8da36 feat: added constructor to GiftInfo 2025-04-13 16:42:28 +03:00
bpavuk
03ea8dfe7f fix: removed useless docs 2025-04-13 16:37:07 +03:00
bpavuk
314c8d9ad1 fix: using RGBColor abstractions instead of raw Int values now. 2025-04-13 16:34:41 +03:00
bpavuk
6fceee4199 fix: moved classes related to unique gifts to appropriate packages 2025-04-13 16:33:31 +03:00
bpavuk
e720da708c fix: moved AcceptedGiftTypes.kt to the appropriate package 2025-04-13 16:32:47 +03:00
bpavuk
d65706631f Merge remote-tracking branch 'origin/api-v9.0-gifts' into api-v9.0-gifts
# Conflicts:
#	tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/gifts/UniqueGiftInfo.kt
2025-04-13 16:31:35 +03:00
bpavuk
3312b64564 fix: added default AcceptedGiftTypes in Extended.kt 2025-04-13 16:30:37 +03:00
bpavuk
1bfe431393 fix: added defaults to AcceptedGiftTypes 2025-04-13 16:27:52 +03:00
bpavuk
6485353704 fix: UniqueGiftInfo constructor is now public 2025-04-13 16:27:04 +03:00
bpavuk
46a1ed27b7 feat: implemented UniqueGiftInfo class 2025-04-13 15:58:36 +03:00
bpavuk
9f3024476c feat: implemented GiftInfo class 2025-04-13 15:55:36 +03:00
bpavuk
93d0e009bb feat: replaced canReceiveGifts with acceptedGiftTypes and AcceptedGiftTypes class 2025-04-13 15:49:05 +03:00
bpavuk (aider)
ef60549e1c feat: Add AcceptedGiftTypes data class and related constants 2025-04-13 14:38:25 +03:00
bpavuk (aider)
2ac83156f6 feat: Add UniqueGift type with related fields and constants 2025-04-13 14:35:37 +03:00
bpavuk (aider)
4c9d888668 feat: Add UniqueGiftBackdrop type 2025-04-13 14:32:46 +03:00
bpavuk (aider)
cd3ba8f480 feat: Add UniqueGiftBackdropColors data class 2025-04-13 14:30:33 +03:00
bpavuk (aider)
99559f477e feat: Add UniqueGiftModel type 2025-04-13 14:30:33 +03:00
bpavuk (aider)
a3949c752d feat: Add UniqueGiftSymbol data type 2025-04-13 14:17:37 +03:00
fd48a52266 add BusinessBotRights 2025-04-13 09:28:41 +06:00
3e0036f7df start 25.0.0 2025-04-13 09:05:08 +06:00
2978932c87 Merge pull request #957 from InsanusMokrassar/24.0.2
24.0.2
2025-03-26 10:15:11 +06:00
c773736fb8 Update CHANGELOG.md 2025-03-26 10:12:19 +06:00
8a3a05ef12 fix of cancelling absence for subchains which become out of FSM 2025-03-26 09:45:30 +06:00
0afbe8ef2d update dependencies 2025-03-25 18:56:59 +06:00
3f4018f969 update KSLog part of library 2025-03-03 09:25:19 +06:00
097d82b4b4 start 24.0.2 2025-03-03 08:59:16 +06:00
7c2a379161 Merge pull request #956 from InsanusMokrassar/24.0.1
24.0.1
2025-03-01 15:05:23 +07:00
ba5f76e8cd fix of EditChatMessageMedia 2025-03-01 14:04:08 +06:00
8aec920a15 start 24.0.1 2025-03-01 12:57:35 +06:00
c92bd33ba1 Merge pull request #952 from InsanusMokrassar/24.0.0
24.0.0
2025-02-20 22:34:35 +06:00
51927974f5 ForumContentMessage.threadCreatingInfo 2025-02-20 11:54:41 +06:00
9350f87e19 update dependencies 2025-02-20 09:00:01 +06:00
6cb9950b36 fix of subcontextUpdatesFilter 2025-02-18 23:09:28 +06:00
974c2e883f start 24.0.0 2025-02-18 23:04:47 +06:00
af6f98fd56 Update FUNDING.yml 2025-02-18 09:15:13 +06:00
75a2b2c282 Merge pull request #951 from InsanusMokrassar/23.2.1
23.2.1
2025-02-17 21:16:15 +06:00
d66d4b4209 jvmApiDump 2025-02-17 13:18:55 +06:00
9d54820fd7 fill changelog 2025-02-17 13:17:26 +06:00
1876df2c2d fix of year in Birthdate 2025-02-17 13:16:10 +06:00
d818592cd3 start 23.2.1 2025-02-17 13:14:03 +06:00
c29737b6b3 update changelog and readme 2025-02-15 20:53:28 +06:00
46243a21eb Merge pull request #949 from InsanusMokrassar/23.2.0
23.2.0
2025-02-15 14:28:08 +06:00
d5f45ead59 correct microutils version 2025-02-15 10:27:15 +06:00
5a696cdac0 fixes 2025-02-15 09:49:18 +06:00
80955eeb55 jvmApiDump, once more :) 2025-02-15 09:06:25 +06:00
6ee93e2d68 jvmApiDump 2025-02-14 21:35:49 +06:00
d4490dec75 potentially cover new update of Bot API 2025-02-14 21:01:47 +06:00
7d3e9325f1 add support of TransactionPartnerChat 2025-02-14 18:42:48 +06:00
31a66eb8e6 add support of can_send_gift 2025-02-14 18:36:20 +06:00
b3b9070cd6 add support for sending of gifts to chats 2025-02-13 12:17:05 +06:00
3504776344 update dependnecies 2025-02-13 11:39:58 +06:00
f22f69534a start 23.2.0 2025-02-13 09:14:39 +06:00
a9c1d7b33c Merge pull request #938 from InsanusMokrassar/renovate/org.jetbrains.kotlinx-kotlinx-serialization-json-1.x
Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.8.0
2025-02-10 16:40:00 +06:00
renovate[bot]
376ef0750c Update dependency org.jetbrains.kotlinx:kotlinx-serialization-json to v1.8.0 2025-02-10 10:38:11 +00:00
cdf93e0d12 Merge pull request #944 from InsanusMokrassar/23.1.2
23.1.2
2025-01-29 12:56:51 +06:00
8c7261fda9 update dependencies 2025-01-29 12:39:36 +06:00
82acc8cb1f start 23.1.2 2025-01-29 12:37:58 +06:00
4ec1532597 Merge pull request #942 from InsanusMokrassar/23.1.1
23.1.1
2025-01-27 09:46:48 +06:00
13bfe681d8 jvmApiDump 2025-01-27 09:43:47 +06:00
5bbbcdb529 update CHANGELOG 2025-01-27 09:18:10 +06:00
7f9d6ce626 update microutils 2025-01-27 09:17:12 +06:00
71b944f9cc replace removeFirst with removeAt(0) in createTextSources 2025-01-27 09:09:06 +06:00
d9d68749f1 start 23.1.1 2025-01-27 09:08:28 +06:00
561aad2274 Merge pull request #937 from InsanusMokrassar/23.1.0
23.1.0
2025-01-03 09:39:59 +06:00
6a3e95c488 fix in SendGift 2025-01-03 09:32:02 +06:00
a09b3809e2 update telegram bot api support badge 2025-01-03 09:29:15 +06:00
427b5775a2 add support of verification methods 2025-01-03 09:25:36 +06:00
d222987fc7 remove hide_url from InlineQueryResultArticle 2025-01-03 09:09:03 +06:00
d211afa26a add support of pay_for_upgrade and jvmApiDump 2025-01-03 09:01:17 +06:00
9952b6c6ae add upgrade_star_count to Gift and fix serialization of gift 2025-01-03 08:53:40 +06:00
840c6b02a4 start 23.1.0 2025-01-02 10:30:52 +06:00
a6f91d5600 Merge pull request #935 from InsanusMokrassar/renovate/validator
Update dependency org.jetbrains.kotlinx.binary-compatibility-validator to v0.17.0
2024-12-26 15:40:08 +06:00
8ec0c8804b update link to remote url in dokka 2024-12-26 09:05:11 +06:00
2d08c447bc Merge pull request #934 from InsanusMokrassar/23.0.0
23.0.0
2024-12-25 11:17:34 +06:00
9a0793d81c rename old strikethrough factory 2024-12-25 11:09:16 +06:00
a95f556a5c jvmApiDump 2024-12-21 10:27:15 +06:00
f774b11de4 update dependencies 2024-12-21 10:10:30 +06:00
renovate[bot]
5164903d05 Update dependency org.jetbrains.kotlinx.binary-compatibility-validator to v0.17.0 2024-12-19 19:18:44 +00:00
adaedb8040 text sources factories renames 2024-12-19 16:31:42 +06:00
9b4b60eb33 start 23.0.0 2024-12-19 16:30:31 +06:00
b90f8ec389 Merge pull request #928 from InsanusMokrassar/22.0.0
22.0.0
2024-12-08 13:34:11 +06:00
e95550a6eb rename subscriptionPayment 2024-12-08 13:24:34 +06:00
696219df24 add api methods for setUserEmojiStatus 2024-12-08 12:51:16 +06:00
27241fad32 add default for device orientation start 2024-12-08 11:40:09 +06:00
a034fa18d7 fixes in status info 2024-12-08 10:40:09 +06:00
adcaffe115 add sealed workaround for webapp event type 2024-12-08 10:26:53 +06:00
6388d8db13 make chat in WebAppInitData nullable 2024-12-08 10:17:02 +06:00
2964586cb9 add defaults to remove/set 2024-12-08 09:42:02 +06:00
e3cb1e4faf add definedExternally in CloudStorage 2024-12-08 09:16:56 +06:00
d7f14020d8 rename field of user id in SavePreparedInlineMessage 2024-12-07 10:48:06 +06:00
397197023e fix of serializer for result in SavePreparedInlineMessage 2024-12-07 10:31:28 +06:00
12dc93313a update dependencies 2024-12-06 13:20:01 +06:00
625760afae jvmApiDump 2024-12-06 13:01:01 +06:00
795328afdf add notes about breaking changes and update latest supported API version 2024-12-06 13:00:10 +06:00
57175b7698 add affiliate in TransactionPartner.User 2024-12-06 12:56:00 +06:00
2d05a334eb add support of AffiliateProgram in TransactionPartner 2024-12-06 12:39:04 +06:00
0b6d9e47b9 add support of nanostar_amount 2024-12-06 12:32:38 +06:00
4cdae11adc support of Ed25519TelegramKeys 2024-12-06 12:26:11 +06:00
04b2d1dbd6 jvmApiDump and fix of CreateInvoiceLink API bindings 2024-12-06 12:19:53 +06:00
4343d6d161 potentially complete events generator 2024-12-06 12:11:54 +06:00
6824f2c992 preparations for events generating 2024-12-06 10:23:06 +06:00
9cde4927ce refactor and fixes 2024-12-05 21:04:54 +06:00
819982473a start adding events generator 2024-12-05 18:00:39 +06:00
5559923339 add support of saving prepared messages 2024-12-05 16:25:20 +06:00
c7d08df3bf continue adding support of webapps updates 2024-12-05 16:07:46 +06:00
41a142addb support of accelerometer, gyroscope, location and orientation data 2024-12-05 15:49:07 +06:00
652765bf46 add support for subscriptions 2024-12-05 11:35:33 +06:00
32010cf1c7 replace isActive 2024-12-05 09:42:43 +06:00
1c6359f041 add a lot of things in web apps 2024-12-05 09:41:31 +06:00
4ac5e405ac add support for gifts 2024-12-05 09:09:40 +06:00
bc00e1f28a Merge branch 'master' into 22.0.0 2024-12-05 08:30:36 +06:00
191e4cff00 Merge pull request #929 from InsanusMokrassar/21.0.1
21.0.1
2024-12-03 11:09:01 +06:00
de91cc5382 mention improvements 2024-12-03 11:07:02 +06:00
96b872953b fill changelog 2024-12-03 09:54:54 +06:00
433b0989ee jvmApiDump 2024-12-03 09:52:19 +06:00
eddd60ebb1 add toUser cast and fix of sourceUser 2024-12-03 09:52:19 +06:00
8b63ed7fa9 improvements in CombinedSubcontextInitialAction 2024-12-03 09:52:19 +06:00
85539a9d58 start 21.0.1 2024-12-03 09:52:19 +06:00
ad4bac82dc update versions 2024-12-01 20:04:34 +06:00
300be87ffd Merge branch 'master' into 22.0.0 2024-12-01 20:03:28 +06:00
05f46d08c8 Merge pull request #923 from InsanusMokrassar/21.0.0
21.0.0
2024-11-30 15:25:59 +06:00
eb72ff1c94 update dependencies 2024-11-30 14:55:34 +06:00
6b3fabdb30 fill changelog and add docs for CombinedSubcontextInitialAction 2024-11-30 14:38:40 +06:00
402e695f99 add CombinedSubcontextInitialAction 2024-11-30 14:11:43 +06:00
a87560bc40 migrate onto 21.0.0 due to breaking changes 2024-11-30 01:20:39 +06:00
6d300de470 add data on behaviour contexts 2024-11-29 01:09:47 +06:00
3658403f01 start including context data in BehaviourContext 2024-11-28 19:48:48 +06:00
082aeab700 start 20.1.0 2024-11-28 18:19:35 +06:00
4eb6fa7835 start 21.0.0 2024-11-25 14:40:40 +06:00
ddf34aad3f Merge pull request #921 from InsanusMokrassar/20.0.1
20.0.1
2024-11-11 14:11:51 +06:00
c818a44044 fill changelog 2024-11-11 13:52:31 +06:00
d578f6af90 jvmApiDump 2024-11-11 13:38:09 +06:00
5ce4e4cbc0 fix of modifyRow 2024-11-11 13:37:20 +06:00
41e369cea5 fix of #761 2024-11-11 13:35:46 +06:00
f85d4a36e1 fix of #860 2024-11-11 13:14:28 +06:00
fb3b8a7415 fix of #917 2024-11-11 13:03:46 +06:00
609c2b5fad fix of #919 2024-11-11 12:39:42 +06:00
2c602e4434 Merge pull request #920 from byteduck-exploit/patch-1
Use correct method name for createInvoiceLink.
2024-11-11 12:38:01 +06:00
1a3c9bca1d start 20.0.1 2024-11-11 12:36:30 +06:00
Alex
43496505a7 Use correct method name for createInvoiceLink. 2024-11-11 05:14:07 +01:00
4a0c0bdc40 Merge pull request #916 from InsanusMokrassar/20.0.0
20.0.0
2024-11-01 23:47:21 +06:00
fa9c95f799 add notes about support of Telegram Bots API 7.11 2024-11-01 23:42:22 +06:00
dd6f7577ba migrate onto 20.0.0 due to breaking changes 2024-11-01 23:40:02 +06:00
7d47d0ab61 jvmApiDUmp 2024-11-01 23:32:56 +06:00
636c01acb9 fixes in copyText keyboard buttons 2024-11-01 23:10:47 +06:00
479923a04a more jvmApiDump to god of jvmApiDump 2024-11-01 14:50:46 +06:00
ccfa6e7b6d jvmApiDump 2024-11-01 14:45:39 +06:00
65048648b8 improve support of media adding to text messages 2024-11-01 14:44:20 +06:00
50b2db8859 potentially, add support of mentions in usernames 2024-11-01 14:40:08 +06:00
45bbcb5ec1 add support of TransactionPartnerTelegramApi 2024-11-01 14:23:54 +06:00
dc463b5626 add copy_text button and allowPaidBroadcast field in requests 2024-11-01 02:04:22 +06:00
d80e578a4c start 19.1.0 2024-10-31 23:58:41 +06:00
b26d21a817 Merge pull request #914 from InsanusMokrassar/19.0.0
1.9.0 (Fill changelog)
2024-10-31 13:25:56 +06:00
2052072e5d fix in changelog 2024-10-31 13:25:40 +06:00
6fb3d3fcb1 fill changelog and get back webhooks to old looks like 2024-10-31 13:24:47 +06:00
c39e9fc156 Merge pull request #913 from InsanusMokrassar/19.0.0
19.0.0
2024-10-31 01:57:56 +06:00
9c5793bec7 change task used for ksp generation 2024-10-30 18:57:47 +06:00
fd9bff611b small prenote in changelog 2024-10-30 15:17:05 +06:00
bb66279044 jvmApiDump 2024-10-30 15:15:49 +06:00
24b48f2536 update dependencies 2024-10-30 15:14:52 +06:00
670c26c982 Merge pull request #912 from d1snin/18.2.3
Migrate to ktor 3.0.0
2024-10-30 15:13:33 +06:00
7ed5d9ceed start 19.0.0 2024-10-30 14:53:04 +06:00
787941fcaf Merge pull request #911 from InsanusMokrassar/18.2.3
18.2.3
2024-10-30 14:51:44 +06:00
6c9f1bc016 get back default list of middlewares 2024-10-30 14:41:22 +06:00
e5bffa7c51 upgrade onRequestResultPresented in middlewares 2024-10-30 13:53:36 +06:00
d1snin
3fe26b057a migrate to ktor 3.0.0 2024-10-27 05:43:27 +03:00
dccd15a5e9 jvmApiDump 2024-10-24 23:13:12 +06:00
3d14c93d89 make DefaultKtorRequestsExecutor now uses runCatching instead of runCatchingSafely 2024-10-24 22:53:34 +06:00
b8a6534b6a add ExceptionsThrottlerTelegramBotMiddleware 2024-10-24 22:49:28 +06:00
f5529033ec start 18.2.3 2024-10-24 21:54:20 +06:00
482c375327 Merge pull request #909 from InsanusMokrassar/18.2.2
18.2.2
2024-10-21 18:26:54 +06:00
abb8b3491d update dependencies 2024-10-21 18:24:28 +06:00
2953005e6d jvmApiDump 2024-10-21 18:07:09 +06:00
1f6ddd97e3 improvements in RawMessageEntity 2024-10-21 18:04:53 +06:00
bc8da1120e Update CommonMessageFilterExcludeCommand.kt 2024-10-17 00:42:40 +06:00
e895c2f3a8 Update CommonMessageFilterExcludeCommand.kt 2024-10-17 00:30:15 +06:00
f84180b3ff revert version 2024-10-15 13:50:44 +06:00
c21c8c5a26 jvmApiDump 2024-10-15 13:47:08 +06:00
27416daeb8 add additional functions in TelegramBotMiddlewareBuilder 2024-10-15 13:46:25 +06:00
b5b7482c2f add middlewares 2024-10-15 00:17:27 +06:00
a7f4ab36c6 start adding middlewares 2024-10-14 14:44:07 +06:00
7398e53b85 api dump 2024-10-14 10:59:06 +06:00
be25f705ef add CommonMessageFilterIncludeText 2024-10-13 18:28:26 +06:00
5ee87ac78d CommonMessageFilterExcludeCommand and SimpleFilter.minus 2024-10-13 18:23:45 +06:00
fbd53e1f2d start 18.2.2 2024-10-13 17:56:54 +06:00
9fe8df9e11 Merge pull request #903 from InsanusMokrassar/18.2.1
18.2.1 (update microutils additionally)
2024-09-26 02:01:50 +06:00
a053c08346 Update CHANGELOG.md 2024-09-26 02:00:57 +06:00
6fa769bce3 Update MicroUtils version 2024-09-26 02:00:30 +06:00
27ac8ee797 Merge pull request #902 from InsanusMokrassar/18.2.1
18.2.1
2024-09-25 22:01:47 +06:00
ce84e3c198 build fix 2024-09-25 21:20:53 +06:00
c3a3e9bd44 update dependencies 2024-09-25 21:14:02 +06:00
7b6be48ba8 start 18.2.1 2024-09-25 21:11:12 +06:00
e98d5c7a9c Merge pull request #896 from InsanusMokrassar/18.2.0
18.2.0
2024-09-09 00:11:29 +06:00
7db4f47e82 fixes in giveaways -.- 2024-09-08 23:34:27 +06:00
42985cfa37 remove reporting of /privacy handling absence in buildBehaviourWithLongPolling 2024-09-08 22:25:15 +06:00
02be5b5e48 add triggers and waiters for giveaways 2024-09-08 16:25:14 +06:00
be87e3c736 add triggers for giveaways 2024-09-08 16:10:04 +06:00
ccced36cd5 update changelog 2024-09-08 15:52:47 +06:00
af4c843369 remove redundant GiveawayInfo sealed interfaces 2024-09-08 15:39:06 +06:00
f0bd4c3719 several improvements 2024-09-08 15:17:14 +06:00
b3dfef9a38 more fixes 2024-09-08 02:18:05 +06:00
2e2abb8e15 more fixes to god of fixes 2024-09-07 02:59:04 +06:00
3cbfb2fb0b fixes 2024-09-07 02:43:25 +06:00
b60b0259db potentially complete implementation of Bot API 7.10 2024-09-07 00:19:33 +06:00
5d8deb4b9b add is_star_giveaway into GiveawayPrivateResults 2024-09-07 00:07:59 +06:00
d347c94c8b revoke rework of GiveawayPublicResults 2024-09-07 00:02:09 +06:00
6809b9d2ef start support of prize_star_count 2024-09-06 23:56:09 +06:00
1980f8a9ca add paid media payload support 2024-09-06 20:11:08 +06:00
3f726c9b3b start 18.2.0 2024-09-06 19:34:42 +06:00
4b8de04380 Merge pull request #895 from InsanusMokrassar/18.1.0
18.1.0
2024-09-05 00:54:58 +06:00
e4ac100b38 update api dump 2024-09-05 00:52:16 +06:00
f76e88c880 update createSubContextAndDoWithUpdatesFilter logic 2024-09-05 00:48:45 +06:00
19cb970461 start 18.1.0 2024-09-05 00:38:50 +06:00
159c5892e3 Merge pull request #894 from InsanusMokrassar/18.0.0
18.0.0
2024-09-02 01:24:57 +06:00
b03eef8bcb update ChatMemberUpdated#gotRestrictionsChanged 2024-08-30 22:58:23 +06:00
89360235a6 update MicroUtils 2024-08-30 22:29:42 +06:00
5b4a7d912e update api dump 2024-08-30 19:48:28 +06:00
6ba2b70f10 add waiters for new chat member updates extensions + add kicked variants in triggers 2024-08-30 19:45:27 +06:00
9f2ccde589 add kicked changes listening 2024-08-30 19:30:05 +06:00
048599414a add note about Nik-mmzd contribution in CHANGELOG 2024-08-30 19:18:30 +06:00
87ed66e3ad update ChatMember to use PreviewUser instead of User 2024-08-30 19:04:10 +06:00
e8a280c90d small optimization of extensions.gradle 2024-08-30 00:51:03 +06:00
b0d8abf6df one more dump 2024-08-29 18:52:27 +06:00
dd054f1e07 update jvm api dump 2024-08-29 18:26:29 +06:00
10d92c2fdb improvements and breaking changes in ChatMember hierarchy 2024-08-29 17:54:00 +06:00
2d40af21fe migration onto 18.0.0 2024-08-29 17:37:33 +06:00
93d1afdf1c update dependencies 2024-08-29 15:16:04 +06:00
39de983d42 Merge pull request #891 from Nik-mmzd/feature-888
Implement #888
2024-08-29 15:14:12 +06:00
McModder
49448408d1 Add triggers for newly introduced ChatMemberUpdated filters 2024-08-28 19:36:08 +03:00
McModder
04ead7e73d Add new methods to API dump 2024-08-28 16:43:15 +03:00
McModder
5175395be2 Fix class comparison in ChatMember.isMemberStrict and ChatMember.isAdministratorStrict 2024-08-28 16:34:55 +03:00
McModder
38e1d271ba Add extension functions to ChatMember and ChatMemberUpdated to simplify working with updates. Closes #888 2024-08-28 04:26:38 +03:00
6d90e571d9 add docs to new serialization/deserialization strategies and refactor several things 2024-08-24 22:47:43 +06:00
c03440c353 add common customizable serializer 2024-08-22 01:56:41 +06:00
d7e9c6a3a1 add customizing of UpdateDeserializationStrategy 2024-08-21 20:10:57 +06:00
f711eb013a start 17.1.0 2024-08-21 19:59:18 +06:00
e422c3bc33 Merge pull request #884 from InsanusMokrassar/17.0.0
17.0.0
2024-08-15 02:47:38 +06:00
680 changed files with 39213 additions and 11103 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,3 @@
# 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']

View File

@@ -17,7 +17,7 @@ jobs:
rm gradle.properties
mv gradle.properties.tmp gradle.properties
- name: KotlinSymbolProcessing execution
run: ./gradlew ksp
run: ./gradlew kspCommonMainKotlinMetadata
- name: Build
run: ./gradlew build
- name: API compatibility check
@@ -28,7 +28,7 @@ jobs:
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Gitea
- name: Publish to InmoNexus
continue-on-error: true
run: ./gradlew publishAllPublicationsToInmoNexusRepository
env:

2
.gitignore vendored
View File

@@ -9,7 +9,9 @@ settings.xml
.gradle/
build/
out/
bin/
local.properties
kotlin-js-store/
secret.gradle
.aider*

View File

@@ -1,5 +1,358 @@
# TelegramBotAPI changelog
## 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
* `Version`:
* `Kotlin`: `2.1.0` -> `2.1.10`
* `Serialization`: `1.7.3` -> `1.8.0`
* `MicroUtils`: `0.24.4` -> `0.24.5`
* `KSLog`: `1.4.0` -> `1.4.1`
## 23.1.1
* `Version`:
* `MicroUtils`: `0.24.0` -> `0.24.4`
* `Core`:
* Replace `removeFirst` with `removeAt(0)` in `createTextSources`
## 23.1.0
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 8.2](https://core.telegram.org/bots/api-changelog#january-1-2025)**
## 23.0.0
* `Version`:
* `Coroutines`: `1.9.0` -> `1.10.1`
* `MicroUtils`: `0.23.2` -> `0.24.0`
* `KSLog`: `1.3.6` -> `1.4.0`
* `Ktor`: `3.0.2` -> `3.0.3`
* `Core`:
* All old factory methods for `TextSource`s took suffix `TextSource`. For example: `regular` -> `regularTextSource`.
That has been for excluding names resolution ambiguity with extensions for `EntitiesBuilder`
## 22.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
**IN THIS UPDATE HAS BEEN REWORKED EVENTS API IN WEBAPPS**
**THIS UPDATE ADDING SUPPORT OF [BOT API 8.0](https://core.telegram.org/bots/api-changelog#november-17-2024) AND [BOT API 8.1](https://core.telegram.org/bots/api-changelog#december-4-2024)**
* `Version`:
* `MicroUtils`: `0.23.1` -> `0.23.2`
* `Ktor`: `3.0.1` -> `3.0.2`
## 21.0.1
* `Core`:
* Improvements in `Update.sourceUser` extension
* Add extension `PrivateChat.toUser`
* Builder methods of `TextSource`s (like `pre` which returns `PreTextSource`) lost suppression of `redundant inline`
due to its redundancy
* Add `mention` builders for `EntitiesBuilder` with `UserId` as variant instead of `User`
* `BehaviourBuilder`:
* Add support of several rounds for `CombinedSubcontextInitialAction`. Now it will try hard to execute all its
`SubAction` while all actions will not be completed successfully OR all left actions will not complete with errors
## 21.0.0
* `Version`:
* `Kotlin`: `2.0.21` -> `2.1.0`
* `MicroUtils`: `0.23.0` -> `0.23.1`
* `BehaviourBuilder`:
* Add special `val data: BehaviourContextData` into all realizations of `BehaviourContext`
* Add `CombinedSubcontextInitialAction` and functions
`buildSubcontextInitialAction`/`buildSubcontextInitialActionWithSubActions`
* Add `subcontextInitialAction` for all the functions-builders of `BehaviourContext` and
`additionalSubcontextInitialAction` to all triggers
## 20.0.1
* `Core`:
* Fix of logger propagation (fix of [#860](https://github.com/InsanusMokrassar/ktgbotapi/issues/860))
* Add opportunity to modify keyboards (fix of [#761](https://github.com/InsanusMokrassar/ktgbotapi/issues/761))
* Fields of `OrderInfo` became nullable (fix of [#917](https://github.com/InsanusMokrassar/ktgbotapi/issues/917))
* Add default `toString` to `ChatType` (fix of [#919](https://github.com/InsanusMokrassar/ktgbotapi/issues/919))
* Fix of method in `CreateInvoiceLink` (merging of [#920](https://github.com/InsanusMokrassar/ktgbotapi/issues/920), made by [byteduck-exploit](https://github.com/byteduck-exploit))
## 20.0.0
**THIS UPDATE CONTAINS SUPPORT OF [BOTS API 7.11](https://core.telegram.org/bots/api-changelog#october-31-2024)**
* `All`:
* **ALL SEND METHODS GOT PARAMETER `allowPaidBroadcast` WHICH POTENTIALLY MAY SPEND MONEYS FROM BOT BALANCE**
## 19.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
**THIS UPDATE CONTAINS UPGRADE UP TO KTOR 3.0 (thanks to [@d1snin](https://github.com/d1snin))**
* `Version`:
* `Ktor`: `2.3.12` -> `3.0.1`
* `MicroUtils`: `0.22.7` -> `0.23.0`
## 18.2.3
* `Core`:
* Add default middleware `ExceptionsThrottlerTelegramBotMiddleware`
* Make `TelegramBotMiddlewaresPipelinesHandler` to be default `TelegramBotPipelinesHandler`
* Make `DefaultKtorRequestsExecutor` now uses `runCatching` instead of `runCatchingSafely`
* `onRequestResultPresented` lambda now accepts non-nullable `result`
## 18.2.2
* `Version`:
* `Kotlin`: `2.0.20` -> `2.0.21`
* `MicroUtils`: `0.22.4` -> `0.22.7`
* `Core`:
* Fixes in blockquotes serializations
* Now `RawMessageEntity` is public. It is still under `Warning` annotation and is subject of changes
* `BehaviourBuilder`:
* Add `CommonMessageFilterExcludeCommand` to filter commands in messages
* Add `minus` operation for `SimpleFilter`s
## 18.2.1
* `Version`:
* `Serialization`: `1.7.2` -> `1.7.3`
* `Coroutines`: `1.8.1` -> `1.9.0`
* `MicroUtils`: `0.22.2` -> `0.22.4`
## 18.2.0
**THIS UPDATE CONTAINS SUPPORT OF [BOTS API 7.10](https://core.telegram.org/bots/api-changelog#september-6-2024)**
* `Core`:
* Customize `GiveawayCreated` to use stars in some cases
* `GiveawayInfo` lost parameter `premiumMonths` because of it is no included by default
* `GiveawayPublicResults` lost parameter `publicWinners` because of its abcence in Telegram Bot API
* Fix `GiveawayPublicResults` to be correctly deserializable
* Fix `GiveawayPrivateResults` to be correctly deserializable
* Fixes in deserialization of updates with giveaways
* `BehaviourBuilder`:
* Extension `buildBehaviourWithLongPolling` will not report absence of `/privacy` handling
* `WebApp`:
* `MainButton` has been deprecated in favor to `BottomButton`. Their functionality is equal
## 18.1.0
* `BehaviourBuilder`:
* Add `createSubContextAndDoSynchronouslyWithUpdatesFilter` as old logic of `createSubContextAndDoWithUpdatesFilter`
* `createSubContextAndDoWithUpdatesFilter` has been renamed to `createSubContextAndDoAsynchronouslyWithUpdatesFilter`
## 18.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
This update contains solution for [issue #888](https://github.com/InsanusMokrassar/ktgbotapi/issues/888), made by
[@Nik-mmzd](https://github.com/Nik-mmzd)
---
**Migration (step-by-step)**
Replace in a whole project:
1. `RestrictedChatMember` -> `RestrictedMemberChatMember`
2. `BannedChatMember` -> `RestrictedChatMember`
---
**Changes:**
* `Version`:
* `Kotlin`: `2.0.10` -> `2.0.20`
* `Serialization`: `1.7.1` -> `1.7.2`
* `MicroUtils`: `0.22.0` -> `0.22.2`
* `KSLog`: `1.3.5` -> `1.3.6`
* `Ktor`: `2.3.11` -> `2.3.12`
* `Core`:
* `RestrictedChatMember` has been renamed to `RestrictedMemberChatMember`
* `BannedChatMember` has been renamed to `RestrictedChatMember`
* `KickedChatMember` now implements `RestrictedChatMember` (due to rename)
* All `ChatMember`s now use `PreviewUser`s instead of `User`s
* `Utils`:
* Add a lot of extensions like `ChatMember.isMember`
* Add a lot of extensions like `ChatMemberUpdated.joinedChat`
## 17.0.0
**THIS UPDATE CONTAINS SUPPORT OF BOTS API 7.9**

View File

@@ -1,4 +1,4 @@
# TelegramBotAPI [![Maven Central](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi/badge.svg)](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-7.9-blue)](https://core.telegram.org/bots/api-changelog#august-14-2024)
# TelegramBotAPI [![Maven Central Version](https://img.shields.io/maven-central/v/dev.inmo/tgbotapi)](https://central.sonatype.com/artifact/dev.inmo/tgbotapi) [![Supported version](https://img.shields.io/badge/Telegram%20Bot%20API-9.2-blue)](https://core.telegram.org/bots/api-changelog#august-15-2025)
| Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
@@ -120,3 +120,20 @@ suspend fun main() {
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
[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

View File

@@ -1,8 +1,8 @@
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven { url "https://plugins.gradle.org/m2/" }
mavenLocal()
}
dependencies {
@@ -18,15 +18,30 @@ plugins {
alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.versions)
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
allprojects {
repositories {
mavenLocal()
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
mavenCentral()
google()
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
mavenLocal()
}
if (it != rootProject.findProject("docs")) {
tasks.whenTaskAdded { task ->
@@ -48,12 +63,20 @@ private String getCurrentVersionChangelog() {
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"
def githubReleaseToken = project.hasProperty(githubTokenVariableName) ? project.property(githubTokenVariableName).toString() : githubTokenVariableFromEnv
githubRelease {
token "${project.property('GITHUB_RELEASE_TOKEN')}"
token githubReleaseToken
owner = "InsanusMokrassar"
repo = "TelegramBotAPI"

View File

@@ -6,7 +6,7 @@ plugins {
project.description = "Full collection of all built-in tgbotapi tools"
apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$mppProjectWithSerialization"
kotlin {
sourceSets {
@@ -55,7 +55,7 @@ Object callback = {
sourceLink {
localDirectory.set(file("../"))
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/ktgbotapi/tree/master"))
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/ktgbotapi"))
remoteLineSuffix.set("#L")
}
}

View File

@@ -1,8 +1,27 @@
allprojects {
ext {
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle"
File templatesFolder = new File("$rootProject.projectDir.absolutePath${File.separatorChar}gradle${File.separatorChar}templates")
publishGradlePath = "${rootProject.projectDir.absolutePath}/publish.gradle"
Map properties = new HashMap<String, String>()
if (templatesFolder.exists() && templatesFolder.isDirectory()) {
templatesFolder.listFiles().each {
properties[it.name - ".gradle"] = it.absolutePath
}
}
allprojects {
ext {
properties.forEach { k, v ->
it[k] = v
}
}
}
tasks.register("getPublishableModules") {
doLast {
rootProject.subprojects.each { project ->
if (project.plugins.hasPlugin('maven-publish')) {
println(":${project.name}")
}
}
}
}

View File

@@ -5,5 +5,8 @@ kotlin.js.generate.externals=true
kotlin.incremental=true
kotlin.incremental.js=true
# https://github.com/google/ksp/issues/2491
ksp.useKSP2=false
library_group=dev.inmo
library_version=17.0.0
library_version=30.0.1

View File

@@ -1,27 +1,28 @@
[versions]
kotlin = "2.0.10"
kotlin-serialization = "1.7.1"
kotlin-coroutines = "1.8.1"
kotlin = "2.2.20"
kotlin-serialization = "1.9.0"
kotlin-coroutines = "1.10.2"
javax-activation = "1.1.1"
korlibs = "5.4.0"
uuid = "0.8.4"
ktor = "2.3.11"
ktor = "3.3.1"
ksp = "2.0.10-1.0.24"
kotlin-poet = "1.18.1"
ksp = "2.2.20-2.0.4"
kotlin-poet = "2.2.0"
microutils = "0.22.0"
kslog = "1.3.5"
microutils = "0.26.6"
kslog = "1.5.1"
versions = "0.51.0"
versions = "0.53.0"
github-release-plugin = "2.5.2"
dokka = "1.9.20"
dokka = "2.0.0"
validator = "0.16.3"
validator = "0.18.1"
nmcp = "1.2.0"
[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-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-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
@@ -57,6 +60,11 @@ microutils-serialization-mapper = { module = "dev.inmo:micro_utils.serialization
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" }
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
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-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" }
@@ -81,3 +89,4 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "validator" }
nmcp-aggregation = { id = "com.gradleup.nmcp.aggregation", version.ref = "nmcp" }

View File

@@ -1,9 +1,12 @@
project.version = "$version"
project.group = "$group"
apply from: "$publishGradlePath"
apply from: "$mpp_publish"
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xcontext-parameters")
}
js (IR) {
browser()
nodejs()

View File

@@ -2,6 +2,9 @@ project.version = "$library_version"
project.group = "$library_group"
kotlin {
compilerOptions {
freeCompilerArgs.add("-Xcontext-parameters")
}
jvm {
compilations.main {
kotlinOptions {

View File

@@ -0,0 +1,111 @@
apply plugin: 'maven-publish'
task javadocsJar(type: Jar) {
archiveClassifier = 'javadoc'
}
publishing {
publications.all {
artifact javadocsJar
pom {
description = "${project.description}"
name = "${project.name}"
url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI"
scm {
developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git"
url = "https://github.com/insanusmokrassar/TelegramBotAPI.git"
}
developers {
developer {
id = "InsanusMokrassar"
name = "Ovsiannikov Aleksei"
email = "ovsyannikov.alexey95@gmail.com"
}
}
licenses {
license {
name = "Apache Software License 2.0"
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)) {
maven {
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')
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 {
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')
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 {
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')
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
}
}
}
}
}
if (project.hasProperty("signing.gnupg.keyName")) {
apply plugin: 'signing'
signing {
useGpgCmd()
sign publishing.publications
}
task signAll {
tasks.withType(Sign).forEach {
dependsOn(it)
}
}
// Workaround to make android sign operations depend on signing tasks
project.getTasks().withType(AbstractPublishToMaven.class).configureEach {
def signingTasks = project.getTasks().withType(Sign.class)
mustRunAfter(signingTasks)
}
// Workaround to make test tasks use sign
project.getTasks().withType(Sign.class).configureEach { signTask ->
def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name)
def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign
// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets
// Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def debugTestTask = tasks.findByName("linkDebugTest$pubName")
if (debugTestTask != null) {
signTask.mustRunAfter(debugTestTask)
}
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def testTask = tasks.findByName("compileTestKotlin$pubName")
if (testTask != null) {
signTask.mustRunAfter(testTask)
}
}
}

View File

@@ -1 +1 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/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}}

View File

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

View File

@@ -1,118 +0,0 @@
apply plugin: 'maven-publish'
task javadocsJar(type: Jar) {
archiveClassifier = 'javadoc'
}
publishing {
publications.all {
artifact javadocsJar
pom {
description = "${project.description}"
name = "${project.name}"
url = "https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI"
scm {
developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/TelegramBotAPI.git[push=]https://github.com/insanusmokrassar/TelegramBotAPI.git"
url = "https://github.com/insanusmokrassar/TelegramBotAPI.git"
}
developers {
developer {
id = "InsanusMokrassar"
name = "Ovsiannikov Aleksei"
email = "ovsyannikov.alexey95@gmail.com"
}
}
licenses {
license {
name = "Apache Software License 2.0"
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)) {
maven {
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')
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 {
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')
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 {
name = "sonatype"
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
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')
}
}
}
}
}
}
if (project.hasProperty("signing.gnupg.keyName")) {
apply plugin: 'signing'
signing {
useGpgCmd()
sign publishing.publications
}
task signAll {
tasks.withType(Sign).forEach {
dependsOn(it)
}
}
// Workaround to make android sign operations depend on signing tasks
project.getTasks().withType(AbstractPublishToMaven.class).configureEach {
def signingTasks = project.getTasks().withType(Sign.class)
mustRunAfter(signingTasks)
}
// Workaround to make test tasks use sign
project.getTasks().withType(Sign.class).configureEach { signTask ->
def withoutSign = (signTask.name.startsWith("sign") ? signTask.name.minus("sign") : signTask.name)
def pubName = withoutSign.endsWith("Publication") ? withoutSign.substring(0, withoutSign.length() - "Publication".length()) : withoutSign
// These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets
// Task ':linkDebugTest<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def debugTestTask = tasks.findByName("linkDebugTest$pubName")
if (debugTestTask != null) {
signTask.mustRunAfter(debugTestTask)
}
// Task ':compileTestKotlin<platform>' uses this output of task ':sign<platform>Publication' without declaring an explicit or implicit dependency
def testTask = tasks.findByName("compileTestKotlin$pubName")
if (testTask != null) {
signTask.mustRunAfter(testTask)
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -2,18 +2,20 @@ plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.kotlin.plugin.serialization"
id "org.jetbrains.dokka"
id "com.google.devtools.ksp"
}
project.description = "API extensions with \"Telegram Bot API\"-like extensions for TelegramBot and RequestsExecutor"
apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
apply from: "$mppProjectWithSerialization"
apply from: "$mpp_publish"
kotlin {
sourceSets {
commonMain {
dependencies {
api project(":tgbotapi.core")
api libs.microutils.ksp.variations
}
}
configureEach {
@@ -22,3 +24,8 @@ kotlin {
}
explicitApi()
}
dependencies {
add("kspCommonMainMetadata", libs.microutils.ksp.variations.generator)
}

View File

@@ -12,10 +12,11 @@ import io.ktor.client.engine.*
* @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO]
* @param ktorClientConfig Config block for preconfiguring of bot [HttpClient]
*/
@ConsistentCopyVisibility
public data class BotBuilder internal constructor(
var proxy: ProxyConfig? = null,
var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null,
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null,
) {
internal fun createHttpClient(): HttpClient = ktorClientEngineFactory ?.let {
HttpClient(
@@ -41,8 +42,14 @@ public fun buildBot(
token: String,
apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false,
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
block: BotBuilder.() -> Unit
): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
BotBuilder().apply(block).createHttpClient()
urlsKeeper = TelegramAPIUrlsKeeper(
token = token,
testServer = testServer,
hostUrl = apiUrl,
fileLinkUrlMapper = fileLinkUrlMapper
),
client = BotBuilder().apply(block).createHttpClient()
)

View File

@@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.ktor.telegramBot
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper
import dev.inmo.tgbotapi.utils.defaultKtorEngine
import dev.inmo.tgbotapi.utils.telegramBotAPIDefaultUrl
import io.ktor.client.HttpClient
import io.ktor.client.HttpClientConfig
@@ -13,7 +14,7 @@ import io.ktor.client.engine.*
*/
public fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient = HttpClient()
client: HttpClient = HttpClient(defaultKtorEngine)
): TelegramBot = telegramBot(urlsKeeper) {
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]
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun telegramBot(
public fun telegramBot(
token: String,
apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false,
client: HttpClient = HttpClient()
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client)
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
client: HttpClient = HttpClient(defaultKtorEngine)
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper), client)
@Suppress("NOTHING_TO_INLINE")
public inline fun <T: HttpClientEngineConfig> telegramBot(
public fun <T: HttpClientEngineConfig> telegramBot(
token: String,
clientFactory: HttpClientEngineFactory<T>,
apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false,
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
clientConfig: HttpClientConfig<T>.() -> Unit = {}
): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
clientFactory,
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
* configure [HttpClient] using [clientConfig]
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun telegramBot(
public fun telegramBot(
token: String,
clientEngine: HttpClientEngine,
apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false,
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
clientConfig: HttpClientConfig<*>.() -> Unit = {}
): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
clientEngine,
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
* [clientConfig]
*/
@Suppress("NOTHING_TO_INLINE")
public inline fun telegramBot(
public fun telegramBot(
token: String,
apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false,
noinline clientConfig: HttpClientConfig<*>.() -> Unit
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
clientConfig: HttpClientConfig<*>.() -> Unit
): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
clientConfig
)

View File

@@ -3,5 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.local.Close
@Suppress("unused")
public suspend inline fun TelegramBot.close(): Boolean = execute(Close)
public suspend inline fun TelegramBot.executeClose(): Boolean = execute(Close)

View File

@@ -3,11 +3,14 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.ForwardMessage
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.DirectMessageThreadId
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
import dev.inmo.tgbotapi.types.directMessageThreadId
import dev.inmo.tgbotapi.types.threadId
public suspend fun TelegramBot.forwardMessage(
@@ -15,10 +18,12 @@ public suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier,
messageId: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false
): PossiblyForwardedMessage = execute(
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
ForwardMessage(fromChatId, toChatId, messageId, threadId, directMessageThreadId, startTimestamp, disableNotification, protectContent)
)
public suspend fun TelegramBot.forwardMessage(
@@ -26,40 +31,50 @@ public suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier,
messageId: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, directMessageThreadId, startTimestamp, disableNotification, protectContent)
public suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier,
toChat: Chat,
messageId: MessageId,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false
): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, directMessageThreadId, startTimestamp, disableNotification, protectContent)
public suspend fun TelegramBot.forwardMessage(
fromChat: Chat,
toChat: Chat,
messageId: MessageId,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, directMessageThreadId, startTimestamp, disableNotification, protectContent)
public suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier,
message: AccessibleMessage,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false
): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, directMessageThreadId, startTimestamp, disableNotification, protectContent)
public suspend fun TelegramBot.forwardMessage(
toChat: Chat,
message: AccessibleMessage,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false
): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent)
): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, directMessageThreadId, startTimestamp, disableNotification, protectContent)

View File

@@ -13,6 +13,7 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId: ChatIdentifier,
messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -23,6 +24,7 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId = fromChatId,
messageIds = it,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -35,6 +37,7 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId: ChatIdentifier,
messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -43,6 +46,7 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId = fromChatId,
messageIds = messageIds.toList(),
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -52,6 +56,7 @@ public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -61,6 +66,7 @@ public suspend fun TelegramBot.forwardMessages(
fromChatId = chatId,
messageIds = messages.map { it.messageId },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -72,6 +78,7 @@ public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -79,6 +86,7 @@ public suspend fun TelegramBot.forwardMessages(
toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -89,6 +97,7 @@ public suspend fun TelegramBot.forward(
fromChatId: ChatIdentifier,
messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -97,6 +106,7 @@ public suspend fun TelegramBot.forward(
fromChatId = fromChatId,
messageIds = messageIds,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -107,6 +117,7 @@ public suspend fun TelegramBot.forward(
fromChatId: ChatIdentifier,
messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -115,6 +126,7 @@ public suspend fun TelegramBot.forward(
fromChatId = fromChatId,
messageIds = messageIds,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -124,6 +136,7 @@ public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -131,6 +144,7 @@ public suspend fun TelegramBot.forward(
toChatId = toChatId,
messagesMetas = messagesMetas,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -141,6 +155,7 @@ public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -148,6 +163,7 @@ public suspend fun TelegramBot.forward(
toChatId = toChatId,
messages = messages,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption

View File

@@ -17,6 +17,7 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
for (update in this) {
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {
if (it.content is MediaGroupPartContent) {
@Suppress("UNCHECKED_CAST")
it as PossiblySentViaBotCommonMessage<MediaGroupPartContent>
} else {
null
@@ -48,10 +49,4 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
return resultUpdates
}
/**
* @return [EditMessageMediaGroupUpdate] in case if [this] is [EditMessageUpdate]. When [this] object is
* [EditChannelPostUpdate] instance - will return [EditChannelPostMediaGroupUpdate]
*
* @throws IllegalStateException
*/
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate() = this
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate(): BaseEditMessageUpdate = this

View File

@@ -1,7 +1,6 @@
package dev.inmo.tgbotapi.extensions.api
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.HorizontallyAccured
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.location.LiveLocation
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.content.LiveLocationContent
import dev.inmo.tgbotapi.types.message.content.LocationContent
import dev.inmo.tgbotapi.utils.launchWithBotLogger
import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.delay
@@ -50,10 +51,13 @@ public suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<EditLiveLocationInfo>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) {
@@ -62,7 +66,7 @@ public suspend fun TelegramBot.handleLiveLocation(
null
} else {
val scope = currentCoroutineContext().LinkedSupervisorScope()
scope.launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
scope.launchWithBotLogger(start = CoroutineStart.LAZY) {
while (scope.isActive) {
delay(liveTimeMillis)
// Remove previous location message info to resend live location message
@@ -75,24 +79,27 @@ public suspend fun TelegramBot.handleLiveLocation(
if (capturedLiveLocationMessage == null) {
updateMessageJob ?.start()
currentLiveLocationMessage = send(
chatId,
it.latitude,
it.longitude,
if (liveTimeMillis == indefiniteLivePeriodDelayMillis) {
chatId = chatId,
latitude = it.latitude,
longitude = it.longitude,
livePeriod = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) {
LiveLocation.INDEFINITE_LIVE_PERIOD
} else {
ceil(liveTimeMillis.toDouble() / 1000).toInt()
},
it.horizontalAccuracy,
it.heading,
it.proximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
it.replyMarkup
horizontalAccuracy = it.horizontalAccuracy,
heading = it.heading,
proximityAlertRadius = it.proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = it.replyMarkup
).also {
sentMessageFlow ?.emit(it)
}
@@ -123,10 +130,13 @@ public suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<Location>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) {
@@ -144,10 +154,13 @@ public suspend fun TelegramBot.handleLiveLocation(
},
liveTimeMillis = liveTimeMillis,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
)
@@ -164,10 +177,13 @@ public suspend fun TelegramBot.handleLiveLocation(
locationsFlow: Flow<Pair<Double, Double>>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) {
@@ -181,10 +197,13 @@ public suspend fun TelegramBot.handleLiveLocation(
},
liveTimeMillis = liveTimeMillis,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api
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.KeyboardMarkup
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.StaticLocation
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.LocationContent
import dev.inmo.tgbotapi.utils.extensions.directMessageThreadIdOrNull
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
import io.ktor.utils.io.core.Closeable
import korlibs.time.millisecondsLong
@@ -96,30 +100,36 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider {
val liveTimeAsDouble = liveTimeMillis.toDouble()
val locationMessage = execute(
SendLiveLocation(
chatId,
latitude,
longitude,
ceil(liveTimeAsDouble / 1000).toInt(),
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
latitude = latitude,
longitude = longitude,
livePeriod = ceil(liveTimeAsDouble / 1000).toInt(),
horizontalAccuracy = initHorizontalAccuracy,
heading = initHeading,
proximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -145,28 +155,34 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
chat.id,
latitude,
longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
scope = scope,
chatId = chat.id,
latitude = latitude,
longitude = longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -182,28 +198,34 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
chatId,
location.latitude,
location.longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
scope = scope,
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -219,28 +241,34 @@ public suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
chat.id,
location.latitude,
location.longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
scope = scope,
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -257,28 +285,34 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull,
directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
to.chat,
latitude,
longitude,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
scope = scope,
chat = to.chat,
latitude = latitude,
longitude = longitude,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)
/**
@@ -294,25 +328,31 @@ public suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull,
directMessageThreadId: DirectMessageThreadId? = to.directMessageThreadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation(
scope,
to.chat,
location,
liveTimeMillis,
initHorizontalAccuracy,
initHeading,
initProximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup
scope = scope,
chat = to.chat,
location = location,
liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy = initHorizontalAccuracy,
initHeading = initHeading,
initProximityAlertRadius = initProximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
)

View File

@@ -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)

View File

@@ -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
): Boolean = execute(
ConvertGiftToStars(businessConnectionId, ownedGiftId)
)
public suspend fun TelegramBot.convertGiftToStars(
businessConnectionId: BusinessConnectionId,
gift: Gift.Regular
): Boolean = convertGiftToStars(
businessConnectionId = businessConnectionId,
ownedGiftId = with(gift) {id}
)

View File

@@ -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>
): Boolean = execute(
DeleteBusinessMessages(businessConnectionId, messageIds)
)

View File

@@ -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>): Boolean = deleteBusinessMessages(
businessConnectionId = businessConnectionId, messageIds = with(messages) {messages.map {
it.messageId }}
)

View File

@@ -0,0 +1,94 @@
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.GiftSentOrReceived
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,
excludeLimited: Boolean = false,
excludeUnique: Boolean = false,
sortByPrice: Boolean = false,
offset: String? = null,
limit: Int? = null
): OwnedGifts<GiftSentOrReceived.ReceivedInBusinessAccount> = execute(
GetBusinessAccountGifts(
businessConnectionId,
excludeUnsaved,
excludeSaved,
excludeUnlimited,
excludeLimited,
excludeUnique,
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 excludeLimited Whether to exclude limited gifts
* @param excludeUnique Whether to exclude unique gifts
* @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,
excludeLimited: Boolean = false,
excludeUnique: Boolean = false,
sortByPrice: Boolean = false,
initialOffset: String? = null,
limit: Int? = null,
onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false }
): Flow<OwnedGifts<GiftSentOrReceived.ReceivedInBusinessAccount>> = flow {
var currentOffset = initialOffset
do {
val response = runCatching {
getBusinessAccountGifts(
businessConnectionId,
excludeUnsaved,
excludeSaved,
excludeUnlimited,
excludeLimited,
excludeUnique,
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)
}

View File

@@ -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)
)

View File

@@ -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
): Boolean = execute(
ReadBusinessMessage(businessConnectionId, chatId, messageId)
)
public suspend fun TelegramBot.readBusinessMessage(
businessConnectionId: BusinessConnectionId,
message: AccessibleMessage
): Boolean = readBusinessMessage(businessConnectionId, message.chat.id.toChatId(), message.messageId)

View File

@@ -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,
): Boolean = readBusinessMessage(
businessConnectionId = businessConnectionId, chatId = with(chat) {chat.id.toChatId()}, messageId
= messageId
)

View File

@@ -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
): Boolean = execute(
RemoveBusinessAccountProfilePhoto(businessConnectionId = businessConnectionId, isPublic = isPublic)
)

View File

@@ -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
): Boolean = execute(
SetBusinessAccountBio(businessConnectionId, bio)
)

View File

@@ -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
): Boolean = 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
): Boolean = setBusinessAccountGiftSettings(
businessConnectionId = message.businessConnectionId,
showGiftButton = showGiftButton,
acceptedGiftTypes = acceptedGiftTypes
)

View File

@@ -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
): Boolean = execute(
SetBusinessAccountName(businessConnectionId, firstName, lastName)
)

View File

@@ -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
): Boolean = execute(
SetBusinessAccountProfilePhoto(businessConnectionId, photo, isPublic)
)

View File

@@ -0,0 +1,17 @@
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
@GenerateVariations
public suspend fun TelegramBot.setBusinessAccountUsername(
businessConnectionId: BusinessConnectionId,
@GenerationVariant(String::class, "Username(username)", "username")
username: Username
): Boolean = execute(
SetBusinessAccountUsername(businessConnectionId, username)
)

View File

@@ -0,0 +1,16 @@
// 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): Boolean = setBusinessAccountUsername(
businessConnectionId = businessConnectionId, username = with(username) { Username.prepare(username) }
)

View File

@@ -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
): Boolean = execute(
TransferBusinessAccountStars(businessConnectionId, amount)
)

View File

@@ -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,
): Boolean = 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,
): Boolean = transferGift(
businessConnectionId = businessConnectionId,
ownedGiftId = gift.id,
newOwnerChatId = newOwnerChatId,
transferPaymentStarCount = transferPaymentStarCount
)

View File

@@ -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
): Boolean = execute(
UpgradeGift(
businessConnectionId = businessConnectionId,
ownedGiftId = ownedGiftId,
keepOriginalDetails = keepOriginalDetails,
starCount = starCount
)
)
public suspend fun TelegramBot.convertGiftToStars(
businessConnectionId: BusinessConnectionId,
gift: Gift.Regular,
keepOriginalDetails: Boolean = false,
): Boolean = execute(
UpgradeGift(
businessConnectionId = businessConnectionId,
ownedGiftId = gift.id,
keepOriginalDetails = keepOriginalDetails,
starCount = gift.upgradeStarCount
)
)

View File

@@ -2,7 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.chat.members
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.members.PromoteChannelAdministrator
import dev.inmo.tgbotapi.requests.chat.members.PromoteChatMember
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.TelegramDate
@@ -26,7 +25,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
): Boolean = execute(
PromoteChannelAdministrator(
chatId = chatId,
@@ -44,7 +44,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)
)
@@ -64,7 +65,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
): Boolean = promoteChannelAdministrator(
chat.id,
userId,
@@ -81,7 +83,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)
public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -100,7 +103,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
): Boolean = promoteChannelAdministrator(
chatId,
user.id,
@@ -117,7 +121,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)
public suspend fun TelegramBot.promoteChannelAdministrator(
@@ -136,7 +141,8 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null,
): Boolean = promoteChannelAdministrator(
chat.id,
user.id,
@@ -153,5 +159,6 @@ public suspend fun TelegramBot.promoteChannelAdministrator(
canManageChat = canManageChat,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)

View File

@@ -26,7 +26,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null
): Boolean = execute(
PromoteChatMember(
chatId = chatId,
@@ -46,7 +47,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)
)
@@ -69,7 +71,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null
): Boolean = promoteChatMember(
chat.id,
userId,
@@ -88,7 +91,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)
@Warning("This method is too common. Use it with caution")
@@ -110,7 +114,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null
): Boolean = promoteChatMember(
chatId,
user.id,
@@ -129,7 +134,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)
@Warning("This method is too common. Use it with caution")
@@ -151,7 +157,8 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics: Boolean? = null,
canPostStories: Boolean? = null,
canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null
canDeleteStories: Boolean? = null,
canManageDirectMessages: Boolean? = null
): Boolean = promoteChatMember(
chat.id,
user.id,
@@ -170,5 +177,6 @@ public suspend fun TelegramBot.promoteChatMember(
canManageTopics = canManageTopics,
canPostStories = canPostStories,
canEditStories = canEditStories,
canDeleteStories = canDeleteStories
canDeleteStories = canDeleteStories,
canManageDirectMessages = canManageDirectMessages,
)

View File

@@ -4,6 +4,7 @@ import dev.inmo.tgbotapi.abstracts.TextedWithTextSources
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.caption.editMessageCaption
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.media.addMessageMedia
import dev.inmo.tgbotapi.extensions.api.edit.media.editMessageMedia
import dev.inmo.tgbotapi.extensions.api.edit.reply_markup.editMessageReplyMarkup
import dev.inmo.tgbotapi.extensions.api.edit.text.editMessageText
@@ -173,6 +174,17 @@ public suspend fun TelegramBot.edit(
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message, media, businessConnectionId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.addMedia(
message: ContentMessage<TextContent>,
media: TelegramFreeMedia,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = addMessageMedia(message, media, businessConnectionId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that

View File

@@ -0,0 +1,47 @@
package dev.inmo.tgbotapi.extensions.api.edit.checklist
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.checklist.EditMessageChecklist
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.businessConnectionIdField
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.checklistField
import dev.inmo.tgbotapi.types.checklists.Checklist
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.ChecklistContent
import dev.inmo.tgbotapi.types.messageIdField
import dev.inmo.tgbotapi.types.replyMarkupField
import kotlinx.serialization.SerialName
public suspend fun TelegramBot.editMessageChecklist(
chatId: ChatIdentifier,
messageId: MessageId,
businessConnectionId: BusinessConnectionId,
checklist: Checklist.Input,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<ChecklistContent> = execute(
EditMessageChecklist(
chatId = chatId,
messageId = messageId,
businessConnectionId = businessConnectionId,
checklist = checklist,
replyMarkup = replyMarkup
)
)
public suspend fun TelegramBot.editMessageChecklist(
message: BusinessContentMessage<ChecklistContent>,
checklist: Checklist.Input,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<ChecklistContent> = execute(
EditMessageChecklist(
chatId = message.chat.id,
messageId = message.messageId,
businessConnectionId = message.businessConnectionId,
checklist = checklist,
replyMarkup = replyMarkup
)
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.edit.media
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -11,6 +13,8 @@ import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MediaContent
import dev.inmo.tgbotapi.types.message.content.TextContent
import kotlin.jvm.JvmName
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -43,7 +47,18 @@ public suspend fun TelegramBot.editMessageMedia(
* as a builder for that
*/
public suspend fun TelegramBot.editMessageMedia(
message: ContentMessage<out MediaContent>,
message: ContentMessage<MediaContent>,
media: TelegramFreeMedia,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> = editMessageMedia(message.chat.id, message.messageId, media, businessConnectionId, replyMarkup)
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that
*/
public suspend fun TelegramBot.addMessageMedia(
message: ContentMessage<TextContent>,
media: TelegramFreeMedia,
businessConnectionId: BusinessConnectionId? = message.chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null

View File

@@ -0,0 +1,65 @@
package dev.inmo.tgbotapi.extensions.api.edit.payments
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.edit.payments.EditUserStarSubscription
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.payments.abstracts.TelegramPaymentChargeId
public suspend fun TelegramBot.editUserStarSubscription(
userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId,
isCanceled: Boolean
): Boolean = execute(
EditUserStarSubscription(
userId = userId,
telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = isCanceled
)
)
public suspend fun TelegramBot.editUserStarSubscription(
user: User,
telegramPaymentChargeId: TelegramPaymentChargeId,
isCanceled: Boolean
): Boolean = editUserStarSubscription(
userId = user.id,
telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = isCanceled
)
public suspend fun TelegramBot.cancelUserStarSubscription(
userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId,
): Boolean = editUserStarSubscription(
userId = userId,
telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = true
)
public suspend fun TelegramBot.cancelUserStarSubscription(
user: User,
telegramPaymentChargeId: TelegramPaymentChargeId,
): Boolean = editUserStarSubscription(
user = user,
telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = true
)
public suspend fun TelegramBot.enableUserStarSubscription(
userId: UserId,
telegramPaymentChargeId: TelegramPaymentChargeId,
): Boolean = editUserStarSubscription(
userId = userId,
telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = false
)
public suspend fun TelegramBot.enableUserStarSubscription(
user: User,
telegramPaymentChargeId: TelegramPaymentChargeId,
): Boolean = editUserStarSubscription(
user = user,
telegramPaymentChargeId = telegramPaymentChargeId,
isCanceled = false
)

View File

@@ -0,0 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.gifts
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.gifts.GetAvailableGifts
import dev.inmo.tgbotapi.types.gifts.Gifts
public suspend fun TelegramBot.getAvailableGifts(): Gifts = execute(GetAvailableGifts)

View File

@@ -0,0 +1,55 @@
package dev.inmo.tgbotapi.extensions.api.gifts
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.gifts.GiftPremiumSubscription
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
import dev.inmo.tgbotapi.utils.buildEntities
public suspend fun TelegramBot.giftPremiumSubscription(
userId: UserId,
monthCount: Int,
starCount: Int,
text: String,
parseMode: ParseMode? = null
): Boolean = execute(
GiftPremiumSubscription(
userId = userId,
monthCount = monthCount,
starCount = starCount,
text = text,
parseMode = parseMode
)
)
public suspend fun TelegramBot.giftPremiumSubscription(
userId: UserId,
monthCount: Int,
starCount: Int,
textSources: TextSourcesList? = null,
): Boolean = execute(
GiftPremiumSubscription(
userId = userId,
monthCount = monthCount,
starCount = starCount,
textSources = textSources
)
)
public suspend fun TelegramBot.giftPremiumSubscription(
userId: UserId,
monthCount: Int,
starCount: Int,
separator: TextSource? = null,
textBuilder: EntitiesBuilderBody
): Boolean = execute(
GiftPremiumSubscription(
userId = userId,
monthCount = monthCount,
starCount = starCount,
textSources = buildEntities(separator, textBuilder),
)
)

View File

@@ -0,0 +1,118 @@
package dev.inmo.tgbotapi.extensions.api.gifts
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.gifts.SendGift
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.GiftId
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.gifts.Gift
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
@GenerateVariations
public suspend fun TelegramBot.sendGift(
@GenerationVariant(
User::class,
"id",
"user"
)
userId: UserId,
@GenerationVariant(
Gift.Regular::class,
"id",
"gift"
)
giftId: GiftId,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean = false
): Boolean = execute(
SendGift.toUser(
userId = userId,
giftId = giftId,
text = text,
parseMode = parseMode,
upgradableToUnique = upgradableToUnique
)
)
@GenerateVariations
public suspend fun TelegramBot.sendGiftToChat(
@GenerationVariant(
PublicChat::class,
"id",
"chat"
)
chatId: ChatIdentifier,
@GenerationVariant(
Gift.Regular::class,
"id",
"gift"
)
giftId: GiftId,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean = false
): Boolean = execute(
SendGift.toChat(
chatId = chatId,
giftId = giftId,
text = text,
parseMode = parseMode,
upgradableToUnique = upgradableToUnique
)
)
@GenerateVariations
public suspend fun TelegramBot.sendGift(
@GenerationVariant(
User::class,
"id",
"user"
)
userId: UserId,
@GenerationVariant(
Gift.Regular::class,
"id",
"gift"
)
giftId: GiftId,
textSources: TextSourcesList,
upgradableToUnique: Boolean = false,
): Boolean = execute(
SendGift.toUser(
userId = userId,
giftId = giftId,
textSources = textSources,
upgradableToUnique = upgradableToUnique
)
)
@GenerateVariations
public suspend fun TelegramBot.sendGiftToChat(
@GenerationVariant(
PublicChat::class,
"id",
"chat"
)
chatId: ChatIdentifier,
@GenerationVariant(
Gift.Regular::class,
"id",
"gift"
)
giftId: GiftId,
textSources: TextSourcesList,
upgradableToUnique: Boolean = false,
): Boolean = execute(
SendGift.toChat(
chatId = chatId,
giftId = giftId,
textSources = textSources,
upgradableToUnique = upgradableToUnique
)
)

View File

@@ -0,0 +1,73 @@
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY
// TO REGENERATE IT JUST DELETE FILE
// ORIGINAL FILE: SendGift.kt
package dev.inmo.tgbotapi.extensions.api.gifts
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.types.GiftId
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.gifts.Gift
import dev.inmo.tgbotapi.types.message.ParseMode
import kotlin.Boolean
import kotlin.String
public suspend fun TelegramBot.sendGift(
user: User,
giftId: GiftId,
text: String,
parseMode: ParseMode?,
): Boolean = sendGift(
userId = with(user) {id}, giftId = giftId, text = text, parseMode = parseMode
)
public suspend fun TelegramBot.sendGift(
user: User,
giftId: GiftId,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean,
): Boolean = sendGift(
userId = with(user) {id}, giftId = giftId, text = text, parseMode = parseMode,
upgradableToUnique = upgradableToUnique
)
public suspend fun TelegramBot.sendGift(
userId: UserId,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
): Boolean = sendGift(
userId = userId, giftId = with(gift) {id}, text = text, parseMode = parseMode
)
public suspend fun TelegramBot.sendGift(
userId: UserId,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean,
): Boolean = sendGift(
userId = userId, giftId = with(gift) {id}, text = text, parseMode = parseMode,
upgradableToUnique = upgradableToUnique
)
public suspend fun TelegramBot.sendGift(
user: User,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
): Boolean = sendGift(
user = user, giftId = with(gift) {id}, text = text, parseMode = parseMode
)
public suspend fun TelegramBot.sendGift(
user: User,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean,
): Boolean = sendGift(
user = user, giftId = with(gift) {id}, text = text, parseMode = parseMode, upgradableToUnique =
upgradableToUnique
)

View File

@@ -0,0 +1,73 @@
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY
// TO REGENERATE IT JUST DELETE FILE
// ORIGINAL FILE: SendGift.kt
package dev.inmo.tgbotapi.extensions.api.gifts
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.GiftId
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.gifts.Gift
import dev.inmo.tgbotapi.types.message.ParseMode
import kotlin.Boolean
import kotlin.String
public suspend fun TelegramBot.sendGiftToChat(
chat: PublicChat,
giftId: GiftId,
text: String,
parseMode: ParseMode?,
): Boolean = sendGiftToChat(
chatId = with(chat) {id}, giftId = giftId, text = text, parseMode = parseMode
)
public suspend fun TelegramBot.sendGiftToChat(
chat: PublicChat,
giftId: GiftId,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean,
): Boolean = sendGiftToChat(
chatId = with(chat) {id}, giftId = giftId, text = text, parseMode = parseMode,
upgradableToUnique = upgradableToUnique
)
public suspend fun TelegramBot.sendGiftToChat(
chatId: ChatIdentifier,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
): Boolean = sendGiftToChat(
chatId = chatId, giftId = with(gift) {id}, text = text, parseMode = parseMode
)
public suspend fun TelegramBot.sendGiftToChat(
chatId: ChatIdentifier,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean,
): Boolean = sendGiftToChat(
chatId = chatId, giftId = with(gift) {id}, text = text, parseMode = parseMode,
upgradableToUnique = upgradableToUnique
)
public suspend fun TelegramBot.sendGiftToChat(
chat: PublicChat,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
): Boolean = sendGiftToChat(
chat = chat, giftId = with(gift) {id}, text = text, parseMode = parseMode
)
public suspend fun TelegramBot.sendGiftToChat(
chat: PublicChat,
gift: Gift.Regular,
text: String,
parseMode: ParseMode?,
upgradableToUnique: Boolean,
): Boolean = sendGiftToChat(
chat = chat, giftId = with(gift) {id}, text = text, parseMode = parseMode, upgradableToUnique =
upgradableToUnique
)

View File

@@ -0,0 +1,45 @@
package dev.inmo.tgbotapi.extensions.api.inline
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.answers.InlineQueryAnswersResultsSerializer
import dev.inmo.tgbotapi.requests.inline.SavePreparedInlineMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.prepared.PreparedInlineMessage
import dev.inmo.tgbotapi.types.chat.User
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
public suspend fun TelegramBot.savePreparedInlineMessage(
userId: UserId,
result: InlineQueryResult,
allowSendToUsers: Boolean = false,
allowSendToBots: Boolean = false,
allowSendToGroups: Boolean = false,
allowSendToChannels: Boolean = false,
): PreparedInlineMessage = execute(
SavePreparedInlineMessage(
userId = userId,
result = result,
allowSendToUsers = allowSendToUsers,
allowSendToBots = allowSendToBots,
allowSendToGroups = allowSendToGroups,
allowSendToChannels = allowSendToChannels
)
)
public suspend fun TelegramBot.savePreparedInlineMessage(
user: User,
result: InlineQueryResult,
allowSendToUsers: Boolean = false,
allowSendToBots: Boolean = false,
allowSendToGroups: Boolean = false,
allowSendToChannels: Boolean = false,
): PreparedInlineMessage = savePreparedInlineMessage(
userId = user.id,
result = result,
allowSendToUsers = allowSendToUsers,
allowSendToBots = allowSendToBots,
allowSendToGroups = allowSendToGroups,
allowSendToChannels = allowSendToChannels
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -5,6 +7,7 @@ import dev.inmo.tgbotapi.requests.send.CopyMessage
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
@@ -21,23 +24,31 @@ public suspend inline fun TelegramBot.copyMessage(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = execute(
CopyMessage(
fromChatId,
messageId,
toChatId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
fromChatId = fromChatId,
messageId = messageId,
toChatId = toChatId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -53,11 +64,31 @@ public suspend inline fun TelegramBot.copyMessage(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(fromChat.id, messageId, toChatId, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChatId = fromChat.id,
messageId = messageId,
toChatId = toChatId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -71,11 +102,31 @@ public suspend inline fun TelegramBot.copyMessage(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(fromChatId, messageId, toChat.id, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChatId = fromChatId,
messageId = messageId,
toChatId = toChat.id,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -89,11 +140,31 @@ public suspend inline fun TelegramBot.copyMessage(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(fromChat.id, messageId, toChat.id, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChatId = fromChat.id,
messageId = messageId,
toChatId = toChat.id,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -107,22 +178,30 @@ public suspend inline fun TelegramBot.copyMessage(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = execute(
CopyMessage(
fromChatId,
messageId,
toChatId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
fromChatId = fromChatId,
messageId = messageId,
toChatId = toChatId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -137,11 +216,30 @@ public suspend inline fun TelegramBot.copyMessage(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(fromChat.id, messageId, toChatId, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChatId = fromChat.id,
messageId = messageId,
toChatId = toChatId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -154,11 +252,30 @@ public suspend inline fun TelegramBot.copyMessage(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(fromChatId, messageId, toChat.id, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChatId = fromChatId,
messageId = messageId,
toChatId = toChat.id,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -171,11 +288,30 @@ public suspend inline fun TelegramBot.copyMessage(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(fromChat.id, messageId, toChat.id, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChatId = fromChat.id,
messageId = messageId,
toChatId = toChat.id,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -188,11 +324,31 @@ public suspend inline fun TelegramBot.copyMessage(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(message.chat, message.messageId, toChatId, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChat = message.chat,
messageId = message.messageId,
toChatId = toChatId,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -205,11 +361,31 @@ public suspend inline fun TelegramBot.copyMessage(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(message.chat, message.messageId, toChat, text, parseMode, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChat = message.chat,
messageId = message.messageId,
toChat = toChat,
text = text,
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -221,11 +397,30 @@ public suspend inline fun TelegramBot.copyMessage(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(message.chat, message.messageId, toChatId, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
): MessageId = copyMessage(
fromChat = message.chat,
messageId = message.messageId,
toChatId = toChatId,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -237,245 +432,27 @@ public suspend inline fun TelegramBot.copyMessage(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = toChat.id.directMessageThreadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(message.chat, message.messageId, toChat, entities, showCaptionAboveMedia, threadId, disableNotification, protectContent, replyParameters, replyMarkup)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = execute(
CopyMessage(
fromChatId,
messageId,
toChatId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
fromChat: Chat,
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(
toChatId,
fromChat.id,
messageId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
fromChatId: ChatIdentifier,
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(
toChat.id,
fromChatId,
messageId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
fromChat: Chat,
messageId: MessageId,
text: String? = null,
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(
toChat.id,
fromChat.id,
messageId,
text,
parseMode,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = execute(
CopyMessage(
fromChatId,
messageId,
toChatId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
)
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChatId: ChatIdentifier,
fromChat: Chat,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(
toChatId,
fromChat.id,
messageId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
fromChatId: ChatIdentifier,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(
toChat.id,
fromChatId,
messageId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/
public suspend inline fun TelegramBot.copyMessage(
toChat: Chat,
fromChat: Chat,
messageId: MessageId,
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = toChat.id.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): MessageId = copyMessage(
toChat.id,
fromChat.id,
messageId,
entities,
showCaptionAboveMedia,
threadId,
disableNotification,
protectContent,
replyParameters,
replyMarkup
fromChat = message.chat,
messageId = message.messageId,
toChat = toChat,
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
startTimestamp = startTimestamp,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -12,6 +12,7 @@ public suspend fun TelegramBot.copyMessages(
fromChatId: ChatIdentifier,
messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -22,6 +23,7 @@ public suspend fun TelegramBot.copyMessages(
fromChatId = fromChatId,
messageIds = it,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -34,6 +36,7 @@ public suspend fun TelegramBot.copyMessages(
fromChatId: ChatIdentifier,
messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -42,6 +45,7 @@ public suspend fun TelegramBot.copyMessages(
fromChatId = fromChatId,
messageIds = messageIds.toList(),
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -51,6 +55,7 @@ public suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -60,6 +65,7 @@ public suspend fun TelegramBot.copyMessages(
fromChatId = chatId,
messageIds = messages.map { it.messageId },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -71,6 +77,7 @@ public suspend fun TelegramBot.copyMessages(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -78,6 +85,7 @@ public suspend fun TelegramBot.copyMessages(
toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -88,6 +96,7 @@ public suspend fun TelegramBot.copy(
fromChatId: ChatIdentifier,
messageIds: List<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -96,6 +105,7 @@ public suspend fun TelegramBot.copy(
fromChatId = fromChatId,
messageIds = messageIds,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -106,6 +116,7 @@ public suspend fun TelegramBot.copy(
fromChatId: ChatIdentifier,
messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -114,6 +125,7 @@ public suspend fun TelegramBot.copy(
fromChatId = fromChatId,
messageIds = messageIds,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -123,6 +135,7 @@ public suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -130,6 +143,7 @@ public suspend fun TelegramBot.copy(
toChatId = toChatId,
messagesMetas = messagesMetas,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
@@ -140,6 +154,7 @@ public suspend fun TelegramBot.copy(
toChatId: ChatIdentifier,
messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId,
directMessageThreadId: DirectMessageThreadId? = toChatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@@ -147,6 +162,7 @@ public suspend fun TelegramBot.copy(
toChatId = toChatId,
messages = messages,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption

View File

@@ -2,32 +2,43 @@ package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.MessageContent
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
/**
* This method will send [content] to the [chatId] as is
*/
@Suppress("UNCHECKED_CAST")
public suspend inline fun <T : MessageContent> TelegramBot.resend(
chatId: ChatIdentifier,
content: T,
messageThreadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
replyMarkup: KeyboardMarkup? = null,
suggestedPostParameters: SuggestedPostParameters? = null
): ContentMessage<T> = execute(
content.createResend(
chatId = chatId,
messageThreadId = messageThreadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
replyMarkup = replyMarkup,
suggestedPostParameters = suggestedPostParameters,
)
) as ContentMessage<T>
@@ -38,8 +49,11 @@ public suspend inline fun <T : MessageContent> TelegramBot.resend(
chat: Chat,
content: T,
messageThreadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
@@ -47,8 +61,11 @@ public suspend inline fun <T : MessageContent> TelegramBot.resend(
chatId = chat.id,
content = content,
messageThreadId = messageThreadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
@@ -63,8 +80,11 @@ public suspend inline fun <T : MessageContent> TelegramBot.resend(
chatId: ChatIdentifier,
message: ContentMessage<T>,
messageThreadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
@@ -72,8 +92,11 @@ public suspend inline fun <T : MessageContent> TelegramBot.resend(
chatId = chatId,
content = message.content,
messageThreadId = messageThreadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
@@ -88,8 +111,11 @@ public suspend inline fun <T : MessageContent> TelegramBot.resend(
chat: Chat,
message: ContentMessage<T>,
messageThreadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
@@ -97,8 +123,11 @@ public suspend inline fun <T : MessageContent> TelegramBot.resend(
chatId = chat.id,
message = message,
messageThreadId = messageThreadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup

View File

@@ -1,9 +1,7 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
import dev.inmo.micro_utils.coroutines.runCatchingSafely
import dev.inmo.micro_utils.coroutines.safelyWithResult
import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions
import dev.inmo.micro_utils.coroutines.runCatchingLogging
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendAction
import dev.inmo.tgbotapi.types.*
@@ -21,6 +19,7 @@ public suspend fun <T> TelegramBot.withAction(
actionRequest: SendAction,
block: TelegramBotActionCallback<T>
): T {
@Suppress("WRONG_INVOCATION_KIND")
contract {
callsInPlace(block, InvocationKind.EXACTLY_ONCE)
}
@@ -33,7 +32,7 @@ public suspend fun <T> TelegramBot.withAction(
delay(refreshTime)
}
}
val result = runCatchingSafely { block() }
val result = runCatchingLogging(logger = Log) { block() }
actionScope.coroutineContext.job.cancel()
return result.getOrThrow()
}

View File

@@ -0,0 +1,56 @@
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.SendChecklist
import dev.inmo.tgbotapi.types.BusinessChatId
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.EffectId
import dev.inmo.tgbotapi.types.ReplyParameters
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.checklists.Checklist
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.ChecklistContent
public suspend fun TelegramBot.sendChecklist(
chatId: ChatIdentifier,
checklist: Checklist.Input,
businessConnectionId: BusinessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = execute(
SendChecklist(
chatId = chatId,
checklist = checklist,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
public suspend fun TelegramBot.sendChecklist(
chatId: BusinessChatId,
checklist: Checklist.Input,
disableNotification: Boolean = false,
protectContent: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ChecklistContent> = execute(
SendChecklist(
chatId = chatId,
checklist = checklist,
businessConnectionId = chatId.businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -6,6 +8,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.ContactContent
@@ -19,15 +22,31 @@ public suspend fun TelegramBot.sendContact(
firstName: String,
lastName: String? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ContactContent> = execute(
SendContact(
chatId, phoneNumber, firstName, lastName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
phoneNumber = phoneNumber,
firstName = firstName,
lastName = lastName,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -39,15 +58,29 @@ public suspend fun TelegramBot.sendContact(
chatId: ChatIdentifier,
contact: Contact,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ContactContent> = execute(
SendContact(
chatId, contact, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
contact = contact,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -61,14 +94,30 @@ public suspend fun TelegramBot.sendContact(
firstName: String,
lastName: String? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ContactContent> = sendContact(
chat.id, phoneNumber, firstName, lastName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chat.id,
phoneNumber = phoneNumber,
firstName = firstName,
lastName = lastName,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -79,12 +128,26 @@ public suspend fun TelegramBot.sendContact(
chat: Chat,
contact: Contact,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<ContactContent> = sendContact(
chat.id, contact, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chat.id,
contact = contact,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.dice.DiceAnimationType
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.DiceContent
@@ -18,14 +19,30 @@ public suspend fun TelegramBot.sendDice(
chatId: ChatIdentifier,
animationType: DiceAnimationType? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<DiceContent> = execute(
SendDice(chatId, animationType, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
SendDice(
chatId = chatId,
animationType = animationType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
@@ -36,10 +53,26 @@ public suspend fun TelegramBot.sendDice(
chat: Chat,
animationType: DiceAnimationType? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<DiceContent> = sendDice(chat.id, animationType, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<DiceContent> = sendDice(
chatId = chat.id,
animationType = animationType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.LiveLocationContent
@@ -24,28 +25,34 @@ public suspend fun TelegramBot.sendLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = execute(
SendLiveLocation(
chatId,
latitude,
longitude,
livePeriod,
horizontalAccuracy,
heading,
proximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -61,27 +68,33 @@ public suspend fun TelegramBot.sendLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = sendLocation(
chatId,
location.latitude,
location.longitude,
livePeriod,
horizontalAccuracy,
heading,
proximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -97,27 +110,33 @@ public suspend fun TelegramBot.sendLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = sendLocation(
chat.id,
latitude,
longitude,
livePeriod,
horizontalAccuracy,
heading,
proximityAlertRadius,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chat.id,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -132,10 +151,13 @@ public suspend fun TelegramBot.sendLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = sendLocation(
@@ -147,10 +169,13 @@ public suspend fun TelegramBot.sendLocation(
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -168,13 +193,34 @@ public suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = sendLocation(chatId, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<LiveLocationContent> = sendLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -188,13 +234,34 @@ public suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = sendLocation(chatId, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<LiveLocationContent> = sendLocation(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -209,13 +276,34 @@ public suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = sendLocation(chat.id, latitude, longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<LiveLocationContent> = sendLocation(
chatId = chat.id,
latitude = latitude,
longitude = longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -229,10 +317,31 @@ public suspend fun TelegramBot.sendLiveLocation(
heading: Degrees? = null,
proximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<LiveLocationContent> = sendLocation(chat.id, location.latitude, location.longitude, livePeriod, horizontalAccuracy, heading, proximityAlertRadius, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<LiveLocationContent> = sendLocation(
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
livePeriod = livePeriod,
horizontalAccuracy = horizontalAccuracy,
heading = heading,
proximityAlertRadius = proximityAlertRadius,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -6,6 +8,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
@@ -24,25 +27,31 @@ public suspend fun TelegramBot.sendMessage(
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = execute(
SendTextMessage(
chatId,
text,
parseMode,
linkPreviewOptions,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -56,14 +65,30 @@ public suspend fun TelegramBot.sendTextMessage(
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = sendMessage(
chatId, text, parseMode, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -76,13 +101,31 @@ public suspend fun TelegramBot.sendTextMessage(
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = sendTextMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendTextMessage(
chatId = chat.id,
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -95,13 +138,31 @@ public suspend fun TelegramBot.sendMessage(
parseMode: ParseMode? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = sendMessage(chat.id, text, parseMode, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendMessage(
chatId = chat.id,
text = text,
parseMode = parseMode,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -112,14 +173,31 @@ public suspend fun TelegramBot.sendMessage(
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = execute(
SendTextMessage(chatId, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
SendTextMessage(
chatId = chatId,
entities = entities,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
@@ -131,14 +209,31 @@ public suspend fun TelegramBot.sendMessage(
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendMessage(
chatId = chatId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -150,14 +245,31 @@ public suspend fun TelegramBot.sendMessage(
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendMessage(
chatId = chatId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -168,14 +280,29 @@ public suspend fun TelegramBot.sendTextMessage(
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = sendMessage(
chatId, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
entities = entities,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -187,14 +314,31 @@ public suspend fun TelegramBot.sendTextMessage(
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendTextMessage(
chatId = chatId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -206,14 +350,31 @@ public suspend fun TelegramBot.sendTextMessage(
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendTextMessage(chatId, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendTextMessage(
chatId = chatId,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -224,13 +385,30 @@ public suspend fun TelegramBot.sendMessage(
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = sendMessage(chat.id, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendMessage(
chatId = chat.id,
entities = entities,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -241,14 +419,31 @@ public suspend fun TelegramBot.sendMessage(
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendMessage(
chat = chat,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -260,14 +455,31 @@ public suspend fun TelegramBot.sendMessage(
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendMessage(
chat = chat,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -279,13 +491,30 @@ public suspend fun TelegramBot.sendTextMessage(
entities: TextSourcesList,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<TextContent> = sendTextMessage(chat.id, entities, linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendTextMessage(
chatId = chat.id,
entities = entities,
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some [dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -296,14 +525,31 @@ public suspend fun TelegramBot.sendTextMessage(
separator: TextSource? = null,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendTextMessage(
chat = chat,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -315,11 +561,28 @@ public suspend fun TelegramBot.sendTextMessage(
separator: String,
linkPreviewOptions: LinkPreviewOptions? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
builderBody: EntitiesBuilderBody
): ContentMessage<TextContent> = sendTextMessage(chat, buildEntities(separator, builderBody), linkPreviewOptions, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<TextContent> = sendTextMessage(
chat = chat,
entities = buildEntities(separator, builderBody),
linkPreviewOptions = linkPreviewOptions,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -6,6 +8,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.LocationContent
@@ -20,22 +23,28 @@ public suspend fun TelegramBot.sendLocation(
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = execute(
SendStaticLocation(
chatId,
latitude,
longitude,
chatId = chatId,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -49,23 +58,29 @@ public suspend fun TelegramBot.sendLocation(
chatId: ChatIdentifier,
location: Location,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = sendLocation(
chatId,
location.latitude,
location.longitude,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -77,23 +92,29 @@ public suspend fun TelegramBot.sendLocation(
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = sendLocation(
chat.id,
latitude,
longitude,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chat.id,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -104,23 +125,29 @@ public suspend fun TelegramBot.sendLocation(
chat: Chat,
location: Location,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = sendLocation(
chat.id,
location.latitude,
location.longitude,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -132,13 +159,30 @@ public suspend fun TelegramBot.sendStaticLocation(
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = sendLocation(chatId, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<StaticLocationContent> = sendLocation(
chatId = chatId,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -148,13 +192,30 @@ public suspend fun TelegramBot.sendStaticLocation(
chatId: ChatIdentifier,
location: Location,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = sendLocation(chatId, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<StaticLocationContent> = sendLocation(
chatId = chatId,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -165,13 +226,30 @@ public suspend fun TelegramBot.sendStaticLocation(
latitude: Double,
longitude: Double,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = sendLocation(chat.id, latitude, longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<StaticLocationContent> = sendLocation(
chatId = chat.id,
latitude = latitude,
longitude = longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -181,10 +259,27 @@ public suspend fun TelegramBot.sendStaticLocation(
chat: Chat,
location: Location,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StaticLocationContent> = sendLocation(chat.id, location.latitude, location.longitude, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<StaticLocationContent> = sendLocation(
chatId = chat.id,
latitude = location.latitude,
longitude = location.longitude,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -6,6 +8,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.location.StaticLocation
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.VenueContent
@@ -26,10 +29,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VenueContent> = execute(
@@ -44,10 +50,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -68,10 +77,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VenueContent> = sendVenue(
@@ -85,10 +97,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -107,10 +122,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VenueContent> = sendVenue(
@@ -124,10 +142,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -146,10 +167,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId: GooglePlaceId? = null,
googlePlaceType: GooglePlaceType? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VenueContent> = sendVenue(
@@ -163,10 +187,13 @@ public suspend fun TelegramBot.sendVenue(
googlePlaceId = googlePlaceId,
googlePlaceType = googlePlaceType,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -179,10 +206,13 @@ public suspend fun TelegramBot.sendVenue(
chatId: ChatIdentifier,
venue: Venue,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VenueContent> = execute(
@@ -190,10 +220,13 @@ public suspend fun TelegramBot.sendVenue(
chatId = chatId,
venue = venue,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -207,20 +240,26 @@ public suspend fun TelegramBot.sendVenue(
chat: Chat,
venue: Venue,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VenueContent> = sendVenue(
chatId = chat.id,
venue = venue,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.games.Game
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.GameContent
@@ -18,15 +19,29 @@ public suspend fun TelegramBot.sendGame(
chatId: ChatIdentifier,
gameShortName: String,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<GameContent> = execute(
SendGame(
chatId, gameShortName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
gameShortName = gameShortName,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -38,14 +53,28 @@ public suspend fun TelegramBot.sendGame(
chat: Chat,
gameShortName: String,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<GameContent> = sendGame(
chat.id, gameShortName, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chat.id,
gameShortName = gameShortName,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -56,14 +85,28 @@ public suspend fun TelegramBot.sendGame(
chatId: ChatIdentifier,
game: Game,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<GameContent> = sendGame(
chatId, game.title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
gameShortName = game.title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -74,12 +117,26 @@ public suspend fun TelegramBot.sendGame(
chat: Chat,
game: Game,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<GameContent> = sendGame(
chat.id, game.title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chat.id,
gameShortName = game.title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -7,6 +9,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.AnimationFile
@@ -29,10 +32,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = execute(
@@ -48,10 +54,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -72,10 +81,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = sendAnimation(
@@ -90,10 +102,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -114,10 +129,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = sendAnimation(
@@ -132,10 +150,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -155,10 +176,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = sendAnimation(
@@ -172,10 +196,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -196,10 +223,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = execute(
@@ -214,10 +244,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -237,10 +270,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = sendAnimation(
@@ -254,10 +290,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -277,10 +316,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = sendAnimation(
@@ -294,10 +336,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -316,10 +361,13 @@ public suspend fun TelegramBot.sendAnimation(
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AnimationContent> = sendAnimation(
@@ -332,10 +380,13 @@ public suspend fun TelegramBot.sendAnimation(
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.AudioFile
@@ -27,29 +28,35 @@ public suspend fun TelegramBot.sendAudio(
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = execute(
SendAudio(
chatId,
audio,
thumb,
text,
parseMode,
duration,
performer,
title,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
audio = audio,
thumbnail = thumb,
text = text,
parseMode = parseMode,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -67,13 +74,35 @@ public suspend fun TelegramBot.sendAudio(
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = sendAudio(chat.id, audio, thumb, text, parseMode, duration, performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<AudioContent> = sendAudio(
chatId = chat.id,
audio = audio,
thumb = thumb,
text = text,
parseMode = parseMode,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -86,13 +115,35 @@ public suspend fun TelegramBot.sendAudio(
parseMode: ParseMode? = null,
title: String? = audio.title,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, text, parseMode, audio.duration, audio.performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<AudioContent> = sendAudio(
chatId = chatId,
audio = audio.fileId,
thumb = audio.thumbnail ?.fileId,
text = text,
parseMode = parseMode,
duration = audio.duration,
performer = audio.performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -105,13 +156,32 @@ public suspend fun TelegramBot.sendAudio(
parseMode: ParseMode? = null,
title: String? = audio.title,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = sendAudio(chat.id, audio, text, parseMode, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<AudioContent> = sendAudio(
chatId = chat.id,
audio = audio,
text = text,
parseMode = parseMode,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -127,28 +197,34 @@ public suspend inline fun TelegramBot.sendAudio(
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = execute(
SendAudio(
chatId,
audio,
thumb,
entities,
duration,
performer,
title,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
audio = audio,
thumbnail = thumb,
entities = entities,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -165,13 +241,34 @@ public suspend inline fun TelegramBot.sendAudio(
performer: String? = null,
title: String? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = sendAudio(chat.id, audio, thumb, entities, duration, performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<AudioContent> = sendAudio(
chatId = chat.id,
audio = audio,
thumb = thumb,
entities = entities,
duration = duration,
performer = performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -183,13 +280,34 @@ public suspend inline fun TelegramBot.sendAudio(
entities: TextSourcesList,
title: String? = audio.title,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = sendAudio(chatId, audio.fileId, audio.thumbnail ?.fileId, entities, audio.duration, audio.performer, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<AudioContent> = sendAudio(
chatId = chatId,
audio = audio.fileId,
thumb = audio.thumbnail ?.fileId,
entities = entities,
duration = audio.duration,
performer = audio.performer,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -201,10 +319,28 @@ public suspend inline fun TelegramBot.sendAudio(
entities: TextSourcesList,
title: String? = audio.title,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<AudioContent> = sendAudio(chat.id, audio, entities, title, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<AudioContent> = sendAudio(
chatId = chat.id,
audio = audio,
entities = entities,
title = title,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.DocumentFile
@@ -24,28 +25,34 @@ public suspend fun TelegramBot.sendDocument(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = execute(
SendDocument(
chatId,
document,
thumb,
text,
parseMode,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup,
disableContentTypeDetection
chatId = chatId,
document = document,
thumbnail = thumb,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
)
@@ -60,14 +67,34 @@ public suspend fun TelegramBot.sendDocument(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = sendDocument(chat.id, document, thumb, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection)
): ContentMessage<DocumentContent> = sendDocument(
chatId = chat.id,
document = document,
thumb = thumb,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -79,15 +106,33 @@ public suspend fun TelegramBot.sendDocument(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = sendDocument(
chatId, document.fileId, document.thumbnail ?.fileId, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection
chatId = chatId,
document = document.fileId,
thumb = document.thumbnail ?.fileId,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
/**
@@ -100,14 +145,33 @@ public suspend fun TelegramBot.sendDocument(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = sendDocument(chat.id, document, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection)
): ContentMessage<DocumentContent> = sendDocument(
chatId = chat.id,
document = document,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -119,27 +183,33 @@ public suspend inline fun TelegramBot.sendDocument(
thumb: InputFile? = null,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = execute(
SendDocument(
chatId,
document,
thumb,
entities,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup,
disableContentTypeDetection
chatId = chatId,
document = document,
thumbnail = thumb,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
)
@@ -153,14 +223,33 @@ public suspend inline fun TelegramBot.sendDocument(
thumb: InputFile? = null,
entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = sendDocument(chat.id, document, thumb, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection)
): ContentMessage<DocumentContent> = sendDocument(
chatId = chat.id,
document = document,
thumb = thumb,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -171,15 +260,32 @@ public suspend inline fun TelegramBot.sendDocument(
document: DocumentFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = sendDocument(
chatId, document.fileId, document.thumbnail ?.fileId, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection
chatId = chatId,
document = document.fileId,
thumb = document.thumbnail ?.fileId,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)
/**
@@ -191,11 +297,29 @@ public suspend inline fun TelegramBot.sendDocument(
document: DocumentFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null,
disableContentTypeDetection: Boolean? = null
): ContentMessage<DocumentContent> = sendDocument(chat.id, document, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup, disableContentTypeDetection)
): ContentMessage<DocumentContent> = sendDocument(
chatId = chat.id,
document = document,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup,
disableContentTypeDetection = disableContentTypeDetection
)

View File

@@ -8,6 +8,7 @@ import dev.inmo.tgbotapi.types.media.*
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.utils.RiskFeature
import kotlin.jvm.JvmName
@@ -19,14 +20,27 @@ public suspend fun TelegramBot.sendMediaGroup(
chatId: ChatIdentifier,
media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<MediaGroupPartContent>> = execute(
SendMediaGroup<MediaGroupPartContent>(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
)
@@ -38,13 +52,26 @@ public suspend fun TelegramBot.sendMediaGroup(
chat: Chat,
media: List<MediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<MediaGroupPartContent>> = sendMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -56,13 +83,26 @@ public suspend fun TelegramBot.sendMediaGroup(
chatId: ChatIdentifier,
media: List<MediaGroupPartContent>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<MediaGroupPartContent>> = sendMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media.map { it.toMediaGroupMemberTelegramMedia() },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -74,13 +114,26 @@ public suspend fun TelegramBot.sendMediaGroup(
chat: Chat,
media: List<MediaGroupPartContent>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<MediaGroupPartContent>> = sendMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -90,14 +143,27 @@ public suspend fun TelegramBot.sendPlaylist(
chatId: ChatIdentifier,
media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<AudioContent>> = execute(
SendPlaylist(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
)
@@ -108,13 +174,26 @@ public suspend fun TelegramBot.sendPlaylist(
chat: Chat,
media: List<AudioMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<AudioContent>> = sendPlaylist(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -125,13 +204,26 @@ public suspend fun TelegramBot.sendPlaylist(
chatId: ChatIdentifier,
media: List<AudioContent>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<AudioContent>> = sendPlaylist(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media.map { it.toMediaGroupMemberTelegramMedia() },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -142,13 +234,26 @@ public suspend fun TelegramBot.sendPlaylist(
chat: Chat,
media: List<AudioContent>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<AudioContent>> = sendPlaylist(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -158,14 +263,27 @@ public suspend fun TelegramBot.sendDocumentsGroup(
chatId: ChatIdentifier,
media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<DocumentContent>> = execute(
SendDocumentsGroup(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
)
@@ -176,13 +294,26 @@ public suspend fun TelegramBot.sendDocumentsGroup(
chat: Chat,
media: List<DocumentMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<DocumentContent>> = sendDocumentsGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -193,13 +324,26 @@ public suspend fun TelegramBot.sendDocumentsGroup(
chatId: ChatIdentifier,
media: List<DocumentContent>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<DocumentContent>> = sendDocumentsGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media.map { it.toMediaGroupMemberTelegramMedia() },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -210,13 +354,26 @@ public suspend fun TelegramBot.sendDocumentsGroup(
chat: Chat,
media: List<DocumentContent>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<DocumentContent>> = sendDocumentsGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -226,14 +383,27 @@ public suspend fun TelegramBot.sendVisualMediaGroup(
chatId: ChatIdentifier,
media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<VisualMediaGroupPartContent>> = execute(
SendVisualMediaGroup(
chatId, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
)
@@ -244,13 +414,26 @@ public suspend fun TelegramBot.sendVisualMediaGroup(
chat: Chat,
media: List<VisualMediaGroupMemberTelegramMedia>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<VisualMediaGroupPartContent>> = sendVisualMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -261,13 +444,26 @@ public suspend fun TelegramBot.sendVisualMediaGroup(
chatId: ChatIdentifier,
media: List<VisualMediaGroupPartContent>,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<VisualMediaGroupPartContent>> = sendVisualMediaGroup(
chatId, media.map { it.toMediaGroupMemberTelegramMedia() }, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chatId,
media = media.map { it.toMediaGroupMemberTelegramMedia() },
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)
/**
@@ -278,11 +474,24 @@ public suspend fun TelegramBot.sendVisualMediaGroup(
chat: Chat,
media: List<VisualMediaGroupPartContent>,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null
): ContentMessage<MediaGroupContent<VisualMediaGroupPartContent>> = sendVisualMediaGroup(
chat.id, media, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters
chatId = chat.id,
media = media,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -6,6 +8,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.media.TelegramPaidMedia
@@ -22,11 +25,15 @@ public suspend fun TelegramBot.sendPaidMedia(
media: List<TelegramPaidMedia>,
text: String? = null,
parseMode: ParseMode? = null,
payload: PaidMediaPayload? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PaidMediaInfoContent> = execute(
@@ -36,11 +43,15 @@ public suspend fun TelegramBot.sendPaidMedia(
media = media,
text = text,
parseMode = parseMode,
payload = payload,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -56,11 +67,15 @@ public suspend fun TelegramBot.sendPaidMedia(
media: List<TelegramPaidMedia>,
text: String? = null,
parseMode: ParseMode? = null,
payload: PaidMediaPayload? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PaidMediaInfoContent> = sendPaidMedia(
@@ -69,11 +84,15 @@ public suspend fun TelegramBot.sendPaidMedia(
media = media,
text = text,
parseMode = parseMode,
payload = payload,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -88,11 +107,15 @@ public suspend inline fun TelegramBot.sendPaidMedia(
starCount: Int,
media: List<TelegramPaidMedia>,
entities: TextSourcesList,
payload: PaidMediaPayload? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PaidMediaInfoContent> = execute(
@@ -101,11 +124,15 @@ public suspend inline fun TelegramBot.sendPaidMedia(
starCount = starCount,
media = media,
entities = entities,
payload = payload,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -120,11 +147,15 @@ public suspend inline fun TelegramBot.sendPaidMedia(
starCount: Int,
media: List<TelegramPaidMedia>,
entities: TextSourcesList,
payload: PaidMediaPayload? = null,
showCaptionAboveMedia: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PaidMediaInfoContent> = sendPaidMedia(
@@ -132,11 +163,15 @@ public suspend inline fun TelegramBot.sendPaidMedia(
starCount = starCount,
media = media,
entities = entities,
payload = payload,
showCaptionAboveMedia = showCaptionAboveMedia,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -7,6 +9,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.*
@@ -25,10 +28,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = execute(
@@ -40,10 +46,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -61,10 +70,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -75,10 +87,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -95,10 +110,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -109,10 +127,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -129,10 +150,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -143,10 +167,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -163,10 +190,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -177,10 +207,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -197,10 +230,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -211,10 +247,13 @@ public suspend fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -231,10 +270,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = execute(
@@ -245,10 +287,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -265,10 +310,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -278,10 +326,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -297,10 +348,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -310,10 +364,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -329,10 +386,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -342,10 +402,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -361,10 +424,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -374,10 +440,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -393,10 +462,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PhotoContent> = sendPhoto(
@@ -406,10 +478,13 @@ public suspend inline fun TelegramBot.sendPhoto(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -10,6 +12,7 @@ import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.Sticker
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.StickerContent
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -19,15 +22,32 @@ public suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier,
sticker: InputFile,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StickerContent> = execute(
SendSticker(chatId, sticker, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
SendSticker(
chatId = chatId,
sticker = sticker,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
@@ -38,14 +58,31 @@ public suspend fun TelegramBot.sendSticker(
chat: Chat,
sticker: InputFile,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StickerContent> = sendSticker(chat.id, sticker, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<StickerContent> = sendSticker(
chatId = chat.id,
sticker = sticker,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -55,14 +92,31 @@ public suspend fun TelegramBot.sendSticker(
chatId: ChatIdentifier,
sticker: Sticker,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StickerContent> = sendSticker(chatId, sticker.fileId, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<StickerContent> = sendSticker(
chatId = chatId,
sticker = sticker.fileId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -72,11 +126,28 @@ public suspend fun TelegramBot.sendSticker(
chat: Chat,
sticker: Sticker,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
emoji: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<StickerContent> = sendSticker(chat, sticker.fileId, threadId, businessConnectionId, emoji, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<StickerContent> = sendSticker(
chat = chat,
sticker = sticker.fileId,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
emoji = emoji,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send.media
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -7,6 +9,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.VideoFile
@@ -25,14 +28,19 @@ public suspend fun TelegramBot.sendVideo(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = execute(
@@ -44,15 +52,20 @@ public suspend fun TelegramBot.sendVideo(
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
supportStreaming = null,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -70,10 +83,13 @@ public suspend fun TelegramBot.sendVideo(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = sendVideo(
@@ -84,14 +100,19 @@ public suspend fun TelegramBot.sendVideo(
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = video.cover ?.fileId,
startTimestamp = video.startTimestamp,
duration = video.duration,
width = video.width,
height = video.height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -108,14 +129,19 @@ public suspend fun TelegramBot.sendVideo(
parseMode: ParseMode? = null,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = sendVideo(
@@ -126,14 +152,19 @@ public suspend fun TelegramBot.sendVideo(
parseMode = parseMode,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -151,10 +182,13 @@ public suspend fun TelegramBot.sendVideo(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = sendVideo(
@@ -165,10 +199,13 @@ public suspend fun TelegramBot.sendVideo(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -184,14 +221,19 @@ public suspend inline fun TelegramBot.sendVideo(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = execute(
@@ -202,15 +244,20 @@ public suspend inline fun TelegramBot.sendVideo(
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
supportStreaming = null,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -227,10 +274,13 @@ public suspend inline fun TelegramBot.sendVideo(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = sendVideo(
@@ -240,14 +290,19 @@ public suspend inline fun TelegramBot.sendVideo(
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = video.cover ?.fileId,
startTimestamp = video.startTimestamp,
duration = video.duration,
width = video.width,
height = video.height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -263,14 +318,19 @@ public suspend inline fun TelegramBot.sendVideo(
entities: TextSourcesList,
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
cover: InputFile? = null,
startTimestamp: Seconds? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = sendVideo(
@@ -280,14 +340,19 @@ public suspend inline fun TelegramBot.sendVideo(
entities = entities,
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
cover = cover,
startTimestamp = startTimestamp,
duration = duration,
width = width,
height = height,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -304,10 +369,13 @@ public suspend inline fun TelegramBot.sendVideo(
showCaptionAboveMedia: Boolean = false,
spoilered: Boolean = false,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoContent> = sendVideo(
@@ -317,10 +385,13 @@ public suspend inline fun TelegramBot.sendVideo(
showCaptionAboveMedia = showCaptionAboveMedia,
spoilered = spoilered,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.files.VideoNoteFile
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.VideoNoteContent
@@ -22,26 +23,32 @@ public suspend fun TelegramBot.sendVideoNote(
duration: Long? = null,
size: Int? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoNoteContent> = execute(
SendVideoNote(
chatId,
videoNote,
thumb,
duration,
size,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
videoNote = videoNote,
thumbnail = thumb,
duration = duration,
size = size,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -53,14 +60,31 @@ public suspend fun TelegramBot.sendVideoNote(
chatId: ChatIdentifier,
videoNote: VideoNoteFile,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoNoteContent> = sendVideoNote(
chatId, videoNote.fileId, videoNote.thumbnail ?.fileId, videoNote.duration, videoNote.width, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
videoNote = videoNote.fileId,
thumb = videoNote.thumbnail ?.fileId,
duration = videoNote.duration,
size = videoNote.width,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -74,13 +98,32 @@ public suspend fun TelegramBot.sendVideoNote(
duration: Long? = null,
size: Int? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoNoteContent> = sendVideoNote(chat.id, videoNote, thumb, duration, size, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<VideoNoteContent> = sendVideoNote(
chatId = chat.id,
videoNote = videoNote,
thumb = thumb,
duration = duration,
size = size,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -90,10 +133,26 @@ public suspend fun TelegramBot.sendVideoNote(
chat: Chat,
videoNote: VideoNoteFile,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VideoNoteContent> = sendVideoNote(chat.id, videoNote, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<VideoNoteContent> = sendVideoNote(
chatId = chat.id,
videoNote = videoNote,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.textsources.TextSourcesList
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.files.VoiceFile
@@ -24,26 +25,32 @@ public suspend fun TelegramBot.sendVoice(
parseMode: ParseMode? = null,
duration: Long? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = execute(
SendVoice(
chatId,
voice,
text,
parseMode,
duration,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
voice = voice,
text = text,
parseMode = parseMode,
duration = duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -58,13 +65,32 @@ public suspend fun TelegramBot.sendVoice(
parseMode: ParseMode? = null,
duration: Long? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = sendVoice(chat.id, voice, text, parseMode, duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<VoiceContent> = sendVoice(
chatId = chat.id,
voice = voice,
text = text,
parseMode = parseMode,
duration = duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -76,14 +102,31 @@ public suspend fun TelegramBot.sendVoice(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = sendVoice(
chatId, voice.fileId, text, parseMode, voice.duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
voice = voice.fileId,
text = text,
parseMode = parseMode,
duration = voice.duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -96,13 +139,31 @@ public suspend fun TelegramBot.sendVoice(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = sendVoice(chat.id, voice, text, parseMode, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<VoiceContent> = sendVoice(
chatId = chat.id,
voice = voice,
text = text,
parseMode = parseMode,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -115,10 +176,13 @@ public suspend inline fun TelegramBot.sendVoice(
entities: TextSourcesList,
duration: Long? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = execute(
@@ -127,11 +191,14 @@ public suspend inline fun TelegramBot.sendVoice(
voice = voice,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
duration = duration,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
@@ -147,13 +214,31 @@ public suspend inline fun TelegramBot.sendVoice(
entities: TextSourcesList,
duration: Long? = null,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = sendVoice(chat.id, voice, entities, duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<VoiceContent> = sendVoice(
chatId = chat.id,
voice = voice,
entities = entities,
duration = duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -164,14 +249,30 @@ public suspend inline fun TelegramBot.sendVoice(
voice: VoiceFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = sendVoice(
chatId, voice.fileId, entities, voice.duration, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup
chatId = chatId,
voice = voice.fileId,
entities = entities,
duration = voice.duration,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
@@ -182,10 +283,27 @@ public suspend inline fun TelegramBot.sendVoice(
voice: VoiceFile,
entities: TextSourcesList,
threadId: MessageThreadId? = chat.id.threadId,
directMessageThreadId: DirectMessageThreadId? = chat.id.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<VoiceContent> = sendVoice(chat.id, voice, entities, threadId, businessConnectionId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<VoiceContent> = sendVoice(
chatId = chat.id,
voice = voice,
entities = entities,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -2,9 +2,11 @@ package dev.inmo.tgbotapi.extensions.api.send.payments
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
import korlibs.time.TimeSpan
public suspend fun TelegramBot.createInvoiceLink(
title: String,
@@ -24,7 +26,25 @@ public suspend fun TelegramBot.createInvoiceLink(
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false
): String = execute(
CreateInvoiceLink(title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress)
CreateInvoiceLink(
title = title,
description = description,
payload = payload,
providerToken = providerToken,
currency = currency,
prices = prices,
subscriptionPeriod = null,
maxTipAmount = maxTipAmount,
suggestedTipAmounts = suggestedTipAmounts ?.sorted(),
providerData = providerData,
requireName = requireName,
requirePhoneNumber = requirePhoneNumber,
requireEmail = requireEmail,
requireShippingAddress = requireShippingAddress,
shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider,
shouldSendEmailToProvider = shouldSendEmailToProvider,
priceDependOnShipAddress = priceDependOnShipAddress
)
)
/**
@@ -35,6 +55,8 @@ public suspend fun TelegramBot.createInvoiceLink(
description: String,
payload: String,
prices: List<LabeledPrice>,
businessConnectionId: BusinessConnectionId? = null,
subscriptionPeriod: TimeSpan? = null,
maxTipAmount: Int? = null,
suggestedTipAmounts: List<Int>? = null,
providerData: String? = null,
@@ -46,5 +68,24 @@ public suspend fun TelegramBot.createInvoiceLink(
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false
): String = execute(
CreateInvoiceLink(title, description, payload, null, Currency.XTR, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress)
CreateInvoiceLink(
title = title,
description = description,
payload = payload,
providerToken = null,
currency = Currency.XTR,
businessConnectionId = businessConnectionId,
prices = prices,
subscriptionPeriod = subscriptionPeriod,
maxTipAmount = maxTipAmount,
suggestedTipAmounts = suggestedTipAmounts ?.sorted(),
providerData = providerData,
requireName = requireName,
requirePhoneNumber = requirePhoneNumber,
requireEmail = requireEmail,
requireShippingAddress = requireShippingAddress,
shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider,
shouldSendEmailToProvider = shouldSendEmailToProvider,
priceDependOnShipAddress = priceDependOnShipAddress
)
)

View File

@@ -1,3 +1,5 @@
@file:Suppress("KDocUnresolvedReference")
package dev.inmo.tgbotapi.extensions.api.send.payments
import dev.inmo.tgbotapi.bot.TelegramBot
@@ -5,11 +7,11 @@ import dev.inmo.tgbotapi.requests.send.payments.SendInvoice
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.InvoiceContent
import dev.inmo.tgbotapi.types.payments.LabeledPrice
import dev.inmo.tgbotapi.types.payments.abstracts.Currency
import dev.inmo.tgbotapi.types.payments.abstracts.XTR
/**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
@@ -35,13 +37,44 @@ public suspend fun TelegramBot.sendInvoice(
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<InvoiceContent> = execute(
SendInvoice(chatId, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts ?.sorted(), startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, threadId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
SendInvoice(
chatId = chatId,
title = title,
description = description,
payload = payload,
providerToken = providerToken,
currency = currency,
prices = prices,
maxTipAmount = maxTipAmount,
suggestedTipAmounts = suggestedTipAmounts ?.sorted(),
startParameter = startParameter,
providerData = providerData,
requireName = requireName,
requirePhoneNumber = requirePhoneNumber,
requireEmail = requireEmail,
requireShippingAddress = requireShippingAddress,
shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider,
shouldSendEmailToProvider = shouldSendEmailToProvider,
priceDependOnShipAddress = priceDependOnShipAddress,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
@@ -69,10 +102,40 @@ public suspend fun TelegramBot.sendInvoice(
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<InvoiceContent> = sendInvoice(user.id, title, description, payload, providerToken, currency, prices, maxTipAmount, suggestedTipAmounts, startParameter, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, null, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
): ContentMessage<InvoiceContent> = sendInvoice(
chatId = user.id,
title = title,
description = description,
payload = payload,
providerToken = providerToken,
currency = currency,
prices = prices,
maxTipAmount = maxTipAmount,
suggestedTipAmounts = suggestedTipAmounts,
startParameter = startParameter,
providerData = providerData,
requireName = requireName,
requirePhoneNumber = requirePhoneNumber,
requireEmail = requireEmail,
requireShippingAddress = requireShippingAddress,
shouldSendPhoneNumberToProvider = shouldSendPhoneNumberToProvider,
shouldSendEmailToProvider = shouldSendEmailToProvider,
priceDependOnShipAddress = priceDependOnShipAddress,
threadId = null,
directMessageThreadId = null,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
/**
@@ -88,13 +151,33 @@ public suspend fun TelegramBot.sendInvoice(
startParameter: StartParameter? = null,
providerData: String? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<InvoiceContent> = execute(
SendInvoice(chatId, title, description, payload, price, startParameter, providerData, threadId, disableNotification, protectContent, effectId, replyParameters, replyMarkup)
SendInvoice(
chatId = chatId,
title = title,
description = description,
payload = payload,
price = price,
startParameter = startParameter,
providerData = providerData,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
/**
@@ -111,7 +194,9 @@ public suspend fun TelegramBot.sendInvoice(
providerData: String? = null,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<InvoiceContent> = sendInvoice(
@@ -123,9 +208,12 @@ public suspend fun TelegramBot.sendInvoice(
startParameter = startParameter,
providerData = providerData,
threadId = null,
directMessageThreadId = null,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)

View File

@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.PollContent
import dev.inmo.tgbotapi.types.message.textsources.TextSource
@@ -26,32 +27,38 @@ public suspend fun TelegramBot.sendQuizPoll(
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
explanation,
questionParseMode,
explanationParseMode,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
question = question,
options = options,
correctOptionId = correctOptionId,
explanation = explanation,
questionParseMode = questionParseMode,
explanationParseMode = explanationParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
openPeriod = openPeriod,
closeDate = closeDate,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -67,31 +74,37 @@ public suspend fun TelegramBot.sendQuizPoll(
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
explanation,
explanationParseMode,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
questionEntities = questionEntities,
options = options,
correctOptionId = correctOptionId,
explanation = explanation,
explanationParseMode = explanationParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
openPeriod = openPeriod,
closeDate = closeDate,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -107,31 +120,37 @@ public suspend fun TelegramBot.sendQuizPoll(
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
questionParseMode,
explanationTextSources,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
question = question,
options = options,
correctOptionId = correctOptionId,
questionParseMode = questionParseMode,
explanationTextSources = explanationTextSources,
isAnonymous = isAnonymous,
isClosed = isClosed,
openPeriod = openPeriod,
closeDate = closeDate,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -147,30 +166,36 @@ public suspend fun TelegramBot.sendQuizPoll(
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
explanationTextSources,
isAnonymous,
isClosed,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
questionEntities = questionEntities,
options = options,
correctOptionId = correctOptionId,
explanationTextSources = explanationTextSources,
isAnonymous = isAnonymous,
isClosed = isClosed,
openPeriod = openPeriod,
closeDate = closeDate,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -186,31 +211,37 @@ public suspend fun TelegramBot.sendQuizPoll(
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
closeInfo,
explanation,
questionParseMode,
explanationParseMode,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
question = question,
options = options,
correctOptionId = correctOptionId,
closeInfo = closeInfo,
explanation = explanation,
questionParseMode = questionParseMode,
explanationParseMode = explanationParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -225,30 +256,36 @@ public suspend fun TelegramBot.sendQuizPoll(
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
closeInfo,
explanation,
explanationParseMode,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
questionEntities = questionEntities,
options = options,
correctOptionId = correctOptionId,
closeInfo = closeInfo,
explanation = explanation,
explanationParseMode = explanationParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -263,30 +300,36 @@ public suspend fun TelegramBot.sendQuizPoll(
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
question,
options,
correctOptionId,
closeInfo,
questionParseMode,
explanationTextSources,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
question = question,
options = options,
correctOptionId = correctOptionId,
closeInfo = closeInfo,
questionParseMode = questionParseMode,
explanationTextSources = explanationTextSources,
isAnonymous = isAnonymous,
isClosed = isClosed,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -300,28 +343,34 @@ public suspend fun TelegramBot.sendQuizPoll(
isAnonymous: Boolean = true,
isClosed: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendQuizPoll(
chatId,
questionEntities,
options,
correctOptionId,
closeInfo,
explanationTextSources,
isAnonymous,
isClosed,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
questionEntities = questionEntities,
options = options,
correctOptionId = correctOptionId,
closeInfo = closeInfo,
explanationTextSources = explanationTextSources,
isAnonymous = isAnonymous,
isClosed = isClosed,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)

View File

@@ -6,6 +6,7 @@ import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.SuggestedPostParameters
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.PollContent
import dev.inmo.tgbotapi.types.message.textsources.TextSource
@@ -24,30 +25,36 @@ public suspend fun TelegramBot.sendRegularPoll(
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendRegularPoll(
chatId,
question,
options,
questionParseMode,
isAnonymous,
isClosed,
allowMultipleAnswers,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
question = question,
options = options,
questionParseMode = questionParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
openPeriod = openPeriod,
closeDate = closeDate,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -61,29 +68,35 @@ public suspend fun TelegramBot.sendRegularPoll(
openPeriod: LongSeconds? = null,
closeDate: LongSeconds? = null,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendRegularPoll(
chatId,
questionEntities,
options,
isAnonymous,
isClosed,
allowMultipleAnswers,
openPeriod,
closeDate,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
questionEntities = questionEntities,
options = options,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
openPeriod = openPeriod,
closeDate = closeDate,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -97,29 +110,35 @@ public suspend fun TelegramBot.sendRegularPoll(
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendRegularPoll(
chatId,
question,
options,
closeInfo,
questionParseMode,
isAnonymous,
isClosed,
allowMultipleAnswers,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
question = question,
options = options,
closeInfo = closeInfo,
questionParseMode = questionParseMode,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)
@@ -132,27 +151,33 @@ public suspend fun TelegramBot.sendRegularPoll(
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
threadId: MessageThreadId? = chatId.threadId,
directMessageThreadId: DirectMessageThreadId? = chatId.directMessageThreadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
suggestedPostParameters: SuggestedPostParameters? = null,
replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null
): ContentMessage<PollContent> = execute(
SendRegularPoll(
chatId,
questionEntities,
options,
closeInfo,
isAnonymous,
isClosed,
allowMultipleAnswers,
threadId,
businessConnectionId,
disableNotification,
protectContent,
effectId,
replyParameters,
replyMarkup
chatId = chatId,
questionTextSources = questionEntities,
options = options,
closeInfo = closeInfo,
isAnonymous = isAnonymous,
isClosed = isClosed,
allowMultipleAnswers = allowMultipleAnswers,
threadId = threadId,
directMessageThreadId = directMessageThreadId,
businessConnectionId = businessConnectionId,
disableNotification = disableNotification,
protectContent = protectContent,
allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
suggestedPostParameters = suggestedPostParameters,
replyParameters = replyParameters,
replyMarkup = replyMarkup
)
)

View File

@@ -0,0 +1,50 @@
package dev.inmo.tgbotapi.extensions.api.set
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.set.SetUserEmojiStatus
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.User
import korlibs.time.DateTime
public suspend fun TelegramBot.setUserEmojiStatus(
userId: UserId,
customEmojiId: CustomEmojiId,
expirationDate: TelegramDate? = null
): Boolean = execute(
SetUserEmojiStatus(
userId = userId,
customEmojiId = customEmojiId,
expirationDate = expirationDate
)
)
public suspend fun TelegramBot.setUserEmojiStatus(
user: User,
customEmojiId: CustomEmojiId,
expirationDate: TelegramDate? = null
): Boolean = setUserEmojiStatus(
user.id,
customEmojiId,
expirationDate
)
public suspend fun TelegramBot.setUserEmojiStatus(
userId: UserId,
customEmojiId: CustomEmojiId,
expirationDate: DateTime
): Boolean = setUserEmojiStatus(
userId,
customEmojiId,
expirationDate.toTelegramDate()
)
public suspend fun TelegramBot.setUserEmojiStatus(
user: User,
customEmojiId: CustomEmojiId,
expirationDate: DateTime
): Boolean = setUserEmojiStatus(
user.id,
customEmojiId,
expirationDate
)

View File

@@ -0,0 +1,42 @@
package dev.inmo.tgbotapi.extensions.api.stories
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.stories.DeleteStory
import dev.inmo.tgbotapi.types.StoryId
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
import dev.inmo.tgbotapi.types.stories.Story
/**
* Deletes a story from a business account
*/
public suspend fun TelegramBot.deleteStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId
): Boolean = execute(
DeleteStory(
businessConnectionId = businessConnectionId,
storyId = storyId
)
)
public suspend fun TelegramBot.deleteStory(
message: BusinessContentMessage<*>,
storyId: StoryId
): Boolean = deleteStory(
businessConnectionId = with(message) {message.businessConnectionId}, storyId = storyId
)
public suspend fun TelegramBot.deleteStory(
businessConnectionId: BusinessConnectionId,
story: Story
): Boolean = deleteStory(
businessConnectionId = businessConnectionId, storyId = with(story) {story.id}
)
public suspend fun TelegramBot.deleteStory(
message: BusinessContentMessage<*>,
story: Story
): Boolean = deleteStory(
message = message, storyId = with(story) {story.id}
)

View File

@@ -0,0 +1,79 @@
package dev.inmo.tgbotapi.extensions.api.stories
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.stories.EditStory
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.StoryId
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.stories.InputStoryContent
import dev.inmo.tgbotapi.types.stories.Story
import dev.inmo.tgbotapi.types.stories.StoryArea
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
import dev.inmo.tgbotapi.utils.buildEntities
public suspend fun TelegramBot.editStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId,
content: InputStoryContent,
textSources: List<TextSource>,
areas: List<StoryArea> = emptyList(),
): Story = execute(
EditStory(
businessConnectionId = businessConnectionId,
storyId = storyId,
content = content,
textSources = textSources,
areas = areas,
)
)
public suspend fun TelegramBot.editStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId,
content: InputStoryContent,
areas: List<StoryArea> = emptyList(),
separator: TextSource? = null,
textBuilder: EntitiesBuilderBody
): Story = execute(
EditStory(
businessConnectionId = businessConnectionId,
storyId = storyId,
content = content,
textSources = buildEntities(separator, textBuilder),
areas = areas,
)
)
public suspend fun TelegramBot.editStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId,
content: InputStoryContent,
text: String,
parseMode: ParseMode? = null,
areas: List<StoryArea> = emptyList(),
): Story = execute(
EditStory(
businessConnectionId = businessConnectionId,
storyId = storyId,
content = content,
text = text,
parseMode = parseMode,
areas = areas,
)
)
public suspend fun TelegramBot.editStory(
businessConnectionId: BusinessConnectionId,
storyId: StoryId,
content: InputStoryContent,
areas: List<StoryArea> = emptyList(),
): Story = execute(
EditStory(
businessConnectionId = businessConnectionId,
storyId = storyId,
content = content,
areas = areas,
)
)

View File

@@ -0,0 +1,94 @@
package dev.inmo.tgbotapi.extensions.api.stories
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.stories.PostStory
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.message.ParseMode
import dev.inmo.tgbotapi.types.message.textsources.TextSource
import dev.inmo.tgbotapi.types.stories.InputStoryContent
import dev.inmo.tgbotapi.types.stories.Story
import dev.inmo.tgbotapi.types.stories.StoryArea
import dev.inmo.tgbotapi.utils.EntitiesBuilderBody
import dev.inmo.tgbotapi.utils.buildEntities
public suspend fun TelegramBot.postStory(
businessConnectionId: BusinessConnectionId,
content: InputStoryContent,
activePeriod: Seconds,
textSources: List<TextSource>,
areas: List<StoryArea> = emptyList(),
postToChatPage: Boolean = false,
protectContent: Boolean = false,
): Story = execute(
PostStory(
businessConnectionId = businessConnectionId,
content = content,
activePeriod = activePeriod,
textSources = textSources,
areas = areas,
postToChatPage = postToChatPage,
protectContent = protectContent
)
)
public suspend fun TelegramBot.postStory(
businessConnectionId: BusinessConnectionId,
content: InputStoryContent,
activePeriod: Seconds,
areas: List<StoryArea> = emptyList(),
postToChatPage: Boolean = false,
protectContent: Boolean = false,
separator: TextSource? = null,
textBuilder: EntitiesBuilderBody
): Story = execute(
PostStory(
businessConnectionId = businessConnectionId,
content = content,
activePeriod = activePeriod,
textSources = buildEntities(separator, textBuilder),
areas = areas,
postToChatPage = postToChatPage,
protectContent = protectContent
)
)
public suspend fun TelegramBot.postStory(
businessConnectionId: BusinessConnectionId,
content: InputStoryContent,
activePeriod: Seconds,
text: String,
parseMode: ParseMode? = null,
areas: List<StoryArea> = emptyList(),
postToChatPage: Boolean = false,
protectContent: Boolean = false,
): Story = execute(
PostStory(
businessConnectionId = businessConnectionId,
content = content,
activePeriod = activePeriod,
text = text,
parseMode = parseMode,
areas = areas,
postToChatPage = postToChatPage,
protectContent = protectContent
)
)
public suspend fun TelegramBot.postStory(
businessConnectionId: BusinessConnectionId,
content: InputStoryContent,
activePeriod: Seconds,
areas: List<StoryArea> = emptyList(),
postToChatPage: Boolean = false,
protectContent: Boolean = false,
): Story = execute(
PostStory(
businessConnectionId = businessConnectionId,
content = content,
activePeriod = activePeriod,
areas = areas,
postToChatPage = postToChatPage,
protectContent = protectContent
)
)

View File

@@ -0,0 +1,28 @@
package dev.inmo.tgbotapi.extensions.api.suggested
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.suggested.ApproveSuggestedPost
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
public suspend fun TelegramBot.approveSuggestedPost(
chatId: IdChatIdentifier,
messageId: MessageId,
sendDate: TelegramDate? = null,
): Boolean = execute(
ApproveSuggestedPost(chatId, messageId, sendDate)
)
public suspend fun TelegramBot.approveSuggestedPost(
chat: Chat,
messageId: MessageId,
sendDate: TelegramDate? = null,
): Boolean = approveSuggestedPost(chat.id, messageId, sendDate)
public suspend fun TelegramBot.approveSuggestedPost(
message: Message,
sendDate: TelegramDate? = null,
): Boolean = approveSuggestedPost(message.chat, message.messageId, sendDate)

View File

@@ -0,0 +1,29 @@
package dev.inmo.tgbotapi.extensions.api.suggested
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.suggested.ApproveSuggestedPost
import dev.inmo.tgbotapi.requests.suggested.DeclineSuggestedPost
import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.Message
public suspend fun TelegramBot.declineSuggestedPost(
chatId: IdChatIdentifier,
messageId: MessageId,
comment: String? = null,
): Boolean = execute(
DeclineSuggestedPost(chatId, messageId, comment)
)
public suspend fun TelegramBot.declineSuggestedPost(
chat: Chat,
messageId: MessageId,
comment: String? = null,
): Boolean = declineSuggestedPost(chat.id, messageId, comment)
public suspend fun TelegramBot.declineSuggestedPost(
message: Message,
comment: String? = null,
): Boolean = declineSuggestedPost(message.chat, message.messageId, comment)

View File

@@ -1,11 +1,13 @@
package dev.inmo.tgbotapi.extensions.api.utils
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
import dev.inmo.kslog.common.KSLog
import dev.inmo.micro_utils.coroutines.launchLoggingDropExceptions
import dev.inmo.tgbotapi.extensions.api.InternalUtils.convertWithMediaGroupUpdates
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyMediaGroupMessage
import dev.inmo.tgbotapi.types.update.abstracts.BaseMessageUpdate
import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.updateshandlers.UpdateReceiver
import dev.inmo.tgbotapi.utils.DefaultKTgBotAPIKSLog
import dev.inmo.tgbotapi.utils.extensions.accumulateByKey
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.channels.Channel
@@ -19,7 +21,8 @@ import kotlinx.coroutines.launch
*/
public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
output: UpdateReceiver<Update>,
mediaGroupsDebounceMillis: Long = 1000L
mediaGroupsDebounceMillis: Long = 1000L,
logger: KSLog = DefaultKTgBotAPIKSLog
): UpdateReceiver<Update> {
val updatesChannel = Channel<Update>(Channel.UNLIMITED)
val mediaGroupChannel = Channel<Pair<String, BaseMessageUpdate>>(Channel.UNLIMITED)
@@ -29,7 +32,7 @@ public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
)
launch {
launchSafelyWithoutExceptions {
launchLoggingDropExceptions(logger = logger) {
for (update in updatesChannel) {
val data = update.data
when {
@@ -40,7 +43,7 @@ public fun CoroutineScope.updateHandlerWithMediaGroupsAdaptation(
}
}
}
launchSafelyWithoutExceptions {
launchLoggingDropExceptions(logger = logger) {
for ((_, mediaGroup) in mediaGroupAccumulatedChannel) {
mediaGroup.convertWithMediaGroupUpdates().forEach {
output(it)

View File

@@ -0,0 +1,11 @@
package dev.inmo.tgbotapi.extensions.api.verifications
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.verifications.RemoveChatVerification
import dev.inmo.tgbotapi.types.ChatIdentifier
public suspend fun TelegramBot.removeChatVerification(
chatId: ChatIdentifier
): Boolean = execute(
RemoveChatVerification(chatId)
)

View File

@@ -0,0 +1,11 @@
package dev.inmo.tgbotapi.extensions.api.verifications
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.verifications.RemoveUserVerification
import dev.inmo.tgbotapi.types.UserId
public suspend fun TelegramBot.removeUserVerification(
userId: UserId
): Boolean = execute(
RemoveUserVerification(userId)
)

View File

@@ -0,0 +1,39 @@
package dev.inmo.tgbotapi.extensions.api.verifications
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.verifications.VerifyChat
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.*
import dev.inmo.tgbotapi.types.chatIdField
import dev.inmo.tgbotapi.types.customDescriptionField
import kotlinx.serialization.SerialName
public suspend fun TelegramBot.verifyChat(
chatId: ChatIdentifier,
description: String? = null
): Boolean = execute(
VerifyChat(
chatId = chatId,
description = description
)
)
/**
* This method may call [verifyUser] in case when [chat] is [PrivateChat]
*/
public suspend fun TelegramBot.verifyChat(
chat: Chat,
description: String? = null
): Boolean = when (chat) {
is PrivateChat -> verifyUser(
chat = chat,
description = description
)
is UnknownExtendedChat,
is UnknownChatType,
is BusinessChat,
is PublicChat -> verifyChat(
chatId = chat.id,
description = description
)
}

View File

@@ -0,0 +1,26 @@
package dev.inmo.tgbotapi.extensions.api.verifications
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.verifications.VerifyChat
import dev.inmo.tgbotapi.requests.verifications.VerifyUser
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.Chat
import kotlinx.serialization.SerialName
public suspend fun TelegramBot.verifyUser(
userId: UserId,
description: String? = null
): Boolean = execute(
VerifyUser(
userId = userId,
description = description
)
)
public suspend fun TelegramBot.verifyUser(
chat: Chat,
description: String? = null
): Boolean = verifyUser(
userId = chat.id.toChatId(),
description = description
)

View File

@@ -1,31 +1,32 @@
public abstract interface class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM : dev/inmo/micro_utils/fsm/common/StatesMachine, dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext {
public static final field Companion Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM$Companion;
public abstract fun add (Lkotlin/reflect/KClass;ZLdev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public abstract fun addStrict (Lkotlin/reflect/KClass;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public abstract fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static synthetic fun add$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Lkotlin/reflect/KClass;ZLdev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;ILjava/lang/Object;)V
public fun addStrict (Lkotlin/reflect/KClass;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public abstract fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public abstract fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public abstract fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static synthetic fun copy$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public abstract fun getStateInitialAction ()Lkotlin/jvm/functions/Function3;
public fun start (Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM$Companion {
public final fun invoke (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ljava/util/List;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM;
public static synthetic fun invoke$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM$Companion;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ljava/util/List;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM;
public final fun getDATA_FSM_KEY ()Ljava/lang/String;
public final fun invoke (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ljava/util/List;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM;
public static synthetic fun invoke$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM$Companion;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ljava/util/List;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM$DefaultImpls {
public static synthetic fun add$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Lkotlin/reflect/KClass;ZLdev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;ILjava/lang/Object;)V
public static fun addStrict (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Lkotlin/reflect/KClass;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public static fun copy (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static fun copy (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static synthetic fun copy$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static synthetic fun copy$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static synthetic fun copy$default (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ILjava/lang/Object;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public static fun getAllowedUpdates (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Ljava/util/List;
public static fun getBot (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Ldev/inmo/tgbotapi/bot/RequestsExecutor;
public static fun getChannelPostMediaGroupsFlow (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Lkotlinx/coroutines/flow/Flow;
public static fun getEditedChannelPostMediaGroupsFlow (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Lkotlinx/coroutines/flow/Flow;
public static fun getEditedMessageMediaGroupsFlow (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Lkotlinx/coroutines/flow/Flow;
public static fun getFlowsUpdatesFilter (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;
public static fun getLog (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Ldev/inmo/kslog/common/KSLog;
public static fun getMessageMediaGroupsFlow (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Lkotlinx/coroutines/flow/Flow;
public static fun getScope (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;)Lkotlinx/coroutines/CoroutineScope;
public static fun launchStateHandling (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/micro_utils/fsm/common/State;Ljava/util/List;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -34,18 +35,23 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourConte
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSMBuilderKt {
public static final fun buildBehaviourWithFSM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun buildBehaviourWithFSM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun buildBehaviourWithFSMAndStartLongPolling (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun buildBehaviourWithFSMAndStartLongPolling (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSMAndStartLongPolling$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSMAndStartLongPolling$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun buildBehaviourWithFSM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun buildBehaviourWithFSM (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSM$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun buildBehaviourWithFSMAndStartLongPolling (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static final fun buildBehaviourWithFSMAndStartLongPolling (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSMAndStartLongPolling$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static synthetic fun buildBehaviourWithFSMAndStartLongPolling$default (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/flow/Flow;Lkotlinx/coroutines/CoroutineScope;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSMKt {
public static final fun fsmOrNull (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;)Ldev/inmo/micro_utils/fsm/common/StatesMachine;
public static final fun fsmOrThrow (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;)Ldev/inmo/micro_utils/fsm/common/StatesMachine;
}
public abstract interface class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler : dev/inmo/micro_utils/fsm/common/StatesHandler {
public abstract fun handleState (Ldev/inmo/micro_utils/fsm/common/StatesMachine;Ldev/inmo/micro_utils/fsm/common/State;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public fun handleState (Ldev/inmo/micro_utils/fsm/common/StatesMachine;Ldev/inmo/micro_utils/fsm/common/State;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public abstract fun handleState (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;Ldev/inmo/micro_utils/fsm/common/State;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
}
@@ -62,18 +68,17 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithF
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM : dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext, dev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM {
public fun <init> (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;)V
public synthetic fun <init> (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun <init> (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)V
public synthetic fun <init> (Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public fun add (Lkotlin/reflect/KClass;ZLdev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public fun addStrict (Lkotlin/reflect/KClass;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandler;)V
public fun close ()V
public synthetic fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;
public synthetic fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM;
public synthetic fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContext;
public synthetic fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM;
public fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public fun copy (Ldev/inmo/tgbotapi/bot/RequestsExecutor;Lkotlinx/coroutines/CoroutineScope;ILkotlinx/coroutines/channels/BufferOverflow;Lkotlinx/coroutines/flow/Flow;Lkotlin/jvm/functions/Function3;Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;)Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextWithFSM;
public fun execute (Ldev/inmo/tgbotapi/requests/abstracts/Request;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public final fun fsm ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehaviourContextWithFSM;
public fun getAllUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getAllowedUpdates ()Ljava/util/List;
public fun getAsUpdateReceiver ()Lkotlin/jvm/functions/Function2;
@@ -91,6 +96,7 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehavio
public fun getChatMessageReactionsCountUpdatedUpdateFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getChosenInlineResultsFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getCoroutineContext ()Lkotlin/coroutines/CoroutineContext;
public fun getData ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourContextData;
public fun getDeleteBusinessMessageUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getEditBusinessMessageUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getEditedChannelPostMediaGroupsFlow ()Lkotlinx/coroutines/flow/Flow;
@@ -99,14 +105,18 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehavio
public fun getEditedMessagesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getFlowsUpdatesFilter ()Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;
public fun getInlineQueriesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getLog ()Ldev/inmo/kslog/common/KSLog;
public fun getMessageMediaGroupsFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMessagesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getMyChatMemberUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getPaidMediaPurchasedUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getPollAnswersFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getPollsFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getPreCheckoutQueriesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getScope ()Lkotlinx/coroutines/CoroutineScope;
public fun getShippingQueriesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun getStateInitialAction ()Lkotlin/jvm/functions/Function3;
public fun getSubcontextInitialAction ()Lkotlin/jvm/functions/Function3;
public fun getTriggersHolder ()Ldev/inmo/tgbotapi/extensions/behaviour_builder/utils/handlers_registrar/TriggersHolder;
public fun getUnknownUpdatesFlow ()Lkotlinx/coroutines/flow/Flow;
public fun handleState (Ldev/inmo/micro_utils/fsm/common/StatesMachine;Ldev/inmo/micro_utils/fsm/common/State;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
@@ -118,9 +128,9 @@ public final class dev/inmo/tgbotapi/extensions/behaviour_builder/DefaultBehavio
}
public final class dev/inmo/tgbotapi/extensions/behaviour_builder/TelegramBotWithFSMKt {
public static final fun telegramBotWithBehaviourAndFSM (Ljava/lang/String;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun telegramBotWithBehaviourAndFSM$default (Ljava/lang/String;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun telegramBotWithBehaviourAndFSMAndStartLongPolling (Ljava/lang/String;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun telegramBotWithBehaviourAndFSMAndStartLongPolling$default (Ljava/lang/String;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun telegramBotWithBehaviourAndFSM (Ljava/lang/String;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun telegramBotWithBehaviourAndFSM$default (Ljava/lang/String;Ldev/inmo/tgbotapi/updateshandlers/FlowsUpdatesFilter;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
public static final fun telegramBotWithBehaviourAndFSMAndStartLongPolling (Ljava/lang/String;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;
public static synthetic fun telegramBotWithBehaviourAndFSMAndStartLongPolling$default (Ljava/lang/String;Lkotlinx/coroutines/CoroutineScope;Ljava/lang/String;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function2;Ldev/inmo/micro_utils/fsm/common/StatesManager;Ljava/util/List;Ldev/inmo/tgbotapi/extensions/behaviour_builder/BehaviourWithFSMStateHandlerHolder;ZLkotlin/jvm/functions/Function3;IZZLjava/lang/Long;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function2;ZLkotlin/jvm/functions/Function2;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
}

View File

@@ -6,8 +6,8 @@ plugins {
project.description = "Behaviour Builder DSL"
apply from: "$mppProjectWithSerializationPresetPath"
apply from: "$publishGradlePath"
apply from: "$mppProjectWithSerialization"
apply from: "$mpp_publish"
kotlin {
sourceSets {

View File

@@ -1,3 +1,5 @@
@file:Suppress("unused")
package dev.inmo.tgbotapi.extensions.behaviour_builder
import dev.inmo.micro_utils.coroutines.*
@@ -5,8 +7,11 @@ import dev.inmo.micro_utils.fsm.common.*
import dev.inmo.micro_utils.fsm.common.utils.StateHandlingErrorHandler
import dev.inmo.micro_utils.fsm.common.utils.defaultStateHandlingErrorHandler
import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.behaviour_builder.BehaviourContextWithFSM.Companion.DATA_FSM_KEY
import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.extensions.behaviour_builder.utils.handlers_registrar.TriggersHolder
import dev.inmo.tgbotapi.utils.launchWithBotLogger
import dev.inmo.tgbotapi.utils.subscribeWithBotLogger
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.*
@@ -22,6 +27,11 @@ import kotlin.reflect.KClass
* @see buildBehaviourWithFSM
*/
interface BehaviourContextWithFSM<T : State> : BehaviourContext, StatesMachine<T> {
/**
* Will be called BEFORE handling of [State] will be started
*/
val stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T>
suspend fun start() = start(this)
/**
@@ -49,7 +59,8 @@ interface BehaviourContextWithFSM<T : State> : BehaviourContext, StatesMachine<T
broadcastChannelsSize: Int,
onBufferOverflow: BufferOverflow,
upstreamUpdatesFlow: Flow<Update>?,
triggersHolder: TriggersHolder
triggersHolder: TriggersHolder,
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update>
): BehaviourContextWithFSM<T>
fun copy(
@@ -58,51 +69,31 @@ interface BehaviourContextWithFSM<T : State> : BehaviourContext, StatesMachine<T
broadcastChannelsSize: Int = 100,
onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND,
upstreamUpdatesFlow: Flow<Update>? = null,
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update> = {},
triggersHolder: TriggersHolder = this.triggersHolder,
stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T> = this.stateInitialAction,
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()
): BehaviourContextWithFSM<T> = copy(
bot,
scope,
broadcastChannelsSize,
onBufferOverflow,
upstreamUpdatesFlow,
triggersHolder
)
fun copy(
bot: TelegramBot = this.bot,
scope: CoroutineScope = this.scope,
broadcastChannelsSize: Int = 100,
onBufferOverflow: BufferOverflow = BufferOverflow.SUSPEND,
upstreamUpdatesFlow: Flow<Update>? = null,
triggersHolder: TriggersHolder = this.triggersHolder,
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
updatesFilter: BehaviourContextAndTypeReceiver<Boolean, Update>? = null
): BehaviourContextWithFSM<T> = copy(
bot,
scope,
broadcastChannelsSize,
onBufferOverflow,
upstreamUpdatesFlow,
triggersHolder,
onStateHandlingErrorHandler
)
): BehaviourContextWithFSM<T>
companion object {
@Suppress("RemoveExplicitTypeArguments")
operator fun <T : State> invoke(
behaviourContext: BehaviourContext,
handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>,
statesManager: StatesManager<T>,
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T> = {},
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()
) = DefaultBehaviourContextWithFSM<T>(behaviourContext, statesManager, handlers, fallbackHandler, onStateHandlingErrorHandler)
) = DefaultBehaviourContextWithFSM<T>(behaviourContext, statesManager, handlers, fallbackHandler, stateInitialAction, onStateHandlingErrorHandler)
val DATA_FSM_KEY = "ktgbotapi_fsm"
}
}
/**
* Add NON STRICT [handler] to list of available in future [BehaviourContextWithFSM]. Non strict means that
* for input [State] will be used [KClass.isInstance] and any inheritor of [kClass] will pass this requirement
* for input [State] will be used [KClass.isInstance] and any inheritor of I::class will pass this requirement
*
* @see BehaviourWithFSMStateHandlerHolder
* @see BehaviourContextWithFSM.add
@@ -112,7 +103,7 @@ inline fun <reified I : O, O: State> BehaviourContextWithFSM<O>.onStateOrSubstat
/**
* Add STRICT [handler] to list of available in future [BehaviourContextWithFSM]. Strict means that
* for input [State] will be used [State]::class == [kClass] and any [State] with exactly the same type will pass
* for input [State] will be used [State]::class == I::class and any [State] with exactly the same type will pass
* requirements
*
* @see BehaviourWithFSMStateHandlerHolder
@@ -131,6 +122,7 @@ class DefaultBehaviourContextWithFSM<T : State>(
private val statesManager: StatesManager<T>,
private val handlers: List<BehaviourWithFSMStateHandlerHolder<*, T>>,
private val fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
override val stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T> = {},
private val onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler()
) : BehaviourContext by behaviourContext, BehaviourContextWithFSM<T> {
private val updatesFlows = mutableMapOf<Any, DefaultBehaviourContextWithFSM<T>>()
@@ -140,6 +132,10 @@ class DefaultBehaviourContextWithFSM<T : State>(
protected val statesJobs = mutableMapOf<T, Job>()
protected val statesJobsMutex = Mutex()
init {
data[DATA_FSM_KEY] = this
}
override suspend fun launchStateHandling(state: T, handlers: List<CheckableHandlerHolder<in T, T>>): T? {
return launchStateHandling(state, handlers, onStateHandlingErrorHandler)
}
@@ -151,10 +147,14 @@ class DefaultBehaviourContextWithFSM<T : State>(
override suspend fun StatesMachine<in T>.handleState(state: T): T? {
return getSubContext(
state.context
).launchStateHandling(
state,
actualHandlersList
)
).apply {
stateInitialAction(state)
}.run {
launchStateHandling(
state,
actualHandlersList
)
}
}
override fun <I : T> add(kClass: KClass<I>, strict: Boolean, handler: BehaviourWithFSMStateHandler<I, T>) {
@@ -162,7 +162,7 @@ class DefaultBehaviourContextWithFSM<T : State>(
actualHandlersList = additionalHandlers + handlers
}
override fun start(scope: CoroutineScope): Job = scope.launchSafelyWithoutExceptions {
override fun start(scope: CoroutineScope): Job = scope.launchWithBotLogger {
val statePerformer: suspend (T) -> Unit = { state: T ->
val newState = getSubContext(state.context).launchStateHandling(state, actualHandlersList)
if (newState != null) {
@@ -174,7 +174,7 @@ class DefaultBehaviourContextWithFSM<T : State>(
fun Job.enableRemoveOnCompletion(state: T) {
invokeOnCompletion {
launchSafelyWithoutExceptions {
launchWithBotLogger {
statesJobsMutex.withLock {
if (this@enableRemoveOnCompletion === statesJobs[state]) {
statesJobs.remove(state)
@@ -184,33 +184,33 @@ class DefaultBehaviourContextWithFSM<T : State>(
}
}
statesManager.onStartChain.subscribeSafelyWithoutExceptions(this) {
statesManager.onStartChain.subscribeWithBotLogger(this) {
statesJobsMutex.withLock {
runCatchingSafely { statesJobs.remove(it) ?.cancel() }
runCatching { statesJobs.remove(it) ?.cancel() }
statesJobs[it] = launch { statePerformer(it) }.apply { enableRemoveOnCompletion(it) }
}
}
statesManager.onEndChain.subscribeSafelyWithoutExceptions(this) {
statesManager.onEndChain.subscribeWithBotLogger(this) {
statesJobsMutex.withLock {
runCatchingSafely { statesJobs.remove(it) ?.cancel() }
runCatching { statesJobs.remove(it) ?.cancel() }
}
updatesFlows.remove(it.context)
updatesFlows.remove(it.context) ?.cancel()
}
statesManager.onChainStateUpdated.subscribeSafelyWithoutExceptions(this) { (old, new) ->
statesManager.onChainStateUpdated.subscribeWithBotLogger(this) { (old, new) ->
statesJobsMutex.withLock {
runCatchingSafely { statesJobs.remove(old) ?.cancel() }
runCatchingSafely { statesJobs.remove(new) ?.cancel() }
runCatching { statesJobs.remove(old) ?.cancel() }
runCatching { statesJobs.remove(new) ?.cancel() }
statesJobs[new] = launch { statePerformer(new) }.apply { enableRemoveOnCompletion(new) }
}
if (old.context != new.context) {
updatesFlows.remove(old.context)
updatesFlows.remove(old.context) ?.cancel()
}
}
statesManager.getActiveStates().forEach {
statesJobsMutex.withLock {
runCatchingSafely { statesJobs.remove(it) ?.cancel() }
runCatching { statesJobs.remove(it) ?.cancel() }
statesJobs[it] = launch { statePerformer(it) }.apply { enableRemoveOnCompletion(it) }
}
@@ -218,7 +218,7 @@ class DefaultBehaviourContextWithFSM<T : State>(
}
/**
* Add NON STRICT [handler] to list of available in future [BehaviourContextWithFSM]. Non strict means that
* for input [State] will be used [KClass.isInstance] and any inheritor of [kClass] will pass this requirement
* for input [State] will be used [KClass.isInstance] and any inheritor of I::class will pass this requirement
*
* @see BehaviourWithFSMStateHandlerHolder
* @see BehaviourContextWithFSM.add
@@ -228,7 +228,7 @@ class DefaultBehaviourContextWithFSM<T : State>(
/**
* Add STRICT [handler] to list of available in future [BehaviourContextWithFSM]. Strict means that
* for input [State] will be used [State]::class == [kClass] and any [State] with exactly the same type will pass
* for input [State] will be used [State]::class == I::class and any [State] with exactly the same type will pass
* requirements
*
* @see BehaviourWithFSMStateHandlerHolder
@@ -247,13 +247,23 @@ class DefaultBehaviourContextWithFSM<T : State>(
broadcastChannelsSize: Int,
onBufferOverflow: BufferOverflow,
upstreamUpdatesFlow: Flow<Update>?,
triggersHolder: TriggersHolder
triggersHolder: TriggersHolder,
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update>
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, triggersHolder),
handlers,
statesManager,
fallbackHandler,
onStateHandlingErrorHandler
behaviourContext = behaviourContext.copy(
bot = bot,
scope = scope,
broadcastChannelsSize = broadcastChannelsSize,
onBufferOverflow = onBufferOverflow,
upstreamUpdatesFlow = upstreamUpdatesFlow,
subcontextInitialAction = subcontextInitialAction,
triggersHolder = triggersHolder
),
handlers = handlers,
statesManager = statesManager,
fallbackHandler = fallbackHandler,
onStateHandlingErrorHandler = onStateHandlingErrorHandler,
stateInitialAction = stateInitialAction
)
override fun copy(
@@ -262,13 +272,42 @@ class DefaultBehaviourContextWithFSM<T : State>(
broadcastChannelsSize: Int,
onBufferOverflow: BufferOverflow,
upstreamUpdatesFlow: Flow<Update>?,
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update>,
triggersHolder: TriggersHolder,
stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T>,
onStateHandlingErrorHandler: StateHandlingErrorHandler<T>
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
behaviourContext.copy(bot, scope, broadcastChannelsSize, onBufferOverflow, upstreamUpdatesFlow, triggersHolder),
handlers,
statesManager,
fallbackHandler,
onStateHandlingErrorHandler
): BehaviourContextWithFSM<T> = BehaviourContextWithFSM(
behaviourContext = behaviourContext.copy(
bot = bot,
scope = scope,
broadcastChannelsSize = broadcastChannelsSize,
onBufferOverflow = onBufferOverflow,
upstreamUpdatesFlow = upstreamUpdatesFlow,
subcontextInitialAction = subcontextInitialAction,
triggersHolder = triggersHolder
),
handlers = handlers,
statesManager = statesManager,
fallbackHandler = fallbackHandler,
stateInitialAction = stateInitialAction,
onStateHandlingErrorHandler = onStateHandlingErrorHandler
)
fun fsm() = this
}
/**
* Extracting from [BehaviourContext.data] exists [StatesMachine] by key [DATA_FSM_KEY], which usually some [BehaviourContextWithFSM].
* In case if value absent in [BehaviourContext.data] will return null
*/
@Suppress("UNCHECKED_CAST")
fun <T : State> BehaviourContext.fsmOrNull(): StatesMachine<T>? = data[DATA_FSM_KEY] as? StatesMachine<T>
/**
* Extracting from [BehaviourContext.data] exists [StatesMachine] by key [DATA_FSM_KEY], which usually some [BehaviourContextWithFSM].
* In case if value absent in [BehaviourContext.data] will throw [NullPointerException]
*
* @throws NullPointerException
*/
@Suppress("RemoveExplicitTypeArguments")
fun <T : State> BehaviourContext.fsmOrThrow(): StatesMachine<T> = fsmOrNull<T>()!!

View File

@@ -14,6 +14,7 @@ import dev.inmo.tgbotapi.types.update.abstracts.Update
import dev.inmo.tgbotapi.updateshandlers.FlowsUpdatesFilter
import kotlinx.coroutines.*
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.emptyFlow
/**
* Creates [BehaviourContextWithFSM] via creating of [DefaultBehaviourContext] with [this] as [TelegramBot],
@@ -33,17 +34,23 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update> = {},
stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T> = {},
useDefaultSubcontextInitialAction: Boolean = true,
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
DefaultBehaviourContext(
this,
defaultExceptionsHandler ?.let { scope + ContextSafelyExceptionHandler(it) } ?: scope,
upstreamUpdatesFlow = upstreamUpdatesFlow
behaviourContext = BehaviourContext(
bot = this,
scope = defaultExceptionsHandler ?.let { scope + ContextSafelyExceptionHandler(it) } ?: scope,
upstreamUpdatesFlow = upstreamUpdatesFlow ?: emptyFlow(),
useDefaultSubcontextInitialAction = useDefaultSubcontextInitialAction,
subcontextInitialAction = subcontextInitialAction
),
presetHandlers,
statesManager,
fallbackHandler,
onStateHandlingErrorHandler
handlers = presetHandlers,
statesManager = statesManager,
fallbackHandler = fallbackHandler,
stateInitialAction = stateInitialAction,
onStateHandlingErrorHandler = onStateHandlingErrorHandler
).apply { block() }
/**
@@ -67,16 +74,22 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
autoDisableWebhooks: Boolean = true,
autoSkipTimeoutExceptions: Boolean = true,
mediaGroupsDebounceTimeMillis: Long? = 1000L,
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update> = {},
stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T> = {},
useDefaultSubcontextInitialAction: Boolean = true,
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
): Pair<DefaultBehaviourContextWithFSM<T>, Job> = buildBehaviourWithFSM(
upstreamUpdatesFlow,
scope,
defaultExceptionsHandler,
statesManager,
presetHandlers,
fallbackHandler,
onStateHandlingErrorHandler,
block
upstreamUpdatesFlow = upstreamUpdatesFlow,
scope = scope,
defaultExceptionsHandler = defaultExceptionsHandler,
statesManager = statesManager,
presetHandlers = presetHandlers,
fallbackHandler = fallbackHandler,
onStateHandlingErrorHandler = onStateHandlingErrorHandler,
subcontextInitialAction = subcontextInitialAction,
stateInitialAction = stateInitialAction,
useDefaultSubcontextInitialAction = useDefaultSubcontextInitialAction,
block = block
).run {
this to scope.launch {
start()
@@ -110,16 +123,22 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSM(
presetHandlers: List<BehaviourWithFSMStateHandlerHolder<*, T>> = listOf(),
fallbackHandler: BehaviourWithFSMStateHandlerHolder<T, T>? = null,
onStateHandlingErrorHandler: StateHandlingErrorHandler<T> = defaultStateHandlingErrorHandler(),
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update> = {},
stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T> = {},
useDefaultSubcontextInitialAction: Boolean = true,
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
): DefaultBehaviourContextWithFSM<T> = BehaviourContextWithFSM(
DefaultBehaviourContext(
BehaviourContext(
this,
defaultExceptionsHandler ?.let { scope + ContextSafelyExceptionHandler(it) } ?: scope,
upstreamUpdatesFlow = flowUpdatesFilter.allUpdatesFlow
upstreamUpdatesFlow = flowUpdatesFilter.allUpdatesFlow,
subcontextInitialAction = subcontextInitialAction,
useDefaultSubcontextInitialAction = useDefaultSubcontextInitialAction
),
presetHandlers,
statesManager,
fallbackHandler,
stateInitialAction,
onStateHandlingErrorHandler
).apply { block() }
@@ -149,27 +168,33 @@ suspend fun <T : State> TelegramBot.buildBehaviourWithFSMAndStartLongPolling(
autoDisableWebhooks: Boolean = true,
autoSkipTimeoutExceptions: Boolean = true,
mediaGroupsDebounceTimeMillis: Long? = 1000L,
subcontextInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContext, Unit, Update> = {},
stateInitialAction: CustomBehaviourContextAndTypeReceiver<BehaviourContextWithFSM<T>, Unit, T> = {},
useDefaultSubcontextInitialAction: Boolean = true,
block: CustomBehaviourContextReceiver<DefaultBehaviourContextWithFSM<T>, Unit>
) = FlowsUpdatesFilter().let {
buildBehaviourWithFSM(
it,
scope,
defaultExceptionsHandler,
statesManager,
presetHandlers,
fallbackHandler,
onStateHandlingErrorHandler,
block
flowUpdatesFilter = it,
scope = scope,
defaultExceptionsHandler = defaultExceptionsHandler,
statesManager = statesManager,
presetHandlers = presetHandlers,
fallbackHandler = fallbackHandler,
onStateHandlingErrorHandler = onStateHandlingErrorHandler,
subcontextInitialAction = subcontextInitialAction,
stateInitialAction = stateInitialAction,
useDefaultSubcontextInitialAction = useDefaultSubcontextInitialAction,
block = block
).run {
start()
longPolling(
flowsUpdatesFilter,
timeoutSeconds,
scope,
autoDisableWebhooks,
autoSkipTimeoutExceptions,
mediaGroupsDebounceTimeMillis,
defaultExceptionsHandler
updatesFilter = flowsUpdatesFilter,
timeoutSeconds = timeoutSeconds,
scope = scope,
autoDisableWebhooks = autoDisableWebhooks,
autoSkipTimeoutExceptions = autoSkipTimeoutExceptions,
mediaGroupsDebounceTimeMillis = mediaGroupsDebounceTimeMillis,
exceptionsHandler = defaultExceptionsHandler
)
}
}

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