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

Compare commits

..

568 Commits

Author SHA1 Message Date
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
c8d6b759b7 filling of changelog and making Reaction.Paid to be an object 2024-08-15 02:41:12 +06:00
8823b268cc small fixes in docs 2024-08-15 02:12:45 +06:00
49031bf0e6 fixes and improvements 2024-08-15 01:55:55 +06:00
c72f8e04ec fixes in send action dsl 2024-08-15 00:58:12 +06:00
a56ad7d671 make small improvement in send action dsl 2024-08-15 00:36:11 +06:00
77158ffecf add note about send action dsl PR 2024-08-15 00:34:07 +06:00
1990e6b158 Merge pull request #883 from DRSchlaubi/patch-1
Delay after executing action in sendActionDSL
2024-08-15 00:31:19 +06:00
40d3388c74 one more jvmApiDump after ksp 2024-08-15 00:29:53 +06:00
ac6cf6e0b2 jvmApiDump 2024-08-15 00:20:22 +06:00
1dc9dc42fb improve ChannelContentMessage 2024-08-14 23:09:16 +06:00
b7ff6a3061 complete support of sender chat 2024-08-14 22:53:38 +06:00
76eae0a54f add support of paid emoji 2024-08-14 22:37:19 +06:00
e9a172565e improve new chat member difference 2024-08-14 22:33:11 +06:00
49f7954db7 add support of until in MemberChatMember 2024-08-14 22:16:14 +06:00
9c43fecf41 add support of createChatSubscriptionInviteLink and editChatSubscriptionInviteLink 2024-08-14 22:06:57 +06:00
228ecba6cc start implementation of paid invitation links 2024-08-14 20:05:17 +06:00
dfecf93dd5 add support of paid media in TransactionPartner.User 2024-08-14 19:51:02 +06:00
b469b1c789 start implementation of superchannels 2024-08-14 19:47:29 +06:00
f58a28d062 start 17.0.0 2024-08-14 19:29:56 +06:00
Michael Rittmeister
21ba1cca30 Delay after executing action in sendActionDSL 2024-08-12 23:46:53 +02:00
40c5af4469 Merge pull request #882 from InsanusMokrassar/renovate/validator
Update dependency org.jetbrains.kotlinx.binary-compatibility-validator to v0.16.3
2024-08-12 02:34:54 +06:00
renovate[bot]
e8e7329f52 Update dependency org.jetbrains.kotlinx.binary-compatibility-validator to v0.16.3 2024-08-11 16:32:35 +00:00
a162c3a8e2 Merge pull request #879 from InsanusMokrassar/16.0.0
16.0.0
2024-08-11 22:31:08 +06:00
e9f7028a20 fill changelog 2024-08-11 22:30:15 +06:00
ecd8ca7d4d update dependencies 2024-08-11 17:58:34 +06:00
6fcd327ca4 rm -rf .kotlin/ 2024-08-02 16:55:22 +06:00
c6b809eb66 changes to calm down compiler 2024-08-02 16:53:59 +06:00
037f9974da start updating 2024-08-02 16:53:59 +06:00
b2fcdc40d5 start 16.0.0 2024-08-02 16:53:53 +06:00
6016387e07 Merge pull request #881 from InsanusMokrassar/15.3.0
hotfix for params in shareToStory
2024-08-02 16:51:55 +06:00
96bbf5fc81 hotfix for params in shareToStory 2024-08-02 16:51:20 +06:00
f7cf37f338 Merge pull request #880 from InsanusMokrassar/15.3.0
15.3.0
2024-08-02 16:50:09 +06:00
8e3e44769e add defaults in StoryShareParams and StoryWidgetLink 2024-08-01 17:43:08 +06:00
2d11685b7b fix using of json in new webapp types 2024-08-01 17:41:13 +06:00
8bb3095fb1 fix of "widget_link" parameter name in StoryShareParams 2024-08-01 17:39:14 +06:00
799ad6ca66 fill changelog and add StoryShareParams factory function 2024-08-01 17:38:16 +06:00
bd6ff747cb add note about telegram bot api 7.8 support 2024-08-01 17:32:51 +06:00
010c52adeb add shareToStory in WebApp 2024-08-01 17:26:18 +06:00
88008b7cfc add support of business connection id in pin/unpin for messages 2024-08-01 17:17:41 +06:00
42b32af986 add hasMainWebApp into extended bots 2024-08-01 17:09:20 +06:00
4944c972a6 start 15.3.0 2024-08-01 17:03:26 +06:00
83445dd314 Merge pull request #878 from InsanusMokrassar/15.2.0
15.2.0
2024-07-15 18:33:27 +06:00
53ae56e887 remove class casts from Location Content 2024-07-15 16:29:16 +06:00
1c587abcdc migrato onto 15.2.0 due to partial API change 2024-07-15 16:25:42 +06:00
99f95ffc40 apiDump 2024-07-15 09:13:23 +06:00
a8ed162c9c small fixes/refactors in SendLocation 2024-07-15 08:55:08 +06:00
e5ea980347 fill changelog and remove old MainButton.onClick 2024-07-15 08:20:44 +06:00
4ce26c707e small refactor of MainButton 2024-07-15 02:45:01 +06:00
4343dbbde8 Merge pull request #875 from SuLG-ik/main-button-off-click-issue
Make MainButton.onClick(() -> Unit) and MainButton.offClick(() -> Unit) public
2024-07-15 02:42:57 +06:00
cdecce96e7 add EncodeDefault for SendLocation realizations default fields which should be encoded anyway 2024-07-15 02:33:39 +06:00
8a6e06bbf0 update live/static locations 2024-07-15 02:19:50 +06:00
f767362c41 Merge pull request #876 from bpavuk/874-bpavuk.api-mode
moving to an explicit API mode
2024-07-15 01:39:57 +06:00
9bf7c621a4 start 15.1.1 2024-07-15 01:39:06 +06:00
bpavuk
4085913bc3 moving to an explicit API mode
refactored the rest 🌚
2024-07-14 15:33:24 +03:00
bpavuk
f36373b718 moving to an explicit API mode
refactored `send` package (an effin' huge one!)
2024-07-14 15:24:46 +03:00
bpavuk
ed39fde776 moving to an explicit API mode
refactored `passport` package
2024-07-12 22:10:31 +03:00
bpavuk
b8837bffdc moving to an explicit API mode
refactored `get` package
2024-07-12 22:09:25 +03:00
bpavuk
cad6b26fdc moving to an explicit API mode
refactored `games` package
2024-07-12 22:07:36 +03:00
bpavuk
52f17178ab moving to an explicit API mode
refactored `files` package
2024-07-12 22:05:54 +03:00
bpavuk
6fa0ca3b89 moving to an explicit API mode
refactored `answers`, `bot`, `chat`, and `edit` packages, and jvmMain source set
2024-07-12 21:52:39 +03:00
fb00c0b8ef Merge pull request #868 from InsanusMokrassar/15.1.0
15.1.0
2024-07-11 22:13:53 +06:00
343c8a4319 Update CHANGELOG.md 2024-07-11 22:10:36 +06:00
a368356c6f fill changelog and update readme 2024-07-11 22:01:50 +06:00
f8e87ac49b fix of message about /privacy handling absence 2024-07-11 21:09:29 +06:00
6a2e8400c1 update envs for github publishing 2024-07-11 20:39:50 +06:00
SuLG-k
40613e3418 add @Deprecated on MainButton.onClick(EventHandler) 2024-07-11 20:35:22 +07:00
SuLG-k
016cfcb7cd remove internal modifier from MainButton.onClick and MainButton.offClick 2024-07-11 20:33:59 +07:00
e797546edb update link for publishing 2024-07-11 18:02:50 +06:00
16ca2bd984 revert adding new publishing to github packages 2024-07-11 17:23:27 +06:00
fb796254cf reorder publishing scripts 2024-07-11 17:22:38 +06:00
77bd649251 update jvm api dump 2024-07-11 15:31:11 +06:00
1471381b12 add built-in onCommandPrivacy 2024-07-10 23:01:38 +06:00
fc6c1da3e0 update jvm api dump 2024-07-10 22:16:09 +06:00
ebac413997 Merge pull request #873 from bpavuk/bpavuk.reply-extension-paid-media
Implemented paid media reply extension
2024-07-10 22:02:01 +06:00
bpavuk
9fa17c1360 Reused existing code in converters 2024-07-10 18:54:30 +03:00
bpavuk
982b401b28 Added overloads with text and custom parsing mode instead of entities 2024-07-10 18:34:43 +03:00
bpavuk
26b864a314 updated PaidMedia.Video.toTelegramPaidMediaVideo() converter function 2024-07-10 18:31:08 +03:00
bpavuk
f2fae9184f Fixed wrongly specified parameters 2024-07-10 16:55:24 +03:00
bpavuk
32db4a19d2 Moved to-overload to intended place 2024-07-10 16:54:26 +03:00
bpavuk
613f6de483 Renamed extension function to reflect its functionality 2024-07-10 16:53:18 +03:00
bpavuk
f89849218a Added to: AccessibleMessage overload 2024-07-10 16:39:52 +03:00
bpavuk
05341be534 Implemented paid media reply extension 2024-07-10 15:33:14 +03:00
45b99d85ff add triggers/expectors for paid media info content 2024-07-10 17:21:15 +06:00
a0fdebd13e upgrade sends 2024-07-10 17:00:20 +06:00
fb1ff6e4fd fixes in send paid media 2024-07-10 16:53:16 +06:00
6f64ed1032 update api dump 2024-07-10 16:36:48 +06:00
91a5340b23 make TelegramPaidMediaPhoto constructor public 2024-07-10 16:31:33 +06:00
8883a9ee51 fix of build 2024-07-09 22:59:46 +06:00
610ada505f add notice about privacy handling 2024-07-09 17:41:13 +06:00
236f484e10 Merge pull request #872 from bpavuk/bot-api-7.6
Bot API 7.6
2024-07-09 16:54:06 +06:00
bpavuk
3383bcaff3 Bot API 7.6
i am sleepyhead (:
2024-07-09 13:52:53 +03:00
bpavuk
83352dd284 Bot API 7.6
removed @SerialName annotations from TransactionPartner.User data class fields
2024-07-09 13:32:00 +03:00
b27efd118b add paid media into reply info 2024-07-09 02:15:49 +06:00
bpavuk
18fcb6bb97 Merge branch '15.1.0' into bot-api-7.6 2024-07-08 23:08:01 +03:00
5baa09f0c1 add sendPaidMedia, refactor telegram media, fix build 2024-07-09 01:57:12 +06:00
bpavuk
bfff55ab08 Bot API 7.6
added section_separator_color field to theme params in Bot Webapps
2024-07-08 22:49:35 +03:00
bpavuk
051922b4c2 Bot API 7.6
added invoice payload field to TransactionPartner.User
2024-07-08 22:46:26 +03:00
9dd80be36d Merge pull request #871 from bpavuk/bot-api-7.7
Bot API 7.7 (2)
2024-07-09 00:36:31 +06:00
bpavuk
873905a288 Bot API 7.7
deleted unneeded warning in docs
2024-07-08 21:34:19 +03:00
bpavuk
f8066431d3 Bot API 7.7
added docs for event trigger
2024-07-08 21:31:49 +03:00
5c655dd84c Merge pull request #870 from bpavuk/bot-api-7.7
Bot API 7.7
2024-07-09 00:27:50 +06:00
00aefefc31 progress on addinf of paid media 2024-07-08 02:51:09 +06:00
bpavuk
d865a60151 Bot API 7.7
added waiters, triggers, and class casts for refunded payment event. added property handler in RawMessage.
2024-07-07 21:25:19 +03:00
1eef5bb239 temporal progress on adding support of paid media 2024-07-08 00:18:54 +06:00
bpavuk
0457792d99 Bot API 7.7
added RefundedPaymentEvent
2024-07-07 20:56:17 +03:00
bpavuk
8c9f0ae922 Bot API 7.7
fixed RefundedPayment data class. providerPaymentChargeId is optional
2024-07-07 20:46:58 +03:00
bpavuk
44a8186830 Bot API 7.7
now WebApp class supports vertical swipes to close and/or minimize the app
2024-07-07 20:28:18 +03:00
bpavuk
d4698301ad Bot API 7.7
fixed event handler for onScanQRPopupClosed event
2024-07-07 20:05:24 +03:00
bpavuk
b7d3d849eb optimization and conventions
converted some objects with purpose to hold the data to data objects
2024-07-07 19:50:28 +03:00
bpavuk
cb33176e8b Bot API 7.7
implemented scanQrPopupClosed event
2024-07-07 19:48:37 +03:00
bpavuk
6edf466220 Bot API 7.7
implemented minor changes regarding refunded payments
2024-07-07 17:45:59 +03:00
0d4452d0f5 update PaidMedia 2024-07-06 21:45:15 +06:00
e02f74d77d start implement PaidMedia 2024-07-02 23:18:36 +06:00
47a8739db5 update microutils 2024-07-02 15:24:35 +06:00
760e8b0491 start 15.1.0 2024-07-02 14:55:12 +06:00
fe518a0d8f change dependencies repositories resolution order 2024-06-26 01:13:52 +06:00
227849a14c Merge pull request #867 from InsanusMokrassar/15.0.0
15.0.0
2024-06-26 00:50:38 +06:00
9e2c23cf2d small note about edit methods changes 2024-06-26 00:50:22 +06:00
acd241e31e update dependencies and add note about 7.5 bots api support 2024-06-26 00:23:51 +06:00
9cfc98bb67 improve API and fix StarTransaction 2024-06-26 00:19:54 +06:00
6a9407f15c potentially implement Bot API 7.5 2024-06-23 16:02:19 +06:00
af79e26855 add support for businessConnectionId in stopPoll 2024-06-23 15:23:58 +06:00
02a404b805 rename api file GetTransactions 2024-06-23 15:16:43 +06:00
f2e97df44c add support of getStarTransactions 2024-06-23 15:16:05 +06:00
63a695dcc5 complete Star Transactions abstractions 2024-06-23 15:11:03 +06:00
66cf0689e1 start implement new bot api 2024-06-22 23:31:38 +06:00
c7b8187829 start 15.0.0 2024-06-22 21:54:40 +06:00
5cfc350c13 Merge pull request #863 from InsanusMokrassar/14.1.0
14.1.0
2024-06-21 18:14:05 +06:00
a3ef66bbfb migration due to potential breaking changes in microutils 2024-06-21 13:30:13 +06:00
738728f647 Update libs.versions.toml 2024-06-21 13:21:05 +06:00
abbb4e2dff update microutils 2024-06-16 22:34:44 +06:00
c3fa8a6d33 update microutils dependency 2024-06-16 00:29:13 +06:00
fb2b912f93 update docs 2024-06-15 13:05:16 +06:00
46c5c62e15 rewrite MainTrigger as noinline 2024-06-15 12:36:14 +06:00
60fdbb8ac4 small improvement in BehaviourContext 2024-06-14 19:54:06 +06:00
86bd5eaa07 fill changelog and change BehaviourContext updates flow subscription mechanism 2024-06-14 17:33:51 +06:00
57122cc2f9 update dependencies 2024-06-14 17:28:37 +06:00
91a8058a3a try to support nullable marker factory 2024-06-13 22:24:16 +06:00
97836c5f4e rewrite createSubContextAndDoWithUpdatesFilter and doInContext to work with supervisor scope 2024-06-13 21:32:04 +06:00
1a8cfefa4d start 14.0.2 2024-06-13 21:09:49 +06:00
0e97a63103 Merge pull request #861 from InsanusMokrassar/14.0.1
14.0.1
2024-06-07 02:25:15 +06:00
24269cc774 improve SendInvoice API one more time 2024-06-07 01:55:37 +06:00
d960d94c0d fix build 2024-06-07 01:45:23 +06:00
663d63b009 update invoices API 2024-06-07 01:18:55 +06:00
7118631213 start 14.0.1 2024-06-06 16:53:56 +06:00
ff34017a03 Merge pull request #859 from InsanusMokrassar/14.0.0
14.0.0
2024-06-01 13:36:13 +06:00
96a7a2acab fill changelog and add Telegram Bots API support note 2024-06-01 13:35:29 +06:00
71c830fc2e fix passing of effectId in a lot of functions 2024-06-01 13:17:40 +06:00
271e7d2157 fix in SendPhoto 2024-06-01 13:13:10 +06:00
cf5e5a1d1e update defaults in createResend 2024-05-31 19:46:29 +06:00
186d6931ac first working version 2024-05-31 16:55:52 +06:00
6ec686040c progress in fixes of api errors 2024-05-31 13:04:11 +06:00
211cef298c fix of core build 2024-05-31 12:39:12 +06:00
8de41bdd99 complete effects in core part 2024-05-30 22:13:18 +06:00
7a5c9c7ef8 add base support of effects 2024-05-30 21:58:47 +06:00
4dec85ee60 add note about TelegramPaymentChargeId 2024-05-28 23:59:01 +06:00
4622509356 add support of refundStarPayment 2024-05-28 23:57:48 +06:00
30e44d6bf2 migration onto 14.0.0 due to breaking changes 2024-05-28 23:47:20 +06:00
e403bbca0b add support of expandable blockquote 2024-05-28 23:46:30 +06:00
93e06a5765 add support of show_caption_above_media"" 2024-05-28 22:48:06 +06:00
718f6ab366 start add effects support 2024-05-28 21:35:27 +06:00
6f776576ab add support of ommiting provider_token in payment classes 2024-05-28 19:06:11 +06:00
fcdaeb2e8f start 13.1.0 2024-05-28 18:54:44 +06:00
1e679ce50b Merge pull request #848 from InsanusMokrassar/13.0.0
13.0.0
2024-05-10 19:59:06 +06:00
fe4be69051 add note about Telegram Bots API support 2024-05-10 19:55:00 +06:00
06ba14e8be apiDump 2024-05-10 19:45:35 +06:00
ca1b196942 updates in LiveFlowLocation behaviours 2024-05-10 19:43:54 +06:00
dc5d8afe32 Chat bacgrkoud became PublicChatEvent inheritor instead of CommonEvent 2024-05-10 19:25:33 +06:00
b843fd9188 fixes in support of text entities 2024-05-10 16:31:56 +06:00
d56173eceb dump api 2024-05-09 22:15:26 +06:00
97621bca67 add support of ChatBackground 2024-05-09 21:54:24 +06:00
7e986b2088 update polls 2024-05-07 18:17:20 +06:00
cfc2fd1b47 fixes in sends and poll.kt 2024-05-07 16:15:40 +06:00
905486fff9 add support of max_reaction_count 2024-05-07 00:25:27 +06:00
6acf4bc927 almost completed implementation of polls changes 2024-05-07 00:20:53 +06:00
64a1aeef2c migrate 12.1.0 -> 13.0.0 2024-05-06 22:10:19 +06:00
6db88eb8bd add live_period in editing of live location 2024-05-06 21:51:24 +06:00
4e416aaf44 add LiveLocation.Companion#INDEFINITE_LIVE_PERIOD 2024-05-06 21:41:01 +06:00
71b9f15e40 ChatMemberUpdated 2024-05-06 21:37:44 +06:00
4dc2bfc8bf start 12.1.0 2024-05-06 21:33:35 +06:00
31c1055f3d Merge pull request #846 from InsanusMokrassar/12.0.1
12.0.1
2024-04-22 16:23:34 +06:00
3da2229a9c Update CHANGELOG.md 2024-04-22 14:41:53 +06:00
624289cc8e Update MicroUtils to last 0.20.45 version 2024-04-22 14:41:31 +06:00
9edc8a0d5a update dependencies 2024-04-22 11:40:53 +06:00
3bf914471a start 12.0.1 2024-04-22 11:35:34 +06:00
7d3c8a2d27 Merge pull request #843 from InsanusMokrassar/12.0.0
12.0.0
2024-04-20 23:35:13 +06:00
f12628bec3 add notice about breaking changes in 12.0.0 2024-04-20 23:33:32 +06:00
c1734e6d12 update changelog and readme 2024-04-20 23:31:42 +06:00
4bff860c01 fixes 2024-04-19 19:34:27 +06:00
6a8b83f750 remove timezone function from BusinessOpeningHours 2024-04-19 17:50:35 +06:00
ab9718b7c6 fixes in business connections 2024-04-19 17:36:38 +06:00
0a9235bcd9 add flag sentByBusinessConnectionOwner 2024-04-18 20:07:33 +06:00
eff2f2ba41 fixes in updates retrieving 2024-04-18 17:06:48 +06:00
db644c93ff update support of BiometricManager 2024-04-18 16:40:59 +06:00
28e031265c update stickers 2024-04-18 16:12:19 +06:00
84abd006ad support of new stickers API 2024-04-18 15:50:21 +06:00
5f4a327c2e add support of replaceStickerInSet 2024-04-18 15:21:07 +06:00
c5102590cc update users shared related things 2024-04-18 15:03:22 +06:00
072264faad add support of users in UsersShared 2024-04-18 14:47:22 +06:00
6b74bc155e update ChatShared 2024-04-18 14:45:06 +06:00
9d506b11a3 add support of birthdate 2024-04-18 14:43:14 +06:00
f47b3673a7 fix build 2024-04-17 16:40:58 +06:00
dbb8be502a almost completed sends with business connection id 2024-04-17 15:09:45 +06:00
170747741f remove redundant includes of business connection id in send requests 2024-04-17 13:55:37 +06:00
e4a3acdd68 start adding of support business_connection_id in sending requests 2024-04-16 23:11:01 +06:00
953bdef657 add support of personal chat, is_from_offline and can_connect_to_business 2024-04-16 22:57:07 +06:00
64ef0fa160 potentially finally add support of business chats input 2024-04-16 22:04:35 +06:00
c1f40c1030 some progress on business chats 2024-04-16 19:25:18 +06:00
8de584b292 add support of business info in chats 2024-04-16 18:43:09 +06:00
cb7bb01671 add sender_business_bot support 2024-04-16 18:37:04 +06:00
a7b2bb820b add different business entities 2024-04-16 18:29:57 +06:00
be9c0cff61 some progress in business connections support 2024-04-16 16:00:15 +06:00
6ac6ad0c0a add several abstractions of business chats 2024-04-15 21:01:52 +06:00
dbc69def0b add support of BusinessConnection 2024-04-15 17:47:18 +06:00
b8061966be almost completed adding of BusinessConnection 2024-04-15 01:19:33 +06:00
0e0af73633 start 12.0.0 2024-04-02 21:12:35 +06:00
2a2aeed045 small notice about breaking changes in 11.0.0 2024-03-18 13:54:34 +06:00
fdc007f609 Merge pull request #839 from InsanusMokrassar/11.0.0
11.0.0
2024-03-18 13:52:46 +06:00
dec55cfb2d extract different ids into external files 2024-03-16 23:09:01 +06:00
3997af171e StickerSetName now is value class 2024-03-16 23:07:55 +06:00
d963cdae35 PollId now is value class 2024-03-16 22:53:01 +06:00
8ec209422a ShippingOptionId now is value class 2024-03-16 22:47:17 +06:00
8ca86b1e14 RawChatId as value class 2024-03-16 22:40:42 +06:00
ffba4e9cef renamed several types 2024-03-16 21:21:34 +06:00
544192ad5f ShippingQueryId is value class now 2024-03-16 21:17:36 +06:00
08b0564dba extract and deprecate MessageIdentifier 2024-03-16 20:42:08 +06:00
009c49247d remove redundant includeMediaGroups from editContentMessage and editContent flows 2024-03-16 20:39:32 +06:00
dd7a3ced4d InlineMessageId is value class now 2024-03-16 20:36:48 +06:00
ceff85fcfd UpdateId is value class now 2024-03-16 20:32:28 +06:00
bb62f9fbd6 TgFileUniqueId is value class now 2024-03-16 20:21:29 +06:00
7bbbf54775 PreCheckoutQueryId is value class now 2024-03-16 20:15:56 +06:00
1b506cb820 WebAppQueryId is value class now 2024-03-16 20:10:05 +06:00
3f988d1529 CallbackQueryIdentifier is value class now 2024-03-16 20:04:19 +06:00
2da28cea01 MediaGroupIdentifier is value class now 2024-03-16 20:00:16 +06:00
42e6013d95 InlineQueryIdentifier is value class now 2024-03-16 19:56:58 +06:00
3c8dbe70dc MessageThreadId is value class now 2024-03-16 19:53:50 +06:00
4a1989fb79 MessageId is value class now 2024-03-16 19:45:23 +06:00
b559dbbe66 remove deprecations 2024-03-16 19:29:10 +06:00
d72fb6e3e8 start 11.0.0 2024-03-16 19:22:49 +06:00
092722fad8 Merge pull request #838 from InsanusMokrassar/10.1.2
10.1.2
2024-03-16 19:21:12 +06:00
63633e8891 add apiCheck step to ci/cd 2024-03-16 10:20:12 +06:00
61cdfa264e add api validator 2024-03-16 10:17:33 +06:00
6262b0581a update dependencies 2024-03-16 10:11:23 +06:00
8694b31066 start 10.1.2 2024-03-16 09:57:38 +06:00
5a541271b8 Merge pull request #833 from InsanusMokrassar/renovate/dokka
Update dokka to v1.9.20
2024-03-05 13:55:57 +06:00
renovate[bot]
9b14e9079b Update dokka to v1.9.20 2024-03-04 16:18:05 +00:00
fd26d14380 Merge pull request #831 from InsanusMokrassar/10.1.1
10.1.1
2024-03-01 23:34:05 +06:00
3ebaef0789 update korlibs 2024-03-01 23:19:05 +06:00
51bb0a021f update dependencies 2024-03-01 23:15:42 +06:00
b7c1692efa start 10.1.1 2024-03-01 23:09:12 +06:00
bce5fb658c Merge pull request #827 from InsanusMokrassar/10.1.0
10.1.0
2024-02-17 01:57:17 +06:00
b9bc40187f fixes in changelog and readme 2024-02-17 01:53:00 +06:00
3da4ee4808 make Story to be data class 2024-02-17 01:46:26 +06:00
6571e8f592 update dependencies 2024-02-16 23:29:29 +06:00
5c13047a0b add support of custom_emoji_sticker_set_name 2024-02-16 21:59:10 +06:00
4908bb2cfe add support of unrestrict_boost_count 2024-02-16 21:57:03 +06:00
a01ca43837 add support of Story content and reply_to_story field 2024-02-16 21:54:13 +06:00
a9a01e3154 add support of sender_boost_count 2024-02-16 21:38:28 +06:00
468c54a30f add support of ChatBoostAdded 2024-02-16 21:13:37 +06:00
9177e01910 start 10.1.0 2024-02-16 19:39:20 +06:00
417f72af4a Merge pull request #825 from InsanusMokrassar/10.0.1
10.0.1
2024-02-10 22:04:37 +06:00
df6d70b20d update dependencies 2024-02-10 17:31:20 +06:00
0b12df14db start 10.0.1 2024-02-06 22:49:15 +06:00
1590e1eef2 Merge pull request #818 from InsanusMokrassar/10.0.0
10.0.0 hotfix: add support of 'sender' chat type
2024-01-12 14:21:55 +06:00
6896bc0772 add support of 'sender' chat type 2024-01-12 14:21:06 +06:00
ce1abb0ae2 Merge pull request #814 from InsanusMokrassar/10.0.0
10.0.0
2024-01-12 12:45:49 +06:00
76a2cfd1a0 Merge pull request #817 from mefilt/master
Fixed incorrect link at readme
2024-01-08 16:34:38 +06:00
Mefilt
edca5494d4 Fixed incorrect link at readme 2024-01-08 18:29:59 +08:00
822 changed files with 72310 additions and 8234 deletions

2
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,3 @@
# These are supported funding model platforms # These are supported funding model platforms
custom: ['https://www.tinkoff.ru/rm/ovsyannikov.aleksey113/ObMJ712472', 'https://boosty.to/insanusmokrassar'] custom: ['https://tonscan.org/address/UQAtuSLJ76Zehc3qP-eRYMR98fPIu_oOp_atcpVX55zxHwTU']

View File

@@ -17,18 +17,20 @@ jobs:
rm gradle.properties rm gradle.properties
mv gradle.properties.tmp gradle.properties mv gradle.properties.tmp gradle.properties
- name: KotlinSymbolProcessing execution - name: KotlinSymbolProcessing execution
run: ./gradlew ksp run: ./gradlew kspCommonMainKotlinMetadata
- name: Build - name: Build
run: ./gradlew build run: ./gradlew build
- name: API compatibility check
run: ./gradlew apiCheck
- name: Publish to GithubPackages
continue-on-error: true
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Gitea - name: Publish to Gitea
continue-on-error: true continue-on-error: true
run: ./gradlew publishAllPublicationsToInmoNexusRepository run: ./gradlew publishAllPublicationsToInmoNexusRepository
env: env:
INMONEXUS_USER: ${{ secrets.INMONEXUS_USER }} INMONEXUS_USER: ${{ secrets.INMONEXUS_USER }}
INMONEXUS_PASSWORD: ${{ secrets.INMONEXUS_PASSWORD }} INMONEXUS_PASSWORD: ${{ secrets.INMONEXUS_PASSWORD }}
- name: Publish to GithubPackages
continue-on-error: true
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
env:
GITHUBPACKAGES_USER: ${{ github.actor }}
GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}

2
.gitignore vendored
View File

@@ -1,4 +1,5 @@
.idea .idea
.kotlin
out/* out/*
*.iml *.iml
target target
@@ -12,3 +13,4 @@ out/
local.properties local.properties
kotlin-js-store/ kotlin-js-store/
secret.gradle secret.gradle
.aider*

View File

@@ -1,5 +1,422 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 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**
* Add support of subscriptions links handling
* Add support of info about sender chat. **It is important, that for channels will be actual `senderChat` instead of
`from` field due to `User` type of the last one**. You also may use extensions `Message.sender_chat` or `Any.withSenderChatMessageOrNull`
to access sender chat
* Add `Reaction.Paid`
Additional changes:
* `Core`:
* Add top level interfaces `OptionallyWithUser` and `OptionallyFromUser`. Old `WithUser` and `FromUser` interfaces
extending them with following overrides of `user` and `from` fields
* `API`:
* Change order of delay and sending action in [SendActionDSL](tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/send/SendActionDSL.kt)
(thanks to [DRSchlaubi](https://github.com/DRSchlaubi), [PR #833](https://github.com/InsanusMokrassar/ktgbotapi/pull/883)).
Besides, there has been changed way to create parallel sending of action and it must not lead to memory leaks anymore
## 16.0.0
**THIS UPDATE CONTAINS KOTLIN UPDATE UP TO 2.0**
* `Version`:
* `Kotlin`: `1.9.23` -> `2.0.10`
* `Serialization`: `1.6.3` -> `1.7.1`
* `MicroUtils`: `0.21.2` -> `0.22.0`
* `KSLog`: `1.3.4` -> `1.3.5`
## 15.3.0
**THIS UPDATE CONTAINS ADDING OF SUPPORT FOR BOTS API 7.8**
* `Core`:
* `OptionallyBusinessConnectionRequest` now extends `WithOptionalBusinessConnectionId`
* Add `hasMainWebApp` in `ExtendedBot`
* `API`:
* Add `BusinessConnectionId` to pin/unpin methods
* `WebApp`:
* Add `shareToStory` in `WebApp`
## 15.2.0
* `API`:
* Enabled an `explicit mode` for `API` module ([PR #876](https://github.com/InsanusMokrassar/ktgbotapi/pull/876))
* `WebApps`:
* Built-in `onClick` and `offClick` of `MainButton` become public ([PR #875](https://github.com/InsanusMokrassar/ktgbotapi/pull/875))
* Old `MainButton.onClick` extension **has been removed** to avoid collisions of types
## 15.1.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
**THIS UPDATE CONTAINS ADDING OF SUPPORT FOR BOTS API 7.7** (thanks to [bpavuk](https://threads.net/b_pavuchok))
**THIS UPDATE CONTAINS ADDING OF SUPPORT FOR BOTS API 7.6** (with participation and help of [bpavuk](https://threads.net/b_pavuchok))
* Add support of paid media
* Update web apps
* `Version`:
* `MicroUtils`: `0.21.1` -> `0.21.2`
* `Core`:
* `TelegramMedia` has been separated onto two interfaces: `TelegramFreeMedia` and `TelegramPaidMedia`
* `TelegramFreeMedia` has replaced `TelegramMedia` on all old places where it have been used
* `Photo` has been renamed to `PhotoFile`
* `BehaviourBuilder`:
* Add notification when handling of `/privacy` command is absence
* Add several extensions to simplify setting up `/privacy` reaction
## 15.0.0
**THIS UPDATE CONTAINS BREAKING CHANGES**
**THIS UPDATE CONTAINS ADDING OF SUPPORT FOR BOTS API 7.5**
* `Version`:
* `MicroUtils`: `0.21.0` -> `0.21.1`
* A lot of `edit` methods and classes has been changed to support business connection id
## 14.1.0
* `Version`:
* `Coroutines`: `1.8.0` -> `1.8.1`
* `Ktor`: `2.3.10` -> `2.3.11`
* `MicroUtils`: `0.20.45` -> `0.21.0`
* `KSLog`: `1.3.3` -> `1.3.4`
* `BehaviourBuilder`:
* `BehaviourContext` updates listening job will be weakly subscribed. It means that `BehaviourContext` scope will
not be prevented from cancelling by this job anymore
* `BehaviourContext.doInContext` will not stop automatically current `BehaviourContext` job anymore
* `BehaviourContext.createSubContextAndDoWithUpdatesFilter` will use `supervisorScope` instead of
`LinkedSupervisorScope`. That will prevent scope leaking in runtime
## 14.0.1
* In `core` and `api` modules related to invoices changed their APIs to suite current API
## 14.0.0
**Add support of [Telegram Bots API 7.4](https://core.telegram.org/bots/api-changelog#may-28-2024)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* `TelegramPaymentChargeId` has been added as value class and replaced raw strings in `SuccessfulPayment` type of `telegramPaymentChargeId`
* All the methods/classes related to sending of messages got `effectId` parameter
* All the methods/classes related to sending of photos/animations/videos got `showCaptionAboveMedia` parameter
## 13.0.0
**Add support of [Telegram Bots API 7.3](https://core.telegram.org/bots/api-changelog#may-6-2024)**
**THIS UPDATE CONTAINS BREAKING CHANGES**
* `Core`:
* For polls, `textSources` now means `question` text sources. For `QuizPoll` there are `explanation` and `explanationTextSources`
for hinting
* `API`:
* A lot of API related to `Poll`s has been changed to include opportunity to pass `ParseMode` and `TextSource`s list
## 12.0.1
* `Version`:
* `Ktor`: `2.3.9` -> `2.3.10`
* `MicroUtils`: `0.20.39` -> `0.20.45`
* `UUID`: `0.8.2` -> `0.8.4`
## 12.0.0
**Add support of [Telegram Bots API 7.2](https://core.telegram.org/bots/api-changelog#march-31-2024)**
**THIS UPDATE CONTAINS A LOT OF BREAKING CHANGES**
## 11.0.0
**THIS UPDATE CONTAINS REMOVES OF DEPRECATED THINGS**
**THIS UPDATE CONTAINS A LOT OF BREAKING CHANGES**
* `Core`:
* `MessageId` now is `value class`. `MessageIdentifier` become deprecated
* `MessageThreadId` now is `value class`
* `InlineQueryIdentifier` now is `value class`
* `MediaGroupIdentifier` has been renamed to `MediaGroupId` and now is `value class`
* `CallbackQueryIdentifier` has been renamed to `CallbackQueryId` and now is `value class`
* `WebAppQueryId` now is `value class`
* `PreCheckoutQueryId` now is `value class`
* `FileUniqueId` has been renamed to `TgFileUniqueId` and now is `value class`
* `UpdateIdentifier` has been renamed to `UpdateId` and now is `value class`
* `InlineMessageIdentifier` has been renamed to `InlineMessageId` and now is `value class`
* `ShippingQueryIdentifier` has been renamed to `ShippingQueryId` and now is `value class`
* `Identifier` has been renamed to `RawChatId` and now is `value class`
* `ShippingOptionIdentifier` has been renamed to `ShippingOptionId` and now is `value class`
* `PollIdentifier` has been renamed to `PollId` and now is `value class`
* `StickerSetName` now is `value class`
## 10.1.2
* `Version`:
* `Kotlin`: `1.9.22` -> `1.9.23`
* `Korlibs`: `5.3.2` -> `5.4.0`
* `Ktor`: `2.3.8` -> `2.3.9`
* `MicroUtils`: `0.20.37` -> `0.20.39`
* `KSLog`: `1.3.2` -> `1.3.3`
## 10.1.1
* `Version`:
* `Serialization`: `1.6.2` -> `1.6.3`
* `MicroUtils`: `0.20.34` -> `0.20.37`
* `Korlibs`: `5.3.1` -> `5.3.2`
## 10.1.0
**Add support of [Telegram Bots API 7.1](https://core.telegram.org/bots/api-changelog#february-16-2024)**
* `Version`:
* `Coroutines`: `1.7.3` -> `1.8.0`
* `MicroUtils`: `0.20.32` -> `0.20.34`
## 10.0.1
* `Version`:
* `Ktor`: `2.3.7` -> `2.3.8`
* `MicroUtils`: `0.20.26` -> `0.20.32`
* `Korlibs`: `5.3.0` -> `5.3.1`
* `KSLog`: `1.3.1` -> `1.3.2`
## 10.0.0 ## 10.0.0
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)** **Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**

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.0-blue)](https://core.telegram.org/bots/api-changelog#december-29-2023) # 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-9.0-blue)](https://core.telegram.org/bots/api-changelog#april-11-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) | | Docs | [![KDocs](https://img.shields.io/static/v1?label=Dokka&message=KDocs&color=blue&logo=kotlin)](https://tgbotapi.inmo.dev/index.html) [![Mini tutorial](https://img.shields.io/static/v1?label=Mk&message=Docs&color=blue&logo=mkdocs)](https://docs.inmo.dev/tgbotapi/index.html) |
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| |:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
@@ -118,5 +118,5 @@ suspend fun main() {
### More examples ### More examples
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
always welcome in our [bookstack](https://bookstack.inmo.dev/books/telegrambotapi) and always welcome in our [docs](https://docs.inmo.dev/tgbotapi/index.html) and
[chat](https://t.me/InMoTelegramBotAPIChat). [chat](https://t.me/InMoTelegramBotAPIChat).

View File

@@ -1,8 +1,8 @@
buildscript { buildscript {
repositories { repositories {
mavenLocal()
mavenCentral() mavenCentral()
maven { url "https://plugins.gradle.org/m2/" } maven { url "https://plugins.gradle.org/m2/" }
mavenLocal()
} }
dependencies { dependencies {
@@ -17,15 +17,31 @@ buildscript {
plugins { plugins {
alias(libs.plugins.kotlin.dokka) alias(libs.plugins.kotlin.dokka)
alias(libs.plugins.versions) alias(libs.plugins.versions)
alias(libs.plugins.validator)
alias(libs.plugins.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')
verificationTimeout = Duration.ofSeconds(0)
publishingType = "USER_MANAGED"
}
publishAllProjectsProbablyBreakingProjectIsolation()
}
} }
// temporal crutch until legacy tests will be stabled or legacy target will be removed // temporal crutch until legacy tests will be stabled or legacy target will be removed
allprojects { allprojects {
repositories { repositories {
mavenLocal() maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
mavenCentral() mavenCentral()
google() google()
maven { url "https://nexus.inmo.dev/repository/maven-releases/" } mavenLocal()
} }
if (it != rootProject.findProject("docs")) { if (it != rootProject.findProject("docs")) {
tasks.whenTaskAdded { task -> tasks.whenTaskAdded { task ->
@@ -47,20 +63,28 @@ private String getCurrentVersionChangelog() {
return changelogDataOS.toString().trim() return changelogDataOS.toString().trim()
} }
if (new File(projectDir, "secret.gradle").exists()) {
apply from: './secret.gradle' def githubTokenVariableName = "GITHUB_RELEASE_TOKEN"
def githubTokenVariableFromEnv = System.getenv(githubTokenVariableName)
def secretFile = new File(projectDir, "secret.gradle")
if (secretFile.exists() || project.hasProperty(githubTokenVariableName) || (githubTokenVariableFromEnv != "" && githubTokenVariableFromEnv != null)) {
if (secretFile.exists()) {
apply from: './secret.gradle'
}
apply plugin: "com.github.breadmoirai.github-release" apply plugin: "com.github.breadmoirai.github-release"
def githubReleaseToken = project.hasProperty(githubTokenVariableName) ? project.property(githubTokenVariableName).toString() : githubTokenVariableFromEnv
githubRelease { githubRelease {
token "${project.property('GITHUB_RELEASE_TOKEN')}" token githubReleaseToken
owner "InsanusMokrassar" owner = "InsanusMokrassar"
repo "TelegramBotAPI" repo = "TelegramBotAPI"
tagName "v$library_version" tagName = "v$library_version"
releaseName "$library_version" releaseName = "$library_version"
targetCommitish "$library_version" targetCommitish = "$library_version"
body getCurrentVersionChangelog() body = getCurrentVersionChangelog()
} }
} }

View File

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

View File

@@ -1,8 +1,27 @@
allprojects { File templatesFolder = new File("$rootProject.projectDir.absolutePath${File.separatorChar}gradle${File.separatorChar}templates")
ext {
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle"
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

@@ -6,4 +6,4 @@ kotlin.incremental=true
kotlin.incremental.js=true kotlin.incremental.js=true
library_group=dev.inmo library_group=dev.inmo
library_version=10.0.0 library_version=25.0.1

View File

@@ -1,25 +1,28 @@
[versions] [versions]
kotlin = "1.9.22" kotlin = "2.1.20"
kotlin-serialization = "1.6.2" kotlin-serialization = "1.8.0"
kotlin-coroutines = "1.7.3" kotlin-coroutines = "1.10.1"
javax-activation = "1.1.1" javax-activation = "1.1.1"
korlibs = "5.3.0" korlibs = "5.4.0"
uuid = "0.8.2" uuid = "0.8.4"
ktor = "2.3.7" ktor = "3.1.1"
ksp = "1.9.22-1.0.16" ksp = "2.1.20-1.0.31"
kotlin-poet = "1.15.3" kotlin-poet = "1.18.1"
microutils = "0.20.26" microutils = "0.25.3"
kslog = "1.3.1" kslog = "1.4.1"
versions = "0.50.0" versions = "0.51.0"
github-release-plugin = "2.4.1" github-release-plugin = "2.5.2"
dokka = "1.9.10" dokka = "2.0.0"
validator = "0.17.0"
nmcp = "0.1.5"
[libraries] [libraries]
@@ -55,6 +58,11 @@ microutils-serialization-mapper = { module = "dev.inmo:micro_utils.serialization
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" } microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" }
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" } microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" } microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
microutils-ksp-generator = { module = "dev.inmo:micro_utils.ksp.generator", version.ref = "microutils" }
microutils-ksp-sealed = { module = "dev.inmo:micro_utils.ksp.sealed", version.ref = "microutils" }
microutils-ksp-sealed-generator = { module = "dev.inmo:micro_utils.ksp.sealed.generator", version.ref = "microutils" }
microutils-ksp-variations = { module = "dev.inmo:micro_utils.ksp.variations", version.ref = "microutils" }
microutils-ksp-variations-generator = { module = "dev.inmo:micro_utils.ksp.variations.generator", version.ref = "microutils" }
kslog = { module = "dev.inmo:kslog", version.ref = "kslog" } kslog = { module = "dev.inmo:kslog", version.ref = "kslog" }
@@ -78,3 +86,5 @@ kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" } 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,7 +1,7 @@
project.version = "$version" project.version = "$version"
project.group = "$group" project.group = "$group"
apply from: "$publishGradlePath" apply from: "$mpp_publish"
kotlin { kotlin {
js (IR) { js (IR) {
@@ -25,7 +25,6 @@ kotlin {
jsTest { jsTest {
dependencies { dependencies {
implementation libs.kotlin.test.js implementation libs.kotlin.test.js
implementation libs.kotlin.test.junit
} }
} }
} }

View File

@@ -38,7 +38,6 @@ kotlin {
jsTest { jsTest {
dependencies { dependencies {
implementation libs.kotlin.test.js implementation libs.kotlin.test.js
implementation libs.kotlin.test.junit
} }
} }
all { all {

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

@@ -0,0 +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://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 distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-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('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) {
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI")
credentials {
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
}
}
}
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)
}
}
}

View File

@@ -1 +0,0 @@
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"${project.name}","description":"${project.description}","url":"https://insanusmokrassar.github.io/TelegramBotAPI/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/TelegramBotAPI"},{"name":"InmoNexus","url":"https://nexus.inmo.dev/repository/maven-releases/"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -12,7 +12,7 @@ import io.ktor.client.engine.*
* @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO] * @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO]
* @param ktorClientConfig Config block for preconfiguring of bot [HttpClient] * @param ktorClientConfig Config block for preconfiguring of bot [HttpClient]
*/ */
data class BotBuilder internal constructor( public data class BotBuilder internal constructor(
var proxy: ProxyConfig? = null, var proxy: ProxyConfig? = null,
var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null, var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null,
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null
@@ -37,12 +37,12 @@ data class BotBuilder internal constructor(
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and * @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
* [block] * [block]
*/ */
fun buildBot( public fun buildBot(
token: String, token: String,
apiUrl: String = telegramBotAPIDefaultUrl, apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false, testServer: Boolean = false,
block: BotBuilder.() -> Unit block: BotBuilder.() -> Unit
) = telegramBot( ): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl), TelegramAPIUrlsKeeper(token, testServer, apiUrl),
BotBuilder().apply(block).createHttpClient() BotBuilder().apply(block).createHttpClient()
) )

View File

@@ -11,7 +11,7 @@ import io.ktor.client.engine.*
/** /**
* Allows to create bot using bot [urlsKeeper] and already prepared [client] * Allows to create bot using bot [urlsKeeper] and already prepared [client]
*/ */
fun telegramBot( public fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper, urlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient = HttpClient() client: HttpClient = HttpClient()
): TelegramBot = telegramBot(urlsKeeper) { ): TelegramBot = telegramBot(urlsKeeper) {
@@ -23,11 +23,11 @@ fun telegramBot(
* configure it with [clientConfig] * configure it with [clientConfig]
*/ */
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun <T: HttpClientEngineConfig> telegramBot( public inline fun <T: HttpClientEngineConfig> telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper, urlsKeeper: TelegramAPIUrlsKeeper,
clientFactory: HttpClientEngineFactory<T>, clientFactory: HttpClientEngineFactory<T>,
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {} noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
) = telegramBot( ): TelegramBot = telegramBot(
urlsKeeper, urlsKeeper,
HttpClient(clientFactory, clientConfig) HttpClient(clientFactory, clientConfig)
) )
@@ -37,11 +37,11 @@ inline fun <T: HttpClientEngineConfig> telegramBot(
* configure [HttpClient] using [clientConfig] * configure [HttpClient] using [clientConfig]
*/ */
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun telegramBot( public inline fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper, urlsKeeper: TelegramAPIUrlsKeeper,
clientEngine: HttpClientEngine, clientEngine: HttpClientEngine,
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {} noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
) = telegramBot( ): TelegramBot = telegramBot(
urlsKeeper, urlsKeeper,
HttpClient(clientEngine, clientConfig) HttpClient(clientEngine, clientConfig)
) )
@@ -51,10 +51,10 @@ inline fun telegramBot(
* [clientConfig] * [clientConfig]
*/ */
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun telegramBot( public inline fun telegramBot(
urlsKeeper: TelegramAPIUrlsKeeper, urlsKeeper: TelegramAPIUrlsKeeper,
noinline clientConfig: HttpClientConfig<*>.() -> Unit noinline clientConfig: HttpClientConfig<*>.() -> Unit
) = telegramBot( ): TelegramBot = telegramBot(
urlsKeeper, urlsKeeper,
HttpClient(clientConfig) HttpClient(clientConfig)
) )
@@ -63,7 +63,7 @@ inline fun telegramBot(
* Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client] * Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client]
*/ */
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun telegramBot( public inline fun telegramBot(
token: String, token: String,
apiUrl: String = telegramBotAPIDefaultUrl, apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false, testServer: Boolean = false,
@@ -71,13 +71,13 @@ inline fun telegramBot(
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client) ): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client)
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun <T: HttpClientEngineConfig> telegramBot( public inline fun <T: HttpClientEngineConfig> telegramBot(
token: String, token: String,
clientFactory: HttpClientEngineFactory<T>, clientFactory: HttpClientEngineFactory<T>,
apiUrl: String = telegramBotAPIDefaultUrl, apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false, testServer: Boolean = false,
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {} noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
) = telegramBot( ): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl), TelegramAPIUrlsKeeper(token, testServer, apiUrl),
clientFactory, clientFactory,
clientConfig clientConfig
@@ -88,13 +88,13 @@ inline fun <T: HttpClientEngineConfig> telegramBot(
* configure [HttpClient] using [clientConfig] * configure [HttpClient] using [clientConfig]
*/ */
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun telegramBot( public inline fun telegramBot(
token: String, token: String,
clientEngine: HttpClientEngine, clientEngine: HttpClientEngine,
apiUrl: String = telegramBotAPIDefaultUrl, apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false, testServer: Boolean = false,
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {} noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
) = telegramBot( ): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl), TelegramAPIUrlsKeeper(token, testServer, apiUrl),
clientEngine, clientEngine,
clientConfig clientConfig
@@ -105,12 +105,12 @@ inline fun telegramBot(
* [clientConfig] * [clientConfig]
*/ */
@Suppress("NOTHING_TO_INLINE") @Suppress("NOTHING_TO_INLINE")
inline fun telegramBot( public inline fun telegramBot(
token: String, token: String,
apiUrl: String = telegramBotAPIDefaultUrl, apiUrl: String = telegramBotAPIDefaultUrl,
testServer: Boolean = false, testServer: Boolean = false,
noinline clientConfig: HttpClientConfig<*>.() -> Unit noinline clientConfig: HttpClientConfig<*>.() -> Unit
) = telegramBot( ): TelegramBot = telegramBot(
TelegramAPIUrlsKeeper(token, testServer, apiUrl), TelegramAPIUrlsKeeper(token, testServer, apiUrl),
clientConfig clientConfig
) )

View File

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

View File

@@ -9,19 +9,19 @@ import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
suspend fun TelegramBot.deleteMessage( public suspend fun TelegramBot.deleteMessage(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId messageId: MessageId
) = execute( ): Boolean = execute(
DeleteMessage(chatId, messageId) DeleteMessage(chatId, messageId)
) )
suspend fun TelegramBot.deleteMessage( public suspend fun TelegramBot.deleteMessage(
chat: Chat, chat: Chat,
messageId: MessageId messageId: MessageId
) = deleteMessage(chat.id, messageId) ): Boolean = deleteMessage(chat.id, messageId)
suspend fun TelegramBot.deleteMessage( public suspend fun TelegramBot.deleteMessage(
message: AccessibleMessage message: AccessibleMessage
): Boolean { ): Boolean {
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>) val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
@@ -34,20 +34,20 @@ suspend fun TelegramBot.deleteMessage(
} }
} }
suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId messageId: MessageId
) = deleteMessage(chatId, messageId) ): Boolean = deleteMessage(chatId, messageId)
suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chat: Chat, chat: Chat,
messageId: MessageId messageId: MessageId
) = deleteMessage(chat, messageId) ): Boolean = deleteMessage(chat, messageId)
suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
message: AccessibleMessage message: AccessibleMessage
) = deleteMessage(message) ): Boolean = deleteMessage(message)
suspend fun AccessibleMessage.delete( public suspend fun AccessibleMessage.delete(
requestsExecutor: TelegramBot requestsExecutor: TelegramBot
) = requestsExecutor.deleteMessage(this) ): Boolean = requestsExecutor.deleteMessage(this)

View File

@@ -7,10 +7,10 @@ import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: List<MessageId> messageIds: List<MessageId>
) = messageIds.chunked(deleteMessagesLimit.last).map { ): Boolean = messageIds.chunked(deleteMessagesLimit.last).map {
execute( execute(
DeleteMessages( DeleteMessages(
chatId = chatId, chatId = chatId,
@@ -19,26 +19,17 @@ suspend fun TelegramBot.deleteMessages(
) )
}.all { it } }.all { it }
suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: Array<MessageId> messageIds: Array<MessageId>
) = deleteMessages( ): Boolean = deleteMessages(
chatId = chatId, chatId = chatId,
messageIds = messageIds.toList() messageIds = messageIds.toList()
) )
suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
chatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId
) = deleteMessages(
chatId = chatId,
messageIds = (listOf(firstMessageId) + messageIds.toList())
)
suspend fun TelegramBot.deleteMessages(
messagesMetas: List<Message.MetaInfo> messagesMetas: List<Message.MetaInfo>
) = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) -> ): Boolean = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
deleteMessages( deleteMessages(
chatId = chatId, chatId = chatId,
messageIds = messages.map { it.messageId } messageIds = messages.map { it.messageId }
@@ -46,33 +37,25 @@ suspend fun TelegramBot.deleteMessages(
}.all { it } }.all { it }
@JvmName("deleteMessagesWithMessages") @JvmName("deleteMessagesWithMessages")
suspend fun TelegramBot.deleteMessages( public suspend fun TelegramBot.deleteMessages(
messages: List<AccessibleMessage> messages: List<AccessibleMessage>
) = deleteMessages(messages.map { it.metaInfo }) ): Boolean = deleteMessages(messages.map { it.metaInfo })
suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: List<MessageId> messageIds: List<MessageId>
) = deleteMessages(chatId = chatId, messageIds = messageIds) ): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageIds: Array<MessageId> messageIds: Array<MessageId>
) = deleteMessages(chatId = chatId, messageIds = messageIds) ): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
chatId: ChatIdentifier,
firstMessageId: MessageId,
secondMessageId: MessageId,
vararg messageIds: MessageId
) = deleteMessages(chatId = chatId, messageIds = (listOf(firstMessageId, secondMessageId) + messageIds.toList()))
suspend fun TelegramBot.delete(
messagesMetas: List<Message.MetaInfo> messagesMetas: List<Message.MetaInfo>
) = deleteMessages(messagesMetas) ): Boolean = deleteMessages(messagesMetas)
@JvmName("deleteWithMessages") @JvmName("deleteWithMessages")
suspend fun TelegramBot.delete( public suspend fun TelegramBot.delete(
messages: List<AccessibleMessage> messages: List<AccessibleMessage>
) = deleteMessages(messages) ): Boolean = deleteMessages(messages)

View File

@@ -5,60 +5,68 @@ import dev.inmo.tgbotapi.requests.ForwardMessage
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.MessageId
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.Seconds
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
import dev.inmo.tgbotapi.types.threadId import dev.inmo.tgbotapi.types.threadId
suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = execute( ): PossiblyForwardedMessage = execute(
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent) ForwardMessage(fromChatId, toChatId, messageId, threadId, startTimestamp, disableNotification, protectContent)
) )
suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
fromChat: Chat, fromChat: Chat,
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(fromChat.id, toChatId, messageId, threadId, disableNotification, protectContent) ): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChatId, messageId, threadId, startTimestamp, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
toChat: Chat, toChat: Chat,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(fromChatId, toChat.id, messageId, threadId, disableNotification, protectContent) ): PossiblyForwardedMessage = forwardMessage(fromChatId, toChat.id, messageId, threadId, startTimestamp, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
fromChat: Chat, fromChat: Chat,
toChat: Chat, toChat: Chat,
messageId: MessageId, messageId: MessageId,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(fromChat.id, toChat.id, messageId, threadId, disableNotification, protectContent) ): PossiblyForwardedMessage = forwardMessage(fromChat.id, toChat.id, messageId, threadId, startTimestamp, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
message: AccessibleMessage, message: AccessibleMessage,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(message.chat, toChatId, message.messageId, threadId, disableNotification, protectContent) ): PossiblyForwardedMessage = forwardMessage(message.chat, toChatId, message.messageId, threadId, startTimestamp, disableNotification, protectContent)
suspend fun TelegramBot.forwardMessage( public suspend fun TelegramBot.forwardMessage(
toChat: Chat, toChat: Chat,
message: AccessibleMessage, message: AccessibleMessage,
threadId: MessageThreadId? = toChat.id.threadId, threadId: MessageThreadId? = toChat.id.threadId,
startTimestamp: Seconds? = null,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false protectContent: Boolean = false
) = forwardMessage(message.chat, toChat, message.messageId, threadId, disableNotification, protectContent) ): PossiblyForwardedMessage = forwardMessage(message.chat, toChat, message.messageId, threadId, startTimestamp, disableNotification, protectContent)

View File

@@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.message.abstracts.Message import dev.inmo.tgbotapi.types.message.abstracts.Message
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
suspend fun TelegramBot.forwardMessages( public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: List<MessageId>, messageIds: List<MessageId>,
@@ -16,7 +16,7 @@ suspend fun TelegramBot.forwardMessages(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = messageIds.chunked(forwardMessagesLimit.last).flatMap { ): List<MessageId> = messageIds.chunked(forwardMessagesLimit.last).flatMap {
execute( execute(
ForwardMessages( ForwardMessages(
toChatId = toChatId, toChatId = toChatId,
@@ -30,7 +30,7 @@ suspend fun TelegramBot.forwardMessages(
) )
} }
suspend fun TelegramBot.forwardMessages( public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: Array<MessageId>, messageIds: Array<MessageId>,
@@ -38,7 +38,7 @@ suspend fun TelegramBot.forwardMessages(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = forwardMessages( ): List<MessageId> = forwardMessages(
toChatId = toChatId, toChatId = toChatId,
fromChatId = fromChatId, fromChatId = fromChatId,
messageIds = messageIds.toList(), messageIds = messageIds.toList(),
@@ -48,33 +48,14 @@ suspend fun TelegramBot.forwardMessages(
removeCaption = removeCaption removeCaption = removeCaption
) )
suspend fun TelegramBot.forwardMessages( public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
fromChatId = fromChatId,
messageIds = (listOf(firstMessageId) + messageIds.toList()),
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>, messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) -> ): List<MessageId> = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
forwardMessages( forwardMessages(
toChatId = toChatId, toChatId = toChatId,
fromChatId = chatId, fromChatId = chatId,
@@ -87,14 +68,14 @@ suspend fun TelegramBot.forwardMessages(
} }
@JvmName("forwardMessagesWithMessages") @JvmName("forwardMessagesWithMessages")
suspend fun TelegramBot.forwardMessages( public suspend fun TelegramBot.forwardMessages(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messages: List<AccessibleMessage>, messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = forwardMessages( ): List<MessageId> = forwardMessages(
toChatId = toChatId, toChatId = toChatId,
messagesMetas = messages.map { it.metaInfo }, messagesMetas = messages.map { it.metaInfo },
threadId = threadId, threadId = threadId,
@@ -103,7 +84,7 @@ suspend fun TelegramBot.forwardMessages(
removeCaption = removeCaption removeCaption = removeCaption
) )
suspend fun TelegramBot.forward( public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: List<MessageId>, messageIds: List<MessageId>,
@@ -111,7 +92,7 @@ suspend fun TelegramBot.forward(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = forwardMessages( ): List<MessageId> = forwardMessages(
toChatId = toChatId, toChatId = toChatId,
fromChatId = fromChatId, fromChatId = fromChatId,
messageIds = messageIds, messageIds = messageIds,
@@ -121,7 +102,7 @@ suspend fun TelegramBot.forward(
removeCaption = removeCaption removeCaption = removeCaption
) )
suspend fun TelegramBot.forward( public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
fromChatId: ChatIdentifier, fromChatId: ChatIdentifier,
messageIds: Array<MessageId>, messageIds: Array<MessageId>,
@@ -129,7 +110,7 @@ suspend fun TelegramBot.forward(
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = forwardMessages( ): List<MessageId> = forwardMessages(
toChatId = toChatId, toChatId = toChatId,
fromChatId = fromChatId, fromChatId = fromChatId,
messageIds = messageIds, messageIds = messageIds,
@@ -139,34 +120,14 @@ suspend fun TelegramBot.forward(
removeCaption = removeCaption removeCaption = removeCaption
) )
suspend fun TelegramBot.forward( public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier,
fromChatId: ChatIdentifier,
firstMessageId: MessageId,
vararg messageIds: MessageId,
threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
) = forwardMessages(
toChatId = toChatId,
fromChatId = fromChatId,
firstMessageId = firstMessageId,
messageIds = *messageIds,
threadId = threadId,
disableNotification = disableNotification,
protectContent = protectContent,
removeCaption = removeCaption
)
suspend fun TelegramBot.forward(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messagesMetas: List<Message.MetaInfo>, messagesMetas: List<Message.MetaInfo>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = forwardMessages( ): List<MessageId> = forwardMessages(
toChatId = toChatId, toChatId = toChatId,
messagesMetas = messagesMetas, messagesMetas = messagesMetas,
threadId = threadId, threadId = threadId,
@@ -176,14 +137,14 @@ suspend fun TelegramBot.forward(
) )
@JvmName("forwardWithMessages") @JvmName("forwardWithMessages")
suspend fun TelegramBot.forward( public suspend fun TelegramBot.forward(
toChatId: ChatIdentifier, toChatId: ChatIdentifier,
messages: List<AccessibleMessage>, messages: List<AccessibleMessage>,
threadId: MessageThreadId? = toChatId.threadId, threadId: MessageThreadId? = toChatId.threadId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
removeCaption: Boolean = false removeCaption: Boolean = false
) = forwardMessages( ): List<MessageId> = forwardMessages(
toChatId = toChatId, toChatId = toChatId,
messages = messages, messages = messages,
threadId = threadId, threadId = threadId,

View File

@@ -5,22 +5,22 @@ import dev.inmo.tgbotapi.requests.GetUpdates
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.update.abstracts.Update import dev.inmo.tgbotapi.types.update.abstracts.Update
suspend fun TelegramBot.getUpdates( public suspend fun TelegramBot.getUpdates(
offset: UpdateIdentifier? = null, offset: UpdateId? = null,
limit: Int = getUpdatesLimit.last, limit: Int = getUpdatesLimit.last,
timeout: Seconds? = null, timeout: Seconds? = null,
allowed_updates: List<String>? = ALL_UPDATES_LIST allowed_updates: List<String>? = ALL_UPDATES_LIST
) = execute( ): List<Update> = execute(
GetUpdates( GetUpdates(
offset, limit, timeout, allowed_updates offset, limit, timeout, allowed_updates
) )
) )
suspend fun TelegramBot.getUpdates( public suspend fun TelegramBot.getUpdates(
lastUpdate: Update, lastUpdate: Update,
limit: Int = getUpdatesLimit.last, limit: Int = getUpdatesLimit.last,
timeout: Seconds? = null, timeout: Seconds? = null,
allowed_updates: List<String>? = ALL_UPDATES_LIST allowed_updates: List<String>? = ALL_UPDATES_LIST
) = getUpdates( ): List<Update> = getUpdates(
lastUpdate.updateId + 1, limit, timeout, allowed_updates lastUpdate.updateId + 1, limit, timeout, allowed_updates
) )

View File

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

View File

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

View File

@@ -1,30 +1,38 @@
package dev.inmo.tgbotapi.extensions.api package dev.inmo.tgbotapi.extensions.api
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
import dev.inmo.tgbotapi.abstracts.* import dev.inmo.tgbotapi.abstracts.Headed
import dev.inmo.tgbotapi.abstracts.HorizontallyAccured
import dev.inmo.tgbotapi.abstracts.Locationed
import dev.inmo.tgbotapi.abstracts.ProximityAlertable
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.extensions.api.edit.edit import dev.inmo.tgbotapi.extensions.api.edit.edit
import dev.inmo.tgbotapi.extensions.api.send.send import dev.inmo.tgbotapi.extensions.api.send.send
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.location.LiveLocation import dev.inmo.tgbotapi.types.location.LiveLocation
import dev.inmo.tgbotapi.types.location.Location import dev.inmo.tgbotapi.types.location.Location
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
import dev.inmo.tgbotapi.types.message.content.LiveLocationContent
import dev.inmo.tgbotapi.types.message.content.LocationContent import dev.inmo.tgbotapi.types.message.content.LocationContent
import kotlinx.coroutines.* import kotlinx.coroutines.CoroutineStart
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.FlowCollector import kotlinx.coroutines.flow.FlowCollector
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.isActive
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
import kotlin.js.JsName import kotlin.js.JsName
import kotlin.jvm.JvmName import kotlin.jvm.JvmName
import kotlin.math.ceil import kotlin.math.ceil
@Serializable @Serializable
data class EditLiveLocationInfo( public data class EditLiveLocationInfo(
override val latitude: Double, override val latitude: Double,
override val longitude: Double, override val longitude: Double,
override val horizontalAccuracy: Meters? = null, override val horizontalAccuracy: Meters? = null,
@@ -37,39 +45,54 @@ data class EditLiveLocationInfo(
* Will [sendLiveLocation] with the first [EditLiveLocationInfo] data and update than. Each [liveTimeMillis] passing, * Will [sendLiveLocation] with the first [EditLiveLocationInfo] data and update than. Each [liveTimeMillis] passing,
* the message will be sent again and new edits will be applied to the new message * the message will be sent again and new edits will be applied to the new message
*/ */
suspend fun TelegramBot.handleLiveLocation( public suspend fun TelegramBot.handleLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
locationsFlow: Flow<EditLiveLocationInfo>, locationsFlow: Flow<EditLiveLocationInfo>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) { ) {
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null var currentLiveLocationMessage: ContentMessage<LiveLocationContent>? = null
val updateMessageJob = CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) { val updateMessageJob = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { // do not launch refreshing of message for indefinite live locations
while (isActive) { null
delay(liveTimeMillis) } else {
// Remove previous location message info to resend live location message val scope = currentCoroutineContext().LinkedSupervisorScope()
currentLiveLocationMessage = null scope.launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
while (scope.isActive) {
delay(liveTimeMillis)
// Remove previous location message info to resend live location message
currentLiveLocationMessage = null
}
} }
} }
locationsFlow.collect { locationsFlow.collect {
val capturedLiveLocationMessage = currentLiveLocationMessage val capturedLiveLocationMessage = currentLiveLocationMessage
if (capturedLiveLocationMessage == null) { if (capturedLiveLocationMessage == null) {
updateMessageJob.start() updateMessageJob ?.start()
currentLiveLocationMessage = send( currentLiveLocationMessage = send(
chatId, chatId,
it.latitude, it.latitude,
it.longitude, it.longitude,
ceil(liveTimeMillis.toDouble() / 1000).toInt(), if (liveTimeMillis == indefiniteLivePeriodDelayMillis) {
LiveLocation.INDEFINITE_LIVE_PERIOD
} else {
ceil(liveTimeMillis.toDouble() / 1000).toInt()
},
it.horizontalAccuracy, it.horizontalAccuracy,
it.heading, it.heading,
it.proximityAlertRadius, it.proximityAlertRadius,
threadId, threadId,
businessConnectionId,
disableNotification, disableNotification,
protectContent, protectContent,
allowPaidBroadcast,
effectId,
replyParameters, replyParameters,
it.replyMarkup it.replyMarkup
).also { ).also {
@@ -77,13 +100,13 @@ suspend fun TelegramBot.handleLiveLocation(
} }
} else { } else {
edit( edit(
capturedLiveLocationMessage, message = capturedLiveLocationMessage,
it.latitude, latitude = it.latitude,
it.longitude, longitude = it.longitude,
it.horizontalAccuracy, horizontalAccuracy = it.horizontalAccuracy,
it.heading, heading = it.heading,
it.proximityAlertRadius, proximityAlertRadius = it.proximityAlertRadius,
it.replyMarkup replyMarkup = it.replyMarkup
).also { ).also {
sentMessageFlow ?.emit(it) sentMessageFlow ?.emit(it)
} }
@@ -97,19 +120,22 @@ suspend fun TelegramBot.handleLiveLocation(
*/ */
@JvmName("handleLiveLocationWithLocation") @JvmName("handleLiveLocationWithLocation")
@JsName("handleLiveLocationWithLocation") @JsName("handleLiveLocationWithLocation")
suspend fun TelegramBot.handleLiveLocation( public suspend fun TelegramBot.handleLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
locationsFlow: Flow<Location>, locationsFlow: Flow<Location>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) { ) {
handleLiveLocation( handleLiveLocation(
chatId, chatId = chatId,
locationsFlow.map { locationsFlow = locationsFlow.map {
EditLiveLocationInfo( EditLiveLocationInfo(
it.latitude, it.latitude,
it.longitude, it.longitude,
@@ -119,12 +145,15 @@ suspend fun TelegramBot.handleLiveLocation(
(it as? WithReplyMarkup) ?.replyMarkup as? InlineKeyboardMarkup (it as? WithReplyMarkup) ?.replyMarkup as? InlineKeyboardMarkup
) )
}, },
liveTimeMillis, liveTimeMillis = liveTimeMillis,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
replyParameters, protectContent = protectContent,
sentMessageFlow allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
) )
} }
@@ -134,29 +163,35 @@ suspend fun TelegramBot.handleLiveLocation(
*/ */
@JvmName("handleLiveLocationWithLatLong") @JvmName("handleLiveLocationWithLatLong")
@JsName("handleLiveLocationWithLatLong") @JsName("handleLiveLocationWithLatLong")
suspend fun TelegramBot.handleLiveLocation( public suspend fun TelegramBot.handleLiveLocation(
chatId: ChatIdentifier, chatId: ChatIdentifier,
locationsFlow: Flow<Pair<Double, Double>>, locationsFlow: Flow<Pair<Double, Double>>,
liveTimeMillis: Long = defaultLivePeriodDelayMillis, liveTimeMillis: Long = defaultLivePeriodDelayMillis,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
) { ) {
handleLiveLocation( handleLiveLocation(
chatId, chatId = chatId,
locationsFlow.map { (lat, long) -> locationsFlow = locationsFlow.map { (lat, long) ->
EditLiveLocationInfo( EditLiveLocationInfo(
lat, lat,
long long
) )
}, },
liveTimeMillis, liveTimeMillis = liveTimeMillis,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
replyParameters, protectContent = protectContent,
sentMessageFlow allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
sentMessageFlow = sentMessageFlow
) )
} }

View File

@@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
import dev.inmo.tgbotapi.requests.send.SendLiveLocation import dev.inmo.tgbotapi.requests.send.SendLiveLocation
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
@@ -22,12 +23,13 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlin.math.ceil import kotlin.math.ceil
val defaultLivePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L public const val indefiniteLivePeriodDelayMillis: Long = LiveLocation.INDEFINITE_LIVE_PERIOD * 1000L
public const val defaultLivePeriodDelayMillis: Long = indefiniteLivePeriodDelayMillis
/** /**
* @see startLiveLocation * @see startLiveLocation
*/ */
class LiveLocationProvider internal constructor( public class LiveLocationProvider internal constructor(
private val requestsExecutor: TelegramBot, private val requestsExecutor: TelegramBot,
scope: CoroutineScope, scope: CoroutineScope,
autoCloseTimeDelay: Double, autoCloseTimeDelay: Double,
@@ -39,23 +41,23 @@ class LiveLocationProvider internal constructor(
} }
} }
private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay) private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay)
val leftUntilCloseMillis: TimeSpan public val leftUntilCloseMillis: TimeSpan
get() = autoCloseTime - DateTime.now() get() = autoCloseTime - DateTime.now()
var isClosed: Boolean = false public var isClosed: Boolean = false
private set private set
get() = field || leftUntilCloseMillis.millisecondsLong < 0L get() = field || leftUntilCloseMillis.millisecondsLong < 0L
var message: ContentMessage<LocationContent> = initMessage public var message: ContentMessage<LocationContent> = initMessage
private set private set
val lastLocation: LiveLocation public val lastLocation: LiveLocation
get() = message.content.location as LiveLocation get() = message.content.location as LiveLocation
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that * as a builder for that
*/ */
suspend fun updateLocation( public suspend fun updateLocation(
location: LiveLocation, location: LiveLocation,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
): LiveLocation { ): LiveLocation {
@@ -63,7 +65,7 @@ class LiveLocationProvider internal constructor(
message = requestsExecutor.editLiveLocation( message = requestsExecutor.editLiveLocation(
message, message,
location, location,
replyMarkup replyMarkup = replyMarkup
) )
return lastLocation return lastLocation
} else { } else {
@@ -84,7 +86,7 @@ class LiveLocationProvider internal constructor(
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
suspend fun TelegramBot.startLiveLocation( public suspend fun TelegramBot.startLiveLocation(
scope: CoroutineScope, scope: CoroutineScope,
chatId: ChatIdentifier, chatId: ChatIdentifier,
latitude: Double, latitude: Double,
@@ -94,26 +96,32 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider { ): LiveLocationProvider {
val liveTimeAsDouble = liveTimeMillis.toDouble() val liveTimeAsDouble = liveTimeMillis.toDouble()
val locationMessage = execute( val locationMessage = execute(
SendLiveLocation( SendLiveLocation(
chatId, chatId = chatId,
latitude, latitude = latitude,
longitude, longitude = longitude,
ceil(liveTimeAsDouble / 1000).toInt(), livePeriod = ceil(liveTimeAsDouble / 1000).toInt(),
initHorizontalAccuracy, horizontalAccuracy = initHorizontalAccuracy,
initHeading, heading = initHeading,
initProximityAlertRadius, proximityAlertRadius = initProximityAlertRadius,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
replyParameters, protectContent = protectContent,
replyMarkup allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
) )
@@ -129,7 +137,7 @@ suspend fun TelegramBot.startLiveLocation(
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
suspend fun TelegramBot.startLiveLocation( public suspend fun TelegramBot.startLiveLocation(
scope: CoroutineScope, scope: CoroutineScope,
chat: Chat, chat: Chat,
latitude: Double, latitude: Double,
@@ -139,31 +147,37 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope = scope,
chat.id, chatId = chat.id,
latitude, latitude = latitude,
longitude, longitude = longitude,
liveTimeMillis, liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy, initHorizontalAccuracy = initHorizontalAccuracy,
initHeading, initHeading = initHeading,
initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
replyParameters, protectContent = protectContent,
replyMarkup allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
suspend fun TelegramBot.startLiveLocation( public suspend fun TelegramBot.startLiveLocation(
scope: CoroutineScope, scope: CoroutineScope,
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
location: StaticLocation, location: StaticLocation,
@@ -172,31 +186,37 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chatId.threadId, threadId: MessageThreadId? = chatId.threadId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope = scope,
chatId, chatId = chatId,
location.latitude, latitude = location.latitude,
location.longitude, longitude = location.longitude,
liveTimeMillis, liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy, initHorizontalAccuracy = initHorizontalAccuracy,
initHeading, initHeading = initHeading,
initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
replyParameters, protectContent = protectContent,
replyMarkup allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
suspend fun TelegramBot.startLiveLocation( public suspend fun TelegramBot.startLiveLocation(
scope: CoroutineScope, scope: CoroutineScope,
chat: Chat, chat: Chat,
location: StaticLocation, location: StaticLocation,
@@ -205,31 +225,37 @@ suspend fun TelegramBot.startLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = chat.id.threadId, threadId: MessageThreadId? = chat.id.threadId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
replyParameters: ReplyParameters? = null, replyParameters: ReplyParameters? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
): LiveLocationProvider = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope = scope,
chat.id, chatId = chat.id,
location.latitude, latitude = location.latitude,
location.longitude, longitude = location.longitude,
liveTimeMillis, liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy, initHorizontalAccuracy = initHorizontalAccuracy,
initHeading, initHeading = initHeading,
initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
replyParameters, protectContent = protectContent,
replyMarkup allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = replyParameters,
replyMarkup = replyMarkup
) )
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
suspend inline fun TelegramBot.replyWithLiveLocation( public suspend inline fun TelegramBot.replyWithLiveLocation(
to: AccessibleMessage, to: AccessibleMessage,
scope: CoroutineScope, scope: CoroutineScope,
latitude: Double, latitude: Double,
@@ -239,31 +265,37 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull, threadId: MessageThreadId? = to.threadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope = scope,
to.chat, chat = to.chat,
latitude, latitude = latitude,
longitude, longitude = longitude,
liveTimeMillis, liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy, initHorizontalAccuracy = initHorizontalAccuracy,
initHeading, initHeading = initHeading,
initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), protectContent = protectContent,
replyMarkup allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
) )
/** /**
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or * @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param * [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
*/ */
suspend inline fun TelegramBot.replyWithLiveLocation( public suspend inline fun TelegramBot.replyWithLiveLocation(
to: AccessibleMessage, to: AccessibleMessage,
scope: CoroutineScope, scope: CoroutineScope,
location: StaticLocation, location: StaticLocation,
@@ -272,21 +304,27 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
initHeading: Degrees? = null, initHeading: Degrees? = null,
initProximityAlertRadius: Meters? = null, initProximityAlertRadius: Meters? = null,
threadId: MessageThreadId? = to.threadIdOrNull, threadId: MessageThreadId? = to.threadIdOrNull,
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
disableNotification: Boolean = false, disableNotification: Boolean = false,
protectContent: Boolean = false, protectContent: Boolean = false,
allowPaidBroadcast: Boolean = false,
effectId: EffectId? = null,
allowSendingWithoutReply: Boolean? = null, allowSendingWithoutReply: Boolean? = null,
replyMarkup: KeyboardMarkup? = null replyMarkup: KeyboardMarkup? = null
) = startLiveLocation( ): LiveLocationProvider = startLiveLocation(
scope, scope = scope,
to.chat, chat = to.chat,
location, location = location,
liveTimeMillis, liveTimeMillis = liveTimeMillis,
initHorizontalAccuracy, initHorizontalAccuracy = initHorizontalAccuracy,
initHeading, initHeading = initHeading,
initProximityAlertRadius, initProximityAlertRadius = initProximityAlertRadius,
threadId, threadId = threadId,
disableNotification, businessConnectionId = businessConnectionId,
protectContent, disableNotification = disableNotification,
ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply), protectContent = protectContent,
replyMarkup allowPaidBroadcast = allowPaidBroadcast,
effectId = effectId,
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
replyMarkup = replyMarkup
) )

View File

@@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.local.LogOut import dev.inmo.tgbotapi.requests.local.LogOut
suspend inline fun TelegramBot.logOut() = execute(LogOut) public suspend inline fun TelegramBot.logOut(): Boolean = execute(LogOut)

View File

@@ -3,48 +3,54 @@ package dev.inmo.tgbotapi.extensions.api
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.StopPoll import dev.inmo.tgbotapi.requests.StopPoll
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
import dev.inmo.tgbotapi.types.polls.Poll
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.stopPoll( public suspend fun TelegramBot.stopPoll(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageId: MessageId, messageId: MessageId,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = execute( ): Poll = execute(
StopPoll(chatId, messageId, replyMarkup) StopPoll(chatId, messageId, businessConnectionId, replyMarkup)
) )
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.stopPoll( public suspend fun TelegramBot.stopPoll(
chat: Chat, chat: Chat,
messageId: MessageId, messageId: MessageId,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = stopPoll(chat.id, messageId, replyMarkup) ): Poll = stopPoll(chat.id, messageId, businessConnectionId, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.stopPoll( public suspend fun TelegramBot.stopPoll(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
message: AccessibleMessage, message: AccessibleMessage,
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = stopPoll(chatId, message.messageId, replyMarkup) ): Poll = stopPoll(chatId, message.messageId, businessConnectionId, replyMarkup)
/** /**
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] * @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
* as a builder for that * as a builder for that
*/ */
suspend fun TelegramBot.stopPoll( public suspend fun TelegramBot.stopPoll(
chat: Chat, chat: Chat,
message: AccessibleMessage, message: AccessibleMessage,
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
replyMarkup: InlineKeyboardMarkup? = null replyMarkup: InlineKeyboardMarkup? = null
) = stopPoll(chat.id, message.messageId, replyMarkup) ): Poll = stopPoll(chat.id, message.messageId, businessConnectionId, replyMarkup)

View File

@@ -3,28 +3,28 @@ package dev.inmo.tgbotapi.extensions.api.answers
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier import dev.inmo.tgbotapi.types.CallbackQueryId
suspend fun TelegramBot.answerCallbackQuery( public suspend fun TelegramBot.answerCallbackQuery(
callbackQueryId: CallbackQueryIdentifier, callbackQueryId: CallbackQueryId,
text: String? = null, text: String? = null,
showAlert: Boolean? = null, showAlert: Boolean? = null,
url: String? = null, url: String? = null,
cachedTimeSeconds: Int? = null cachedTimeSeconds: Int? = null
) = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds)) ): Boolean = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds))
suspend fun TelegramBot.answerCallbackQuery( public suspend fun TelegramBot.answerCallbackQuery(
callbackQuery: CallbackQuery, callbackQuery: CallbackQuery,
text: String? = null, text: String? = null,
showAlert: Boolean? = null, showAlert: Boolean? = null,
url: String? = null, url: String? = null,
cachedTimeSeconds: Int? = null cachedTimeSeconds: Int? = null
) = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds) ): Boolean = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
suspend fun TelegramBot.answer( public suspend fun TelegramBot.answer(
callbackQuery: CallbackQuery, callbackQuery: CallbackQuery,
text: String? = null, text: String? = null,
showAlert: Boolean? = null, showAlert: Boolean? = null,
url: String? = null, url: String? = null,
cachedTimeSeconds: Int? = null cachedTimeSeconds: Int? = null
) = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds) ): Boolean = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)

View File

@@ -5,50 +5,50 @@ import dev.inmo.tgbotapi.requests.answers.AnswerInlineQuery
import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
import dev.inmo.tgbotapi.types.InlineQueryIdentifier import dev.inmo.tgbotapi.types.InlineQueryId
suspend fun TelegramBot.answerInlineQuery( public suspend fun TelegramBot.answerInlineQuery(
inlineQueryID: InlineQueryIdentifier, inlineQueryID: InlineQueryId,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
nextOffset: String? = null, nextOffset: String? = null,
button: InlineQueryResultsButton? = null button: InlineQueryResultsButton? = null
) = execute( ): Boolean = execute(
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button) AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button)
) )
suspend fun TelegramBot.answerInlineQuery( public suspend fun TelegramBot.answerInlineQuery(
inlineQuery: InlineQuery, inlineQuery: InlineQuery,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
nextOffset: String? = null, nextOffset: String? = null,
button: InlineQueryResultsButton? = null button: InlineQueryResultsButton? = null
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
suspend fun TelegramBot.answer( public suspend fun TelegramBot.answer(
inlineQuery: InlineQuery, inlineQuery: InlineQuery,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
nextOffset: String? = null, nextOffset: String? = null,
button: InlineQueryResultsButton? = null button: InlineQueryResultsButton? = null
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
suspend fun TelegramBot.answerInlineQuery( public suspend fun TelegramBot.answerInlineQuery(
inlineQueryID: InlineQueryIdentifier, inlineQueryID: InlineQueryId,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
isPersonal: Boolean? = null, isPersonal: Boolean? = null,
nextOffset: String? = null, nextOffset: String? = null,
switchPmText: String?, switchPmText: String?,
switchPmParameter: String? switchPmParameter: String?
) = execute( ): Boolean = execute(
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
) )
suspend fun TelegramBot.answerInlineQuery( public suspend fun TelegramBot.answerInlineQuery(
inlineQuery: InlineQuery, inlineQuery: InlineQuery,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
@@ -56,9 +56,9 @@ suspend fun TelegramBot.answerInlineQuery(
nextOffset: String? = null, nextOffset: String? = null,
switchPmText: String?, switchPmText: String?,
switchPmParameter: String? switchPmParameter: String?
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
suspend fun TelegramBot.answer( public suspend fun TelegramBot.answer(
inlineQuery: InlineQuery, inlineQuery: InlineQuery,
results: List<InlineQueryResult> = emptyList(), results: List<InlineQueryResult> = emptyList(),
cachedTime: Int? = null, cachedTime: Int? = null,
@@ -66,4 +66,4 @@ suspend fun TelegramBot.answer(
nextOffset: String? = null, nextOffset: String? = null,
switchPmText: String?, switchPmText: String?,
switchPmParameter: String? switchPmParameter: String?
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter) ): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)

View File

@@ -4,13 +4,14 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.answers.AnswerWebAppQuery import dev.inmo.tgbotapi.requests.answers.AnswerWebAppQuery
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import dev.inmo.tgbotapi.types.WebAppQueryId import dev.inmo.tgbotapi.types.WebAppQueryId
import dev.inmo.tgbotapi.types.webapps.query.SentWebAppMessage
suspend fun TelegramBot.answerWebAppQuery( public suspend fun TelegramBot.answerWebAppQuery(
webAppQueryId: WebAppQueryId, webAppQueryId: WebAppQueryId,
result: InlineQueryResult result: InlineQueryResult
) = execute(AnswerWebAppQuery(webAppQueryId, result)) ): SentWebAppMessage = execute(AnswerWebAppQuery(webAppQueryId, result))
suspend fun TelegramBot.answer( public suspend fun TelegramBot.answer(
webAppQueryId: WebAppQueryId, webAppQueryId: WebAppQueryId,
result: InlineQueryResult result: InlineQueryResult
) = execute(AnswerWebAppQuery(webAppQueryId, result)) ): SentWebAppMessage = execute(AnswerWebAppQuery(webAppQueryId, result))

View File

@@ -6,18 +6,18 @@ import dev.inmo.tgbotapi.requests.answers.payments.AnswerPreCheckoutQueryOk
import dev.inmo.tgbotapi.types.PreCheckoutQueryId import dev.inmo.tgbotapi.types.PreCheckoutQueryId
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
suspend fun TelegramBot.answerPreCheckoutQueryOk( public suspend fun TelegramBot.answerPreCheckoutQueryOk(
id: PreCheckoutQueryId id: PreCheckoutQueryId
) = execute(AnswerPreCheckoutQueryOk(id)) ): Boolean = execute(AnswerPreCheckoutQueryOk(id))
suspend fun TelegramBot.answerPreCheckoutQueryOk( public suspend fun TelegramBot.answerPreCheckoutQueryOk(
preCheckoutQuery: PreCheckoutQuery preCheckoutQuery: PreCheckoutQuery
) = answerPreCheckoutQueryOk(preCheckoutQuery.id) ): Boolean = answerPreCheckoutQueryOk(preCheckoutQuery.id)
suspend fun TelegramBot.answerPreCheckoutQueryError( public suspend fun TelegramBot.answerPreCheckoutQueryError(
id: PreCheckoutQueryId, id: PreCheckoutQueryId,
error: String error: String
) = execute(AnswerPreCheckoutQueryError(id, error)) ): Boolean = execute(AnswerPreCheckoutQueryError(id, error))
suspend fun TelegramBot.answerPreCheckoutQueryError( public suspend fun TelegramBot.answerPreCheckoutQueryError(
preCheckoutQuery: PreCheckoutQuery, preCheckoutQuery: PreCheckoutQuery,
error: String error: String
) = answerPreCheckoutQueryError(preCheckoutQuery.id, error) ): Boolean = answerPreCheckoutQueryError(preCheckoutQuery.id, error)

View File

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

View File

@@ -3,10 +3,10 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.ClearMyDefaultAdministratorRights import dev.inmo.tgbotapi.requests.bot.ClearMyDefaultAdministratorRights
suspend fun TelegramBot.clearMyDefaultAdministratorRights( public suspend fun TelegramBot.clearMyDefaultAdministratorRights(
forChannels: Boolean? = null forChannels: Boolean? = null
) = execute(ClearMyDefaultAdministratorRights(forChannels)) ): Boolean = execute(ClearMyDefaultAdministratorRights(forChannels))
suspend fun TelegramBot.clearMyDefaultAdministratorRightsForChannels() = clearMyDefaultAdministratorRights(forChannels = true) public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForChannels(): Boolean = clearMyDefaultAdministratorRights(forChannels = true)
suspend fun TelegramBot.clearMyDefaultAdministratorRightsForGroupsAndSupergroups() = clearMyDefaultAdministratorRights(forChannels = false) public suspend fun TelegramBot.clearMyDefaultAdministratorRightsForGroupsAndSupergroups(): Boolean = clearMyDefaultAdministratorRights(forChannels = false)

View File

@@ -6,12 +6,12 @@ import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
import dev.inmo.tgbotapi.types.commands.BotCommandScope import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.deleteMyCommands( public suspend fun TelegramBot.deleteMyCommands(
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLang? languageCode: IetfLang?
) = execute(DeleteMyCommands(scope, languageCode)) ): Boolean = execute(DeleteMyCommands(scope, languageCode))
suspend fun TelegramBot.deleteMyCommands( public suspend fun TelegramBot.deleteMyCommands(
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null languageCode: String? = null
) = deleteMyCommands(scope, languageCode ?.let(::IetfLang)) ): Boolean = deleteMyCommands(scope, languageCode ?.let(::IetfLang))

View File

@@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.GetMe import dev.inmo.tgbotapi.requests.bot.GetMe
import dev.inmo.tgbotapi.types.chat.ExtendedBot
suspend fun TelegramBot.getMe() = execute(GetMe) public suspend fun TelegramBot.getMe(): ExtendedBot = execute(GetMe)

View File

@@ -3,15 +3,16 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.micro_utils.language_codes.IetfLang import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.GetMyCommands import dev.inmo.tgbotapi.requests.bot.GetMyCommands
import dev.inmo.tgbotapi.types.BotCommand
import dev.inmo.tgbotapi.types.commands.BotCommandScope import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.getMyCommands( public suspend fun TelegramBot.getMyCommands(
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLang? = null languageCode: IetfLang? = null
) = execute(GetMyCommands(scope, languageCode)) ): List<BotCommand> = execute(GetMyCommands(scope, languageCode))
suspend fun TelegramBot.getMyCommands( public suspend fun TelegramBot.getMyCommands(
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? languageCode: String?
) = getMyCommands(scope, languageCode ?.let(::IetfLang)) ): List<BotCommand> = getMyCommands(scope, languageCode ?.let(::IetfLang))

View File

@@ -2,11 +2,12 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.GetMyDefaultAdministratorRights import dev.inmo.tgbotapi.requests.bot.GetMyDefaultAdministratorRights
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
suspend fun TelegramBot.getMyDefaultAdministratorRights( public suspend fun TelegramBot.getMyDefaultAdministratorRights(
forChannels: Boolean? = null forChannels: Boolean? = null
) = execute(GetMyDefaultAdministratorRights(forChannels)) ): AdministratorChatMember = execute(GetMyDefaultAdministratorRights(forChannels))
suspend fun TelegramBot.getMyDefaultAdministratorRightsForChannels() = getMyDefaultAdministratorRights(forChannels = true) public suspend fun TelegramBot.getMyDefaultAdministratorRightsForChannels(): AdministratorChatMember = getMyDefaultAdministratorRights(forChannels = true)
suspend fun TelegramBot.getMyDefaultAdministratorRightsForGroupsAndSupergroups() = getMyDefaultAdministratorRights(forChannels = false) public suspend fun TelegramBot.getMyDefaultAdministratorRightsForGroupsAndSupergroups(): AdministratorChatMember = getMyDefaultAdministratorRights(forChannels = false)

View File

@@ -3,11 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.micro_utils.language_codes.IetfLang import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.GetMyDescription import dev.inmo.tgbotapi.requests.bot.GetMyDescription
import dev.inmo.tgbotapi.types.BotDescription
suspend fun TelegramBot.getMyDescription( public suspend fun TelegramBot.getMyDescription(
languageCode: IetfLang? = null languageCode: IetfLang? = null
) = execute(GetMyDescription(languageCode)) ): BotDescription = execute(GetMyDescription(languageCode))
suspend fun TelegramBot.getMyDescription( public suspend fun TelegramBot.getMyDescription(
languageCode: String? languageCode: String?
) = getMyDescription(languageCode ?.let(::IetfLang)) ): BotDescription = getMyDescription(languageCode ?.let(::IetfLang))

View File

@@ -3,11 +3,12 @@ package dev.inmo.tgbotapi.extensions.api.bot
import dev.inmo.micro_utils.language_codes.IetfLang import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.GetMyName import dev.inmo.tgbotapi.requests.bot.GetMyName
import dev.inmo.tgbotapi.types.BotName
suspend fun TelegramBot.getMyName( public suspend fun TelegramBot.getMyName(
languageCode: IetfLang? = null languageCode: IetfLang? = null
) = execute(GetMyName(languageCode)) ): BotName = execute(GetMyName(languageCode))
suspend fun TelegramBot.getMyName( public suspend fun TelegramBot.getMyName(
languageCode: String? languageCode: String?
) = getMyName(languageCode ?.let(::IetfLang)) ): BotName = getMyName(languageCode ?.let(::IetfLang))

View File

@@ -4,13 +4,14 @@ import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.GetMyCommands import dev.inmo.tgbotapi.requests.bot.GetMyCommands
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
import dev.inmo.tgbotapi.types.BotShortDescription
import dev.inmo.tgbotapi.types.commands.BotCommandScope import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.getMyShortDescription( public suspend fun TelegramBot.getMyShortDescription(
languageCode: IetfLang? = null languageCode: IetfLang? = null
) = execute(GetMyShortDescription(languageCode)) ): BotShortDescription = execute(GetMyShortDescription(languageCode))
suspend fun TelegramBot.getMyShortDescription( public suspend fun TelegramBot.getMyShortDescription(
languageCode: String? languageCode: String?
) = getMyShortDescription(languageCode ?.let(::IetfLang)) ): BotShortDescription = getMyShortDescription(languageCode ?.let(::IetfLang))

View File

@@ -7,26 +7,26 @@ import dev.inmo.tgbotapi.types.BotCommand
import dev.inmo.tgbotapi.types.commands.BotCommandScope import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.setMyCommands( public suspend fun TelegramBot.setMyCommands(
commands: List<BotCommand>, commands: List<BotCommand>,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLang? languageCode: IetfLang?
) = execute(SetMyCommands(commands, scope, languageCode)) ): Boolean = execute(SetMyCommands(commands, scope, languageCode))
suspend fun TelegramBot.setMyCommands( public suspend fun TelegramBot.setMyCommands(
vararg commands: BotCommand, vararg commands: BotCommand,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: IetfLang? languageCode: IetfLang?
) = setMyCommands(commands.toList(), scope, languageCode) ): Boolean = setMyCommands(commands.toList(), scope, languageCode)
suspend fun TelegramBot.setMyCommands( public suspend fun TelegramBot.setMyCommands(
commands: List<BotCommand>, commands: List<BotCommand>,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null languageCode: String? = null
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLang)) ): Boolean = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
suspend fun TelegramBot.setMyCommands( public suspend fun TelegramBot.setMyCommands(
vararg commands: BotCommand, vararg commands: BotCommand,
scope: BotCommandScope = BotCommandScopeDefault, scope: BotCommandScope = BotCommandScopeDefault,
languageCode: String? = null languageCode: String? = null
) = setMyCommands(commands.toList(), scope, languageCode) ): Boolean = setMyCommands(commands.toList(), scope, languageCode)

View File

@@ -4,15 +4,15 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.SetMyDefaultAdministratorRights import dev.inmo.tgbotapi.requests.bot.SetMyDefaultAdministratorRights
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
suspend fun TelegramBot.setMyDefaultAdministratorRights( public suspend fun TelegramBot.setMyDefaultAdministratorRights(
rights: ChatCommonAdministratorRights, rights: ChatCommonAdministratorRights,
forChannels: Boolean? = null forChannels: Boolean? = null
) = execute(SetMyDefaultAdministratorRights(rights, forChannels)) ): Boolean = execute(SetMyDefaultAdministratorRights(rights, forChannels))
suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels( public suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
rights: ChatCommonAdministratorRights rights: ChatCommonAdministratorRights
) = setMyDefaultAdministratorRights(rights, forChannels = true) ): Boolean = setMyDefaultAdministratorRights(rights, forChannels = true)
suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups( public suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
rights: ChatCommonAdministratorRights rights: ChatCommonAdministratorRights
) = setMyDefaultAdministratorRights(rights, forChannels = false) ): Boolean = setMyDefaultAdministratorRights(rights, forChannels = false)

View File

@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.requests.bot.SetMyDescription
import dev.inmo.tgbotapi.types.commands.BotCommandScope import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.setMyDescription( public suspend fun TelegramBot.setMyDescription(
description: String? = null, description: String? = null,
languageCode: IetfLang? = null languageCode: IetfLang? = null
) = execute(SetMyDescription(description, languageCode)) ): Boolean = execute(SetMyDescription(description, languageCode))
suspend fun TelegramBot.setMyDescription( public suspend fun TelegramBot.setMyDescription(
description: String?, description: String?,
languageCode: String? languageCode: String?
) = setMyDescription(description, languageCode ?.let(::IetfLang)) ): Boolean = setMyDescription(description, languageCode ?.let(::IetfLang))

View File

@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.requests.bot.SetMyName
import dev.inmo.tgbotapi.types.commands.BotCommandScope import dev.inmo.tgbotapi.types.commands.BotCommandScope
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
suspend fun TelegramBot.setMyName( public suspend fun TelegramBot.setMyName(
name: String? = null, name: String? = null,
languageCode: IetfLang? = null languageCode: IetfLang? = null
) = execute(SetMyName(name, languageCode)) ): Boolean = execute(SetMyName(name, languageCode))
suspend fun TelegramBot.setMyName( public suspend fun TelegramBot.setMyName(
name: String?, name: String?,
languageCode: String? languageCode: String?
) = setMyName(name, languageCode ?.let(::IetfLang)) ): Boolean = setMyName(name, languageCode ?.let(::IetfLang))

View File

@@ -4,12 +4,12 @@ import dev.inmo.micro_utils.language_codes.IetfLang
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
suspend fun TelegramBot.setMyShortDescription( public suspend fun TelegramBot.setMyShortDescription(
shortDescription: String? = null, shortDescription: String? = null,
languageCode: IetfLang? = null languageCode: IetfLang? = null
) = execute(SetMyShortDescription(shortDescription, languageCode)) ): Boolean = execute(SetMyShortDescription(shortDescription, languageCode))
suspend fun TelegramBot.setMyShortDescription( public suspend fun TelegramBot.setMyShortDescription(
shortDescription: String?, shortDescription: String?,
languageCode: String? languageCode: String?
) = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang)) ): Boolean = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))

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

@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.chat.ExportChatInviteLink
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
suspend fun TelegramBot.exportChatInviteLink( public suspend fun TelegramBot.exportChatInviteLink(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute(ExportChatInviteLink(chatId)) ): String = execute(ExportChatInviteLink(chatId))
suspend fun TelegramBot.exportChatInviteLink( public suspend fun TelegramBot.exportChatInviteLink(
chat: PublicChat chat: PublicChat
) = exportChatInviteLink(chat.id) ): String = exportChatInviteLink(chat.id)

View File

@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.chat.LeaveChat
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
suspend fun TelegramBot.leaveChat( public suspend fun TelegramBot.leaveChat(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute(LeaveChat(chatId)) ): Boolean = execute(LeaveChat(chatId))
suspend fun TelegramBot.leaveChat( public suspend fun TelegramBot.leaveChat(
chat: PublicChat chat: PublicChat
) = leaveChat(chat.id) ): Boolean = leaveChat(chat.id)

View File

@@ -7,22 +7,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.closeForumTopic( public suspend fun TelegramBot.closeForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = execute( ): Boolean = execute(
CloseForumTopic( CloseForumTopic(
chatId, chatId,
messageThreadId messageThreadId
) )
) )
suspend fun TelegramBot.closeForumTopic( public suspend fun TelegramBot.closeForumTopic(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = closeForumTopic(chat.id, messageThreadId) ): Boolean = closeForumTopic(chat.id, messageThreadId)
suspend fun TelegramBot.closeForumTopic( public suspend fun TelegramBot.closeForumTopic(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
) = closeForumTopic(chat.id, forumTopic.messageThreadId) ): Boolean = closeForumTopic(chat.id, forumTopic.messageThreadId)

View File

@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.closeGeneralForumTopic( public suspend fun TelegramBot.closeGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute( ): Boolean = execute(
CloseGeneralForumTopic(chatId) CloseGeneralForumTopic(chatId)
) )
suspend fun TelegramBot.closeGeneralForumTopic( public suspend fun TelegramBot.closeGeneralForumTopic(
chat: Chat chat: Chat
) = closeGeneralForumTopic(chat.id) ): Boolean = closeGeneralForumTopic(chat.id)

View File

@@ -4,15 +4,16 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.CustomEmojiId import dev.inmo.tgbotapi.types.CustomEmojiId
import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.utils.RGBColor import dev.inmo.tgbotapi.utils.RGBColor
suspend fun TelegramBot.createForumTopic( public suspend fun TelegramBot.createForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
name: String, name: String,
color: RGBColor, color: RGBColor,
iconEmojiId: CustomEmojiId? = null iconEmojiId: CustomEmojiId? = null
) = execute( ): ForumTopic = execute(
CreateForumTopic( CreateForumTopic(
chatId, chatId,
name, name,
@@ -21,9 +22,9 @@ suspend fun TelegramBot.createForumTopic(
) )
) )
suspend fun TelegramBot.createForumTopic( public suspend fun TelegramBot.createForumTopic(
chat: Chat, chat: Chat,
name: String, name: String,
color: RGBColor, color: RGBColor,
iconEmojiId: CustomEmojiId? = null iconEmojiId: CustomEmojiId? = null
) = createForumTopic(chat.id, name, color, iconEmojiId) ): ForumTopic = createForumTopic(chat.id, name, color, iconEmojiId)

View File

@@ -7,27 +7,27 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = execute( ): Boolean = execute(
DeleteForumTopic( DeleteForumTopic(
chatId, chatId,
messageThreadId messageThreadId
) )
) )
suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
forumTopic: ForumTopic forumTopic: ForumTopic
) = deleteForumTopic(chatId, forumTopic.messageThreadId) ): Boolean = deleteForumTopic(chatId, forumTopic.messageThreadId)
suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = deleteForumTopic(chat.id, messageThreadId) ): Boolean = deleteForumTopic(chat.id, messageThreadId)
suspend fun TelegramBot.deleteForumTopic( public suspend fun TelegramBot.deleteForumTopic(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
) = deleteForumTopic(chat.id, forumTopic.messageThreadId) ): Boolean = deleteForumTopic(chat.id, forumTopic.messageThreadId)

View File

@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.editForumTopic( public suspend fun TelegramBot.editForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId, messageThreadId: MessageThreadId,
name: String? = null, name: String? = null,
iconEmojiId: CustomEmojiId? = null iconEmojiId: CustomEmojiId? = null
) = execute( ): Boolean = execute(
EditForumTopic( EditForumTopic(
chatId, chatId,
messageThreadId, messageThreadId,
@@ -22,15 +22,15 @@ suspend fun TelegramBot.editForumTopic(
) )
) )
suspend fun TelegramBot.editForumTopic( public suspend fun TelegramBot.editForumTopic(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId, messageThreadId: MessageThreadId,
name: String? = null, name: String? = null,
iconEmojiId: CustomEmojiId? = null iconEmojiId: CustomEmojiId? = null
) = editForumTopic(chat.id, messageThreadId, name, iconEmojiId) ): Boolean = editForumTopic(chat.id, messageThreadId, name, iconEmojiId)
suspend fun TelegramBot.editForumTopic( public suspend fun TelegramBot.editForumTopic(
chatIdentifier: ChatIdentifier, chatIdentifier: ChatIdentifier,
forumTopic: ForumTopic, forumTopic: ForumTopic,
iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId
) = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId) ): Boolean = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)

View File

@@ -9,22 +9,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.editGeneralForumTopic( public suspend fun TelegramBot.editGeneralForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
name: String name: String
) = execute( ): Boolean = execute(
EditGeneralForumTopic( EditGeneralForumTopic(
chatId, chatId,
name name
) )
) )
suspend fun TelegramBot.editGeneralForumTopic( public suspend fun TelegramBot.editGeneralForumTopic(
chat: Chat, chat: Chat,
name: String name: String
) = editGeneralForumTopic(chat.id, name) ): Boolean = editGeneralForumTopic(chat.id, name)
suspend fun TelegramBot.editGeneralForumTopic( public suspend fun TelegramBot.editGeneralForumTopic(
chatIdentifier: ChatIdentifier, chatIdentifier: ChatIdentifier,
forumTopic: ForumTopic, forumTopic: ForumTopic,
) = editGeneralForumTopic(chatIdentifier, forumTopic.name) ): Boolean = editGeneralForumTopic(chatIdentifier, forumTopic.name)

View File

@@ -9,12 +9,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.hideGeneralForumTopic( public suspend fun TelegramBot.hideGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute( ): Boolean = execute(
HideGeneralForumTopic(chatId) HideGeneralForumTopic(chatId)
) )
suspend fun TelegramBot.hideGeneralForumTopic( public suspend fun TelegramBot.hideGeneralForumTopic(
chat: Chat chat: Chat
) = hideGeneralForumTopic(chat.id) ): Boolean = hideGeneralForumTopic(chat.id)

View File

@@ -7,22 +7,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.reopenForumTopic( public suspend fun TelegramBot.reopenForumTopic(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = execute( ): Boolean = execute(
ReopenForumTopic( ReopenForumTopic(
chatId, chatId,
messageThreadId messageThreadId
) )
) )
suspend fun TelegramBot.reopenForumTopic( public suspend fun TelegramBot.reopenForumTopic(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = reopenForumTopic(chat.id, messageThreadId) ): Boolean = reopenForumTopic(chat.id, messageThreadId)
suspend fun TelegramBot.reopenForumTopic( public suspend fun TelegramBot.reopenForumTopic(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
) = reopenForumTopic(chat.id, forumTopic.messageThreadId) ): Boolean = reopenForumTopic(chat.id, forumTopic.messageThreadId)

View File

@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.reopenGeneralForumTopic( public suspend fun TelegramBot.reopenGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute( ): Boolean = execute(
ReopenGeneralForumTopic(chatId) ReopenGeneralForumTopic(chatId)
) )
suspend fun TelegramBot.reopenGeneralForumTopic( public suspend fun TelegramBot.reopenGeneralForumTopic(
chat: Chat chat: Chat
) = reopenGeneralForumTopic(chat.id) ): Boolean = reopenGeneralForumTopic(chat.id)

View File

@@ -10,12 +10,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.unhideGeneralForumTopic( public suspend fun TelegramBot.unhideGeneralForumTopic(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute( ): Boolean = execute(
UnhideGeneralForumTopic(chatId) UnhideGeneralForumTopic(chatId)
) )
suspend fun TelegramBot.unhideGeneralForumTopic( public suspend fun TelegramBot.unhideGeneralForumTopic(
chat: Chat chat: Chat
) = unhideGeneralForumTopic(chat.id) ): Boolean = unhideGeneralForumTopic(chat.id)

View File

@@ -7,22 +7,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.unpinAllForumTopicMessages( public suspend fun TelegramBot.unpinAllForumTopicMessages(
chatId: ChatIdentifier, chatId: ChatIdentifier,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = execute( ): Boolean = execute(
UnpinAllForumTopicMessages( UnpinAllForumTopicMessages(
chatId, chatId,
messageThreadId messageThreadId
) )
) )
suspend fun TelegramBot.unpinAllForumTopicMessages( public suspend fun TelegramBot.unpinAllForumTopicMessages(
chat: Chat, chat: Chat,
messageThreadId: MessageThreadId messageThreadId: MessageThreadId
) = unpinAllForumTopicMessages(chat.id, messageThreadId) ): Boolean = unpinAllForumTopicMessages(chat.id, messageThreadId)
suspend fun TelegramBot.unpinAllForumTopicMessages( public suspend fun TelegramBot.unpinAllForumTopicMessages(
chat: Chat, chat: Chat,
forumTopic: ForumTopic forumTopic: ForumTopic
) = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId) ): Boolean = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)

View File

@@ -8,14 +8,14 @@ import dev.inmo.tgbotapi.types.ForumTopic
import dev.inmo.tgbotapi.types.MessageThreadId import dev.inmo.tgbotapi.types.MessageThreadId
import dev.inmo.tgbotapi.types.chat.Chat import dev.inmo.tgbotapi.types.chat.Chat
suspend fun TelegramBot.unpinAllGeneralForumTopicMessages( public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute( ): Boolean = execute(
UnpinAllGeneralForumTopicMessages( UnpinAllGeneralForumTopicMessages(
chatId chatId
) )
) )
suspend fun TelegramBot.unpinAllGeneralForumTopicMessages( public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
chat: Chat chat: Chat
) = unpinAllGeneralForumTopicMessages(chat.id) ): Boolean = unpinAllGeneralForumTopicMessages(chat.id)

View File

@@ -3,36 +3,16 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetChat import dev.inmo.tgbotapi.requests.chat.get.GetChat
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.ChannelChat import dev.inmo.tgbotapi.types.chat.*
import dev.inmo.tgbotapi.types.chat.ChannelChatImpl
import dev.inmo.tgbotapi.types.chat.Chat
import dev.inmo.tgbotapi.types.chat.CommonUser
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChat
import dev.inmo.tgbotapi.types.chat.ExtendedChannelChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChat
import dev.inmo.tgbotapi.types.chat.ExtendedGroupChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChat
import dev.inmo.tgbotapi.types.chat.ExtendedPrivateChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedPublicChat
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChat
import dev.inmo.tgbotapi.types.chat.ExtendedSupergroupChatImpl
import dev.inmo.tgbotapi.types.chat.ExtendedUser
import dev.inmo.tgbotapi.types.chat.GroupChat
import dev.inmo.tgbotapi.types.chat.GroupChatImpl
import dev.inmo.tgbotapi.types.chat.PrivateChat
import dev.inmo.tgbotapi.types.chat.PrivateChatImpl
import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.SupergroupChat
import dev.inmo.tgbotapi.types.chat.SupergroupChatImpl
import dev.inmo.tgbotapi.utils.PreviewFeature import dev.inmo.tgbotapi.utils.PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute(GetChat(chatId)) ): ExtendedChat = execute(GetChat(chatId))
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: Chat chat: Chat
) = getChat(chat.id) ): ExtendedChat = getChat(chat.id)
/** /**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a * Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
@@ -41,9 +21,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: PublicChat chat: PublicChat
) = getChat(chat.id) as ExtendedPublicChat ): ExtendedPublicChat = getChat(chat.id) as ExtendedPublicChat
/** /**
@@ -53,9 +33,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: ChannelChat chat: ChannelChat
) = getChat(chat.id) as ExtendedChannelChat ): ExtendedChannelChat = getChat(chat.id) as ExtendedChannelChat
/** /**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a * Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
@@ -64,9 +44,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: ChannelChatImpl chat: ChannelChatImpl
) = getChat(chat.id) as ExtendedChannelChatImpl ): ExtendedChannelChatImpl = getChat(chat.id) as ExtendedChannelChatImpl
/** /**
@@ -76,9 +56,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: GroupChat chat: GroupChat
) = getChat(chat.id) as ExtendedGroupChat ): ExtendedGroupChat = getChat(chat.id) as ExtendedGroupChat
/** /**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a * Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
@@ -87,9 +67,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: GroupChatImpl chat: GroupChatImpl
) = getChat(chat.id) as ExtendedGroupChatImpl ): ExtendedGroupChatImpl = getChat(chat.id) as ExtendedGroupChatImpl
/** /**
@@ -99,9 +79,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: SupergroupChat chat: SupergroupChat
) = getChat(chat.id) as ExtendedSupergroupChat ): ExtendedSupergroupChat = getChat(chat.id) as ExtendedSupergroupChat
/** /**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a * Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
@@ -110,9 +90,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: SupergroupChatImpl chat: SupergroupChatImpl
) = getChat(chat.id) as ExtendedSupergroupChatImpl ): ExtendedSupergroupChatImpl = getChat(chat.id) as ExtendedSupergroupChatImpl
/** /**
@@ -122,9 +102,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: PrivateChat chat: PrivateChat
) = getChat(chat.id) as ExtendedPrivateChat ): ExtendedPrivateChat = getChat(chat.id) as ExtendedPrivateChat
/** /**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a * Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
@@ -133,9 +113,9 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: PrivateChatImpl chat: PrivateChatImpl
) = getChat(chat.id) as ExtendedPrivateChatImpl ): ExtendedPrivateChatImpl = getChat(chat.id) as ExtendedPrivateChatImpl
/** /**
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a * Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
@@ -144,6 +124,6 @@ suspend fun TelegramBot.getChat(
* @throws ClassCastException * @throws ClassCastException
*/ */
@PreviewFeature @PreviewFeature
suspend fun TelegramBot.getChat( public suspend fun TelegramBot.getChat(
chat: CommonUser chat: CommonUser
) = getChat(chat.id) as ExtendedUser ): ExtendedUser = getChat(chat.id) as ExtendedUser

View File

@@ -4,11 +4,12 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetChatAdministrators import dev.inmo.tgbotapi.requests.chat.get.GetChatAdministrators
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.member.AdministratorChatMember
suspend fun TelegramBot.getChatAdministrators( public suspend fun TelegramBot.getChatAdministrators(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute(GetChatAdministrators(chatId)) ): List<AdministratorChatMember> = execute(GetChatAdministrators(chatId))
suspend fun TelegramBot.getChatAdministrators( public suspend fun TelegramBot.getChatAdministrators(
chat: PublicChat chat: PublicChat
) = getChatAdministrators(chat.id) ): List<AdministratorChatMember> = getChatAdministrators(chat.id)

View File

@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.chat.get.GetChatMemberCount
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
suspend fun TelegramBot.getChatMemberCount( public suspend fun TelegramBot.getChatMemberCount(
chatId: ChatIdentifier chatId: ChatIdentifier
) = execute(GetChatMemberCount(chatId)) ): Int = execute(GetChatMemberCount(chatId))
suspend fun TelegramBot.getChatMemberCount( public suspend fun TelegramBot.getChatMemberCount(
chat: PublicChat chat: PublicChat
) = getChatMemberCount(chat.id) ): Int = getChatMemberCount(chat.id)

View File

@@ -3,12 +3,13 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetChatMenuButton import dev.inmo.tgbotapi.requests.chat.get.GetChatMenuButton
import dev.inmo.tgbotapi.types.IdChatIdentifier import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.MenuButton
import dev.inmo.tgbotapi.types.chat.PrivateChat import dev.inmo.tgbotapi.types.chat.PrivateChat
suspend fun TelegramBot.getChatMenuButton( public suspend fun TelegramBot.getChatMenuButton(
chatId: IdChatIdentifier chatId: IdChatIdentifier
) = execute(GetChatMenuButton(chatId)) ): MenuButton = execute(GetChatMenuButton(chatId))
suspend fun TelegramBot.getChatMenuButton( public suspend fun TelegramBot.getChatMenuButton(
chat: PrivateChat chat: PrivateChat
) = getChatMenuButton(chat.id) ): MenuButton = getChatMenuButton(chat.id)

View File

@@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetDefaultChatMenuButton import dev.inmo.tgbotapi.requests.chat.get.GetDefaultChatMenuButton
import dev.inmo.tgbotapi.types.MenuButton
suspend fun TelegramBot.getDefaultChatMenuButton() = execute(GetDefaultChatMenuButton) public suspend fun TelegramBot.getDefaultChatMenuButton(): MenuButton = execute(GetDefaultChatMenuButton)

View File

@@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.get.GetForumTopicIconStickers import dev.inmo.tgbotapi.requests.chat.get.GetForumTopicIconStickers
import dev.inmo.tgbotapi.types.files.Sticker
suspend fun TelegramBot.getForumTopicIconStickers() = execute(GetForumTopicIconStickers) public suspend fun TelegramBot.getForumTopicIconStickers(): List<Sticker> = execute(GetForumTopicIconStickers)

View File

@@ -9,34 +9,34 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId userId: UserId
) = execute(ApproveChatJoinRequest(chatId, userId)) ): Boolean = execute(ApproveChatJoinRequest(chatId, userId))
suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chat: PublicChat, chat: PublicChat,
userId: UserId userId: UserId
) = approveChatJoinRequest(chat.id, userId) ): Boolean = approveChatJoinRequest(chat.id, userId)
suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
user: User user: User
) = approveChatJoinRequest(chatId, user.id) ): Boolean = approveChatJoinRequest(chatId, user.id)
suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chat: PublicChat, chat: PublicChat,
user: User user: User
) = approveChatJoinRequest(chat.id, user.id) ): Boolean = approveChatJoinRequest(chat.id, user.id)
suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
) = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user) ): Boolean = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
suspend fun TelegramBot.approve( public suspend fun TelegramBot.approve(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
) = approveChatJoinRequest(chatJoinRequest) ): Boolean = approveChatJoinRequest(chatJoinRequest)
suspend fun TelegramBot.approveChatJoinRequest( public suspend fun TelegramBot.approveChatJoinRequest(
chatJoinRequestUpdate: ChatJoinRequestUpdate chatJoinRequestUpdate: ChatJoinRequestUpdate
) = approveChatJoinRequest(chatJoinRequestUpdate.data) ): Boolean = approveChatJoinRequest(chatJoinRequestUpdate.data)

View File

@@ -3,84 +3,151 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import korlibs.time.DateTime import korlibs.time.DateTime
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.MembersLimit
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.toTelegramDate import korlibs.time.TimeSpan
import korlibs.time.days
suspend fun TelegramBot.createChatInviteLinkUnlimited( public suspend fun TelegramBot.createChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = execute(CreateChatInviteLink.unlimited(chatId, name, expiration)) ): ChatInviteLinkUnlimited = execute(CreateChatInviteLink.unlimited(chatId, name, expiration))
suspend fun TelegramBot.createChatInviteLinkUnlimited( public suspend fun TelegramBot.createChatInviteLinkUnlimited(
chat: PublicChat, chat: PublicChat,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = createChatInviteLinkUnlimited(chat.id, name, expiration) ): ChatInviteLinkUnlimited = createChatInviteLinkUnlimited(chat.id, name, expiration)
suspend fun TelegramBot.createChatInviteLinkUnlimited( public suspend fun TelegramBot.createChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = createChatInviteLinkUnlimited(chatId, name, expiration.toTelegramDate()) ): ChatInviteLinkUnlimited = createChatInviteLinkUnlimited(chatId, name, expiration.toTelegramDate())
suspend fun TelegramBot.createChatInviteLinkUnlimited( public suspend fun TelegramBot.createChatInviteLinkUnlimited(
chat: PublicChat, chat: PublicChat,
expiration: DateTime, expiration: DateTime,
name: String? = null name: String? = null
) = createChatInviteLinkUnlimited(chat.id, name, expiration.toTelegramDate()) ): ChatInviteLinkUnlimited = createChatInviteLinkUnlimited(chat.id, name, expiration.toTelegramDate())
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
chatId: ChatIdentifier, chatId: ChatIdentifier,
membersLimit: MembersLimit, membersLimit: MembersLimit,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = execute(CreateChatInviteLink.withLimitedMembers(chatId, membersLimit, name, expiration)) ): ChatInviteLinkWithLimitedMembers = execute(CreateChatInviteLink.withLimitedMembers(chatId, membersLimit, name, expiration))
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
chat: PublicChat, chat: PublicChat,
membersLimit: MembersLimit, membersLimit: MembersLimit,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = createChatInviteLinkWithLimitedMembers(chat.id, membersLimit, name, expiration) ): ChatInviteLinkWithLimitedMembers = createChatInviteLinkWithLimitedMembers(chat.id, membersLimit, name, expiration)
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
chatId: ChatIdentifier, chatId: ChatIdentifier,
membersLimit: MembersLimit, membersLimit: MembersLimit,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = createChatInviteLinkWithLimitedMembers(chatId, membersLimit, name, expiration.toTelegramDate()) ): ChatInviteLinkWithLimitedMembers = createChatInviteLinkWithLimitedMembers(chatId, membersLimit, name, expiration.toTelegramDate())
suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.createChatInviteLinkWithLimitedMembers(
chat: PublicChat, chat: PublicChat,
membersLimit: MembersLimit, membersLimit: MembersLimit,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = createChatInviteLinkWithLimitedMembers(chat.id, membersLimit, name, expiration.toTelegramDate()) ): ChatInviteLinkWithLimitedMembers = createChatInviteLinkWithLimitedMembers(chat.id, membersLimit, name, expiration.toTelegramDate())
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = execute(CreateChatInviteLink.withJoinRequest(chatId, name, expiration)) ): ChatInviteLinkWithJoinRequest = execute(CreateChatInviteLink.withJoinRequest(chatId, name, expiration))
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
chat: PublicChat, chat: PublicChat,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = createChatInviteLinkWithJoinRequest(chat.id, name, expiration) ): ChatInviteLinkWithJoinRequest = createChatInviteLinkWithJoinRequest(chat.id, name, expiration)
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = createChatInviteLinkWithJoinRequest(chatId, name, expiration.toTelegramDate()) ): ChatInviteLinkWithJoinRequest = createChatInviteLinkWithJoinRequest(chatId, name, expiration.toTelegramDate())
suspend fun TelegramBot.createChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.createChatInviteLinkWithJoinRequest(
chat: PublicChat, chat: PublicChat,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = createChatInviteLinkWithJoinRequest(chat.id, name, expiration.toTelegramDate()) ): ChatInviteLinkWithJoinRequest = createChatInviteLinkWithJoinRequest(chat.id, name, expiration.toTelegramDate())
// Subscriptions
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chatId: ChatIdentifier,
subscriptionPrice: UInt,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: TelegramDate? = null,
): ChatInviteLinkUnlimited = execute(CreateChatInviteLink.subscription(chatId, subscriptionPrice, subscriptionPeriod, name, expirationUnixTimeStamp))
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chat: PublicChat,
subscriptionPrice: UInt,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: TelegramDate? = null,
): ChatInviteLinkUnlimited = createChatSubscriptionInviteLink(chat.id, subscriptionPrice, subscriptionPeriod, name, expirationUnixTimeStamp)
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chatId: ChatIdentifier,
subscriptionPrice: UInt,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: DateTime,
): ChatInviteLinkUnlimited = createChatSubscriptionInviteLink(chatId, subscriptionPrice, subscriptionPeriod, name, expirationUnixTimeStamp.toTelegramDate())
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chat: PublicChat,
subscriptionPrice: UInt,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: DateTime,
): ChatInviteLinkUnlimited = createChatSubscriptionInviteLink(chat.id, subscriptionPrice, subscriptionPeriod, name, expirationUnixTimeStamp)
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chatId: ChatIdentifier,
subscriptionPrice: Int,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: TelegramDate? = null,
): ChatInviteLinkUnlimited = createChatSubscriptionInviteLink(chatId, subscriptionPrice.toUInt(), subscriptionPeriod, name, expirationUnixTimeStamp)
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chat: PublicChat,
subscriptionPrice: Int,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: TelegramDate? = null,
): ChatInviteLinkUnlimited = createChatSubscriptionInviteLink(chat, subscriptionPrice.toUInt(), subscriptionPeriod, name, expirationUnixTimeStamp)
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chatId: ChatIdentifier,
subscriptionPrice: Int,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: DateTime,
): ChatInviteLinkUnlimited = createChatSubscriptionInviteLink(chatId, subscriptionPrice.toUInt(), subscriptionPeriod, name, expirationUnixTimeStamp)
public suspend fun TelegramBot.createChatSubscriptionInviteLink(
chat: PublicChat,
subscriptionPrice: Int,
subscriptionPeriod: TimeSpan = 30.days,
name: String? = null,
expirationUnixTimeStamp: DateTime,
): ChatInviteLinkUnlimited = createChatSubscriptionInviteLink(chat, subscriptionPrice.toUInt(), subscriptionPeriod, name, expirationUnixTimeStamp)

View File

@@ -9,34 +9,34 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId userId: UserId
) = execute(DeclineChatJoinRequest(chatId, userId)) ): Boolean = execute(DeclineChatJoinRequest(chatId, userId))
suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chat: PublicChat, chat: PublicChat,
userId: UserId userId: UserId
) = declineChatJoinRequest(chat.id, userId) ): Boolean = declineChatJoinRequest(chat.id, userId)
suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
user: User user: User
) = declineChatJoinRequest(chatId, user.id) ): Boolean = declineChatJoinRequest(chatId, user.id)
suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chat: PublicChat, chat: PublicChat,
user: User user: User
) = declineChatJoinRequest(chat.id, user.id) ): Boolean = declineChatJoinRequest(chat.id, user.id)
suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
) = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user) ): Boolean = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
suspend fun TelegramBot.decline( public suspend fun TelegramBot.decline(
chatJoinRequest: ChatJoinRequest chatJoinRequest: ChatJoinRequest
) = declineChatJoinRequest(chatJoinRequest) ): Boolean = declineChatJoinRequest(chatJoinRequest)
suspend fun TelegramBot.declineChatJoinRequest( public suspend fun TelegramBot.declineChatJoinRequest(
chatJoinRequestUpdate: ChatJoinRequestUpdate chatJoinRequestUpdate: ChatJoinRequestUpdate
) = declineChatJoinRequest(chatJoinRequestUpdate.data) ): Boolean = declineChatJoinRequest(chatJoinRequestUpdate.data)

View File

@@ -3,185 +3,208 @@ package dev.inmo.tgbotapi.extensions.api.chat.invite_links
import korlibs.time.DateTime import korlibs.time.DateTime
import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.ChatInviteLink
import dev.inmo.tgbotapi.types.MembersLimit
import dev.inmo.tgbotapi.types.TelegramDate
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.toTelegramDate
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: String, previousLink: String,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = execute(EditChatInviteLink.unlimited(chatId, previousLink, name, expiration)) ): ChatInviteLinkUnlimited = execute(EditChatInviteLink.unlimited(chatId, previousLink, name, expiration))
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chat: PublicChat, chat: PublicChat,
previousLink: String, previousLink: String,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = editChatInviteLinkUnlimited(chat.id, previousLink, name, expiration) ): ChatInviteLinkUnlimited = editChatInviteLinkUnlimited(chat.id, previousLink, name, expiration)
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: String, previousLink: String,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkUnlimited(chatId, previousLink, name , expiration.toTelegramDate()) ): ChatInviteLinkUnlimited = editChatInviteLinkUnlimited(chatId, previousLink, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chat: PublicChat, chat: PublicChat,
previousLink: String, previousLink: String,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkUnlimited(chat.id, previousLink, name , expiration.toTelegramDate()) ): ChatInviteLinkUnlimited = editChatInviteLinkUnlimited(chat.id, previousLink, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: String, previousLink: String,
membersLimit: MembersLimit, membersLimit: MembersLimit,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = execute(EditChatInviteLink.withLimitedMembers(chatId, previousLink, membersLimit, name, expiration)) ): ChatInviteLinkWithLimitedMembers = execute(EditChatInviteLink.withLimitedMembers(chatId, previousLink, membersLimit, name, expiration))
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chat: PublicChat, chat: PublicChat,
previousLink: String, previousLink: String,
membersLimit: MembersLimit, membersLimit: MembersLimit,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name, expiration) ): ChatInviteLinkWithLimitedMembers = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name, expiration)
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: String, previousLink: String,
membersLimit: MembersLimit, membersLimit: MembersLimit,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithLimitedMembers(chatId, previousLink, membersLimit, name , expiration.toTelegramDate()) ): ChatInviteLinkWithLimitedMembers = editChatInviteLinkWithLimitedMembers(chatId, previousLink, membersLimit, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chat: PublicChat, chat: PublicChat,
previousLink: String, previousLink: String,
membersLimit: MembersLimit, membersLimit: MembersLimit,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name , expiration.toTelegramDate()) ): ChatInviteLinkWithLimitedMembers = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: String, previousLink: String,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = execute(EditChatInviteLink.withJoinRequest(chatId, previousLink, name, expiration)) ): ChatInviteLinkWithJoinRequest = execute(EditChatInviteLink.withJoinRequest(chatId, previousLink, name, expiration))
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chat: PublicChat, chat: PublicChat,
previousLink: String, previousLink: String,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name, expiration) ): ChatInviteLinkWithJoinRequest = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name, expiration)
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: String, previousLink: String,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithJoinRequest(chatId, previousLink, name , expiration.toTelegramDate()) ): ChatInviteLinkWithJoinRequest = editChatInviteLinkWithJoinRequest(chatId, previousLink, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chat: PublicChat, chat: PublicChat,
previousLink: String, previousLink: String,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name , expiration.toTelegramDate()) ): ChatInviteLinkWithJoinRequest = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = editChatInviteLinkUnlimited(chatId, previousLink.inviteLink, name, expiration) ): ChatInviteLinkUnlimited = editChatInviteLinkUnlimited(chatId, previousLink.inviteLink, name, expiration)
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chat: PublicChat, chat: PublicChat,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = editChatInviteLinkUnlimited(chat.id, previousLink, name, expiration) ): ChatInviteLinkUnlimited = editChatInviteLinkUnlimited(chat.id, previousLink, name, expiration)
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkUnlimited(chatId, previousLink, name, expiration.toTelegramDate()) ): ChatInviteLinkUnlimited = editChatInviteLinkUnlimited(chatId, previousLink, name, expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkUnlimited( public suspend fun TelegramBot.editChatInviteLinkUnlimited(
chat: PublicChat, chat: PublicChat,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkUnlimited(chat.id, previousLink, name , expiration.toTelegramDate()) ): ChatInviteLinkUnlimited = editChatInviteLinkUnlimited(chat.id, previousLink, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
membersLimit: MembersLimit, membersLimit: MembersLimit,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = editChatInviteLinkWithLimitedMembers(chatId, previousLink.inviteLink, membersLimit, name, expiration) ): ChatInviteLinkWithLimitedMembers = editChatInviteLinkWithLimitedMembers(chatId, previousLink.inviteLink, membersLimit, name, expiration)
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chat: PublicChat, chat: PublicChat,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
membersLimit: MembersLimit, membersLimit: MembersLimit,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name, expiration) ): ChatInviteLinkWithLimitedMembers = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name, expiration)
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
membersLimit: MembersLimit, membersLimit: MembersLimit,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithLimitedMembers(chatId, previousLink, membersLimit, name , expiration.toTelegramDate()) ): ChatInviteLinkWithLimitedMembers = editChatInviteLinkWithLimitedMembers(chatId, previousLink, membersLimit, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers( public suspend fun TelegramBot.editChatInviteLinkWithLimitedMembers(
chat: PublicChat, chat: PublicChat,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
membersLimit: MembersLimit, membersLimit: MembersLimit,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name , expiration.toTelegramDate()) ): ChatInviteLinkWithLimitedMembers = editChatInviteLinkWithLimitedMembers(chat.id, previousLink, membersLimit, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null expiration: TelegramDate? = null
) = editChatInviteLinkWithJoinRequest(chatId, previousLink.inviteLink, name, expiration) ): ChatInviteLinkWithJoinRequest = editChatInviteLinkWithJoinRequest(chatId, previousLink.inviteLink, name, expiration)
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chat: PublicChat, chat: PublicChat,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
name: String? = null, name: String? = null,
expiration: TelegramDate? = null, expiration: TelegramDate? = null,
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name, expiration) ): ChatInviteLinkWithJoinRequest = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name, expiration)
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithJoinRequest(chatId, previousLink, name , expiration.toTelegramDate()) ): ChatInviteLinkWithJoinRequest = editChatInviteLinkWithJoinRequest(chatId, previousLink, name , expiration.toTelegramDate())
suspend fun TelegramBot.editChatInviteLinkWithJoinRequest( public suspend fun TelegramBot.editChatInviteLinkWithJoinRequest(
chat: PublicChat, chat: PublicChat,
previousLink: ChatInviteLink, previousLink: ChatInviteLink,
expiration: DateTime, expiration: DateTime,
name: String? = null, name: String? = null,
) = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name , expiration.toTelegramDate()) ): ChatInviteLinkWithJoinRequest = editChatInviteLinkWithJoinRequest(chat.id, previousLink, name , expiration.toTelegramDate())
// Subscriptions
public suspend fun TelegramBot.editChatSubscriptionInviteLink(
chatId: ChatIdentifier,
previousLink: String,
name: String,
): ChatInviteLinkUnlimited = execute(EditChatInviteLink.subscription(chatId, previousLink, name))
public suspend fun TelegramBot.editChatSubscriptionInviteLink(
chatId: ChatIdentifier,
previousLink: ChatInviteLink,
name: String,
): ChatInviteLinkUnlimited = editChatSubscriptionInviteLink(chatId, previousLink.inviteLink, name)
public suspend fun TelegramBot.editChatSubscriptionInviteLink(
chat: PublicChat,
previousLink: String,
name: String,
): ChatInviteLinkUnlimited = editChatSubscriptionInviteLink(chat.id, previousLink, name)
public suspend fun TelegramBot.editChatSubscriptionInviteLink(
chat: PublicChat,
previousLink: ChatInviteLink,
name: String,
): ChatInviteLinkUnlimited = editChatSubscriptionInviteLink(chat.id, previousLink, name)

View File

@@ -4,24 +4,25 @@ import dev.inmo.tgbotapi.bot.TelegramBot
import dev.inmo.tgbotapi.requests.chat.invite_links.RevokeChatInviteLink import dev.inmo.tgbotapi.requests.chat.invite_links.RevokeChatInviteLink
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.ChatInviteLink import dev.inmo.tgbotapi.types.ChatInviteLink
import dev.inmo.tgbotapi.types.SecondaryChatInviteLink
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
suspend fun TelegramBot.revokeChatInviteLink( public suspend fun TelegramBot.revokeChatInviteLink(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: String previousLink: String
) = execute(RevokeChatInviteLink(chatId, previousLink)) ): SecondaryChatInviteLink = execute(RevokeChatInviteLink(chatId, previousLink))
suspend fun TelegramBot.revokeChatInviteLink( public suspend fun TelegramBot.revokeChatInviteLink(
chat: PublicChat, chat: PublicChat,
previousLink: String previousLink: String
) = revokeChatInviteLink(chat.id, previousLink) ): SecondaryChatInviteLink = revokeChatInviteLink(chat.id, previousLink)
suspend fun TelegramBot.revokeChatInviteLink( public suspend fun TelegramBot.revokeChatInviteLink(
chatId: ChatIdentifier, chatId: ChatIdentifier,
previousLink: ChatInviteLink previousLink: ChatInviteLink
) = revokeChatInviteLink(chatId, previousLink.inviteLink) ): SecondaryChatInviteLink = revokeChatInviteLink(chatId, previousLink.inviteLink)
suspend fun TelegramBot.revokeChatInviteLink( public suspend fun TelegramBot.revokeChatInviteLink(
chat: PublicChat, chat: PublicChat,
previousLink: ChatInviteLink previousLink: ChatInviteLink
) = revokeChatInviteLink(chat, previousLink.inviteLink) ): SecondaryChatInviteLink = revokeChatInviteLink(chat, previousLink.inviteLink)

View File

@@ -9,30 +9,30 @@ import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.banChatMember( public suspend fun TelegramBot.banChatMember(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
) = execute(BanChatMember(chatId, userId, untilDate, revokeMessages)) ): Boolean = execute(BanChatMember(chatId, userId, untilDate, revokeMessages))
suspend fun TelegramBot.banChatMember( public suspend fun TelegramBot.banChatMember(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
) = banChatMember(chat.id, userId, untilDate, revokeMessages) ): Boolean = banChatMember(chat.id, userId, untilDate, revokeMessages)
suspend fun TelegramBot.banChatMember( public suspend fun TelegramBot.banChatMember(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
) = banChatMember(chatId, user.id, untilDate, revokeMessages) ): Boolean = banChatMember(chatId, user.id, untilDate, revokeMessages)
suspend fun TelegramBot.banChatMember( public suspend fun TelegramBot.banChatMember(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
revokeMessages: Boolean? = null revokeMessages: Boolean? = null
) = banChatMember(chat.id, user.id, untilDate, revokeMessages) ): Boolean = banChatMember(chat.id, user.id, untilDate, revokeMessages)

View File

@@ -6,22 +6,22 @@ import dev.inmo.tgbotapi.types.IdChatIdentifier
import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chatId: ChatIdentifier, chatId: ChatIdentifier,
senderChatId: IdChatIdentifier senderChatId: IdChatIdentifier
) = execute(BanChatSenderChat(chatId, senderChatId)) ): Boolean = execute(BanChatSenderChat(chatId, senderChatId))
suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chat: PublicChat, chat: PublicChat,
senderChatId: IdChatIdentifier senderChatId: IdChatIdentifier
) = banChatSenderChat(chat.id, senderChatId) ): Boolean = banChatSenderChat(chat.id, senderChatId)
suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
senderChat: PublicChat senderChat: PublicChat
) = banChatSenderChat(chatId, senderChat.id) ): Boolean = banChatSenderChat(chatId, senderChat.id)
suspend fun TelegramBot.banChatSenderChat( public suspend fun TelegramBot.banChatSenderChat(
chat: PublicChat, chat: PublicChat,
senderChat: PublicChat, senderChat: PublicChat,
) = banChatSenderChat(chat.id, senderChat) ): Boolean = banChatSenderChat(chat.id, senderChat)

View File

@@ -7,23 +7,24 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.UserId import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
import dev.inmo.tgbotapi.types.chat.member.ChatMember
suspend fun TelegramBot.getChatMember( public suspend fun TelegramBot.getChatMember(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId userId: UserId
) = execute(GetChatMember(chatId, userId)) ): ChatMember = execute(GetChatMember(chatId, userId))
suspend fun TelegramBot.getChatMember( public suspend fun TelegramBot.getChatMember(
chat: PublicChat, chat: PublicChat,
userId: UserId userId: UserId
) = getChatMember(chat.id, userId) ): ChatMember = getChatMember(chat.id, userId)
suspend fun TelegramBot.getChatMember( public suspend fun TelegramBot.getChatMember(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User user: User
) = getChatMember(chatId, user.id) ): ChatMember = getChatMember(chatId, user.id)
suspend fun TelegramBot.getChatMember( public suspend fun TelegramBot.getChatMember(
chat: PublicChat, chat: PublicChat,
user: User user: User
) = getChatMember(chat.id, user.id) ): ChatMember = getChatMember(chat.id, user.id)

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -27,7 +27,7 @@ suspend fun TelegramBot.promoteChannelAdministrator(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = execute( ): Boolean = execute(
PromoteChannelAdministrator( PromoteChannelAdministrator(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -48,7 +48,7 @@ suspend fun TelegramBot.promoteChannelAdministrator(
) )
) )
suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -65,7 +65,7 @@ suspend fun TelegramBot.promoteChannelAdministrator(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = promoteChannelAdministrator( ): Boolean = promoteChannelAdministrator(
chat.id, chat.id,
userId, userId,
untilDate = untilDate, untilDate = untilDate,
@@ -84,7 +84,7 @@ suspend fun TelegramBot.promoteChannelAdministrator(
canDeleteStories = canDeleteStories canDeleteStories = canDeleteStories
) )
suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -101,7 +101,7 @@ suspend fun TelegramBot.promoteChannelAdministrator(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = promoteChannelAdministrator( ): Boolean = promoteChannelAdministrator(
chatId, chatId,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -120,7 +120,7 @@ suspend fun TelegramBot.promoteChannelAdministrator(
canDeleteStories = canDeleteStories canDeleteStories = canDeleteStories
) )
suspend fun TelegramBot.promoteChannelAdministrator( public suspend fun TelegramBot.promoteChannelAdministrator(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -137,7 +137,7 @@ suspend fun TelegramBot.promoteChannelAdministrator(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = promoteChannelAdministrator( ): Boolean = promoteChannelAdministrator(
chat.id, chat.id,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,

View File

@@ -9,7 +9,7 @@ import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -21,7 +21,7 @@ suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
) = execute( ): Boolean = execute(
PromoteChatMember( PromoteChatMember(
chatId, chatId,
userId, userId,
@@ -37,7 +37,7 @@ suspend fun TelegramBot.promoteChatAdministrator(
) )
) )
suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -49,7 +49,7 @@ suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
) = promoteChatAdministrator( ): Boolean = promoteChatAdministrator(
chat.id, chat.id,
userId, userId,
untilDate, untilDate,
@@ -63,7 +63,7 @@ suspend fun TelegramBot.promoteChatAdministrator(
canManageChat canManageChat
) )
suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -75,7 +75,7 @@ suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
) = promoteChatAdministrator( ): Boolean = promoteChatAdministrator(
chatId, chatId,
user.id, user.id,
untilDate, untilDate,
@@ -89,7 +89,7 @@ suspend fun TelegramBot.promoteChatAdministrator(
canManageChat canManageChat
) )
suspend fun TelegramBot.promoteChatAdministrator( public suspend fun TelegramBot.promoteChatAdministrator(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -101,7 +101,7 @@ suspend fun TelegramBot.promoteChatAdministrator(
canPromoteMembers: Boolean? = null, canPromoteMembers: Boolean? = null,
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
) = promoteChatAdministrator( ): Boolean = promoteChatAdministrator(
chat.id, chat.id,
user.id, user.id,
untilDate, untilDate,

View File

@@ -8,7 +8,7 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( public suspend fun TelegramBot.promoteChatMember(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -27,7 +27,7 @@ suspend fun TelegramBot.promoteChatMember(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = execute( ): Boolean = execute(
PromoteChatMember( PromoteChatMember(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -51,7 +51,7 @@ suspend fun TelegramBot.promoteChatMember(
) )
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( public suspend fun TelegramBot.promoteChatMember(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -70,7 +70,7 @@ suspend fun TelegramBot.promoteChatMember(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = promoteChatMember( ): Boolean = promoteChatMember(
chat.id, chat.id,
userId, userId,
untilDate = untilDate, untilDate = untilDate,
@@ -92,7 +92,7 @@ suspend fun TelegramBot.promoteChatMember(
) )
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( public suspend fun TelegramBot.promoteChatMember(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -111,7 +111,7 @@ suspend fun TelegramBot.promoteChatMember(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = promoteChatMember( ): Boolean = promoteChatMember(
chatId, chatId,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -133,7 +133,7 @@ suspend fun TelegramBot.promoteChatMember(
) )
@Warning("This method is too common. Use it with caution") @Warning("This method is too common. Use it with caution")
suspend fun TelegramBot.promoteChatMember( public suspend fun TelegramBot.promoteChatMember(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -152,7 +152,7 @@ suspend fun TelegramBot.promoteChatMember(
canPostStories: Boolean? = null, canPostStories: Boolean? = null,
canEditStories: Boolean? = null, canEditStories: Boolean? = null,
canDeleteStories: Boolean? = null canDeleteStories: Boolean? = null
) = promoteChatMember( ): Boolean = promoteChatMember(
chat.id, chat.id,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,

View File

@@ -10,7 +10,7 @@ import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.chat.PublicChat import dev.inmo.tgbotapi.types.chat.PublicChat
import dev.inmo.tgbotapi.types.chat.User import dev.inmo.tgbotapi.types.chat.User
suspend fun TelegramBot.promoteSupergroupAdministrator( public suspend fun TelegramBot.promoteSupergroupAdministrator(
chatId: ChatIdentifier, chatId: ChatIdentifier,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -24,7 +24,7 @@ suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
) = execute( ): Boolean = execute(
PromoteSupergroupAdministrator( PromoteSupergroupAdministrator(
chatId = chatId, chatId = chatId,
userId = userId, userId = userId,
@@ -42,7 +42,7 @@ suspend fun TelegramBot.promoteSupergroupAdministrator(
) )
) )
suspend fun TelegramBot.promoteSupergroupAdministrator( public suspend fun TelegramBot.promoteSupergroupAdministrator(
chat: PublicChat, chat: PublicChat,
userId: UserId, userId: UserId,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -56,7 +56,7 @@ suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
) = promoteSupergroupAdministrator( ): Boolean = promoteSupergroupAdministrator(
chat.id, chat.id,
userId, userId,
untilDate = untilDate, untilDate = untilDate,
@@ -72,7 +72,7 @@ suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageTopics = canManageTopics canManageTopics = canManageTopics
) )
suspend fun TelegramBot.promoteSupergroupAdministrator( public suspend fun TelegramBot.promoteSupergroupAdministrator(
chatId: IdChatIdentifier, chatId: IdChatIdentifier,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -86,7 +86,7 @@ suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
) = promoteSupergroupAdministrator( ): Boolean = promoteSupergroupAdministrator(
chatId, chatId,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,
@@ -102,7 +102,7 @@ suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageTopics = canManageTopics canManageTopics = canManageTopics
) )
suspend fun TelegramBot.promoteSupergroupAdministrator( public suspend fun TelegramBot.promoteSupergroupAdministrator(
chat: PublicChat, chat: PublicChat,
user: User, user: User,
untilDate: TelegramDate? = null, untilDate: TelegramDate? = null,
@@ -116,7 +116,7 @@ suspend fun TelegramBot.promoteSupergroupAdministrator(
canManageVideoChats: Boolean? = null, canManageVideoChats: Boolean? = null,
canManageChat: Boolean? = null, canManageChat: Boolean? = null,
canManageTopics: Boolean? = null, canManageTopics: Boolean? = null,
) = promoteSupergroupAdministrator( ): Boolean = promoteSupergroupAdministrator(
chat.id, chat.id,
user.id, user.id,
untilDate = untilDate, untilDate = untilDate,

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