mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 12:00:18 +00:00
Compare commits
959 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 72781487f0 | |||
| de435e5dbc | |||
| f975754058 | |||
| 0f7536a21c | |||
| d4c085c9b6 | |||
| 667c49f13d | |||
| e1d9ebff90 | |||
| fbc7088dad | |||
| 4ba9c8ee97 | |||
| 92611b5c26 | |||
| 2e1c0d41ec | |||
| 3ce56745f4 | |||
| 1bc9ee4d5a | |||
|
|
0650fc594f | ||
| 2f4de37489 | |||
| cec5a0af12 | |||
| 5e5dc6b36b | |||
| 19265357a2 | |||
| 49c2836e62 | |||
| f7476188eb | |||
| 2ba447b126 | |||
| 3bd4fab3fe | |||
| 9e4d7dd9f9 | |||
| 586a61157d | |||
| 045265f0f8 | |||
| c125eadaa4 | |||
| 3dd0a91c54 | |||
| 2ecd42c859 | |||
| 3857950141 | |||
| 6d5bedd315 | |||
| 69a9e8f820 | |||
| 6d8693a003 | |||
| c990d987f5 | |||
| b8530f14ca | |||
| db8bac9b52 | |||
| e53b3b8198 | |||
| 71ccfc88cc | |||
| dd2923f92d | |||
| ff78153591 | |||
| e2ce9cfebf | |||
| 0a01d2567e | |||
| e4fb45c09b | |||
| db0df975c7 | |||
| 2003b314a3 | |||
| 55a78375be | |||
|
|
256607e336 | ||
| 92f2a5afdb | |||
| 3affcf4399 | |||
| 67dfa19a1b | |||
| 86e83f7f1a | |||
| 429fc5d2f9 | |||
| d19e6ad4e0 | |||
| 134145f441 | |||
| ef76fe52ca | |||
| bab69f523a | |||
| 91f4d3bf24 | |||
| 3e316dfde0 | |||
| 1ef49ad48c | |||
| 9297824dc3 | |||
| d02ed592d8 | |||
| 6ea9a28c7c | |||
| 88fc4fc444 | |||
| dd0de3b6d4 | |||
| 838fff8207 | |||
| 751a77f6d8 | |||
| 222fe7594f | |||
| ed6d4d07c6 | |||
| 78d9ce8d19 | |||
| 345009da32 | |||
| de47497223 | |||
| 7477625380 | |||
| 970abf8cde | |||
| 5a7741faf6 | |||
| 8aa29e56d3 | |||
| dab5e072d0 | |||
| 94078939d1 | |||
| 824d3862e3 | |||
| 44f92e8d6c | |||
| ddb79c0d8d | |||
| a9562cc8f9 | |||
| 8a351d5be0 | |||
| 8cd5659b7b | |||
| 1474a07b9e | |||
| c13a0d3193 | |||
| 172f49fa6b | |||
| 4d42972a7e | |||
| c0883d0180 | |||
| e7367da3cb | |||
| effd12711f | |||
| ef1d2e8242 | |||
| 881763f3af | |||
| d36b11c002 | |||
| d2395e836c | |||
| c8c008edd3 | |||
| 3b4fa06924 | |||
| 5d428a5e54 | |||
| 8964e08ce6 | |||
| 745168d181 | |||
| a408c6c7c7 | |||
| e0f5e9b640 | |||
| 0331ff2f42 | |||
| a21d0b56db | |||
|
|
6ea8afee8f | ||
|
|
8799aeca26 | ||
| c610f4eab2 | |||
| 92cd2a3def | |||
| 03d158b03b | |||
|
|
608fde4139 | ||
| 9e56a6cc1a | |||
| c0e3c1d02f | |||
| 341a527d27 | |||
|
|
8d6d70a06a | ||
|
|
67fb552d01 | ||
|
|
93e937aa6a | ||
|
|
09dee188d2 | ||
|
|
29c6bb5dac | ||
| c266ab0120 | |||
|
|
b407fc5c86 | ||
|
|
1bde43ceaf | ||
|
|
389a508fa7 | ||
|
|
69c2586b50 | ||
|
|
7e80f4edac | ||
|
|
99987c3f51 | ||
|
|
713130fd13 | ||
| deb8d7b43a | |||
| b604444f7d | |||
|
|
cb6127bf91 | ||
|
|
d40919f099 | ||
|
|
7cb576e6b1 | ||
|
|
b53fb8da36 | ||
|
|
03ea8dfe7f | ||
|
|
314c8d9ad1 | ||
|
|
6fceee4199 | ||
|
|
e720da708c | ||
|
|
d65706631f | ||
|
|
3312b64564 | ||
|
|
1bfe431393 | ||
|
|
6485353704 | ||
|
|
46a1ed27b7 | ||
|
|
9f3024476c | ||
|
|
93d0e009bb | ||
|
|
ef60549e1c | ||
|
|
2ac83156f6 | ||
|
|
4c9d888668 | ||
|
|
cd3ba8f480 | ||
|
|
99559f477e | ||
|
|
a3949c752d | ||
| fd48a52266 | |||
| 3e0036f7df | |||
| 2978932c87 | |||
| c773736fb8 | |||
| 8a3a05ef12 | |||
| 0afbe8ef2d | |||
| 3f4018f969 | |||
| 097d82b4b4 | |||
| 7c2a379161 | |||
| ba5f76e8cd | |||
| 8aec920a15 | |||
| c92bd33ba1 | |||
| 51927974f5 | |||
| 9350f87e19 | |||
| 6cb9950b36 | |||
| 974c2e883f | |||
| af6f98fd56 | |||
| 75a2b2c282 | |||
| d66d4b4209 | |||
| 9d54820fd7 | |||
| 1876df2c2d | |||
| d818592cd3 | |||
| c29737b6b3 | |||
| 46243a21eb | |||
| d5f45ead59 | |||
| 5a696cdac0 | |||
| 80955eeb55 | |||
| 6ee93e2d68 | |||
| d4490dec75 | |||
| 7d3e9325f1 | |||
| 31a66eb8e6 | |||
| b3b9070cd6 | |||
| 3504776344 | |||
| f22f69534a | |||
| a9c1d7b33c | |||
|
|
376ef0750c | ||
| cdf93e0d12 | |||
| 8c7261fda9 | |||
| 82acc8cb1f | |||
| 4ec1532597 | |||
| 13bfe681d8 | |||
| 5bbbcdb529 | |||
| 7f9d6ce626 | |||
| 71b944f9cc | |||
| d9d68749f1 | |||
| 561aad2274 | |||
| 6a3e95c488 | |||
| a09b3809e2 | |||
| 427b5775a2 | |||
| d222987fc7 | |||
| d211afa26a | |||
| 9952b6c6ae | |||
| 840c6b02a4 | |||
| a6f91d5600 | |||
| 8ec0c8804b | |||
| 2d08c447bc | |||
| 9a0793d81c | |||
| a95f556a5c | |||
| f774b11de4 | |||
|
|
5164903d05 | ||
| adaedb8040 | |||
| 9b4b60eb33 | |||
| b90f8ec389 | |||
| e95550a6eb | |||
| 696219df24 | |||
| 27241fad32 | |||
| a034fa18d7 | |||
| adcaffe115 | |||
| 6388d8db13 | |||
| 2964586cb9 | |||
| e3cb1e4faf | |||
| d7f14020d8 | |||
| 397197023e | |||
| 12dc93313a | |||
| 625760afae | |||
| 795328afdf | |||
| 57175b7698 | |||
| 2d05a334eb | |||
| 0b6d9e47b9 | |||
| 4cdae11adc | |||
| 04b2d1dbd6 | |||
| 4343d6d161 | |||
| 6824f2c992 | |||
| 9cde4927ce | |||
| 819982473a | |||
| 5559923339 | |||
| c7d08df3bf | |||
| 41a142addb | |||
| 652765bf46 | |||
| 32010cf1c7 | |||
| 1c6359f041 | |||
| 4ac5e405ac | |||
| bc00e1f28a | |||
| 191e4cff00 | |||
| de91cc5382 | |||
| 96b872953b | |||
| 433b0989ee | |||
| eddd60ebb1 | |||
| 8b63ed7fa9 | |||
| 85539a9d58 | |||
| ad4bac82dc | |||
| 300be87ffd | |||
| 05f46d08c8 | |||
| eb72ff1c94 | |||
| 6b3fabdb30 | |||
| 402e695f99 | |||
| a87560bc40 | |||
| 6d300de470 | |||
| 3658403f01 | |||
| 082aeab700 | |||
| 4eb6fa7835 | |||
| ddf34aad3f | |||
| c818a44044 | |||
| d578f6af90 | |||
| 5ce4e4cbc0 | |||
| 41e369cea5 | |||
| f85d4a36e1 | |||
| fb3b8a7415 | |||
| 609c2b5fad | |||
| 2c602e4434 | |||
| 1a3c9bca1d | |||
|
|
43496505a7 | ||
| 4a0c0bdc40 | |||
| fa9c95f799 | |||
| dd6f7577ba | |||
| 7d47d0ab61 | |||
| 636c01acb9 | |||
| 479923a04a | |||
| ccfa6e7b6d | |||
| 65048648b8 | |||
| 50b2db8859 | |||
| 45bbcb5ec1 | |||
| dc463b5626 | |||
| d80e578a4c | |||
| b26d21a817 | |||
| 2052072e5d | |||
| 6fb3d3fcb1 | |||
| c39e9fc156 | |||
| 9c5793bec7 | |||
| fd9bff611b | |||
| bb66279044 | |||
| 24b48f2536 | |||
| 670c26c982 | |||
| 7ed5d9ceed | |||
| 787941fcaf | |||
| 6c9f1bc016 | |||
| e5bffa7c51 | |||
|
|
3fe26b057a | ||
| dccd15a5e9 | |||
| 3d14c93d89 | |||
| b8a6534b6a | |||
| f5529033ec | |||
| 482c375327 | |||
| abb8b3491d | |||
| 2953005e6d | |||
| 1f6ddd97e3 | |||
| bc8da1120e | |||
| e895c2f3a8 | |||
| f84180b3ff | |||
| c21c8c5a26 | |||
| 27416daeb8 | |||
| b5b7482c2f | |||
| a7f4ab36c6 | |||
| 7398e53b85 | |||
| be25f705ef | |||
| 5ee87ac78d | |||
| fbd53e1f2d | |||
| 9fe8df9e11 | |||
| a053c08346 | |||
| 6fa769bce3 | |||
| 27ac8ee797 | |||
| ce84e3c198 | |||
| c3a3e9bd44 | |||
| 7b6be48ba8 | |||
| e98d5c7a9c | |||
| 7db4f47e82 | |||
| 42985cfa37 | |||
| 02be5b5e48 | |||
| be87e3c736 | |||
| ccced36cd5 | |||
| af4c843369 | |||
| f0bd4c3719 | |||
| b3dfef9a38 | |||
| 2e2abb8e15 | |||
| 3cbfb2fb0b | |||
| b60b0259db | |||
| 5d8deb4b9b | |||
| d347c94c8b | |||
| 6809b9d2ef | |||
| 1980f8a9ca | |||
| 3f726c9b3b | |||
| 4b8de04380 | |||
| e4ac100b38 | |||
| f76e88c880 | |||
| 19cb970461 | |||
| 159c5892e3 | |||
| b03eef8bcb | |||
| 89360235a6 | |||
| 5b4a7d912e | |||
| 6ba2b70f10 | |||
| 9f2ccde589 | |||
| 048599414a | |||
| 87ed66e3ad | |||
| e8a280c90d | |||
| b0d8abf6df | |||
| dd054f1e07 | |||
| 10d92c2fdb | |||
| 2d40af21fe | |||
| 93d1afdf1c | |||
| 39de983d42 | |||
|
|
49448408d1 | ||
|
|
04ead7e73d | ||
|
|
5175395be2 | ||
|
|
38e1d271ba | ||
| 6d90e571d9 | |||
| c03440c353 | |||
| d7e9c6a3a1 | |||
| f711eb013a | |||
| e422c3bc33 | |||
| c8d6b759b7 | |||
| 8823b268cc | |||
| 49031bf0e6 | |||
| c72f8e04ec | |||
| a56ad7d671 | |||
| 77158ffecf | |||
| 1990e6b158 | |||
| 40d3388c74 | |||
| ac6cf6e0b2 | |||
| 1dc9dc42fb | |||
| b7ff6a3061 | |||
| 76eae0a54f | |||
| e9a172565e | |||
| 49f7954db7 | |||
| 9c43fecf41 | |||
| 228ecba6cc | |||
| dfecf93dd5 | |||
| b469b1c789 | |||
| f58a28d062 | |||
|
|
21ba1cca30 | ||
| 40c5af4469 | |||
|
|
e8e7329f52 | ||
| a162c3a8e2 | |||
| e9f7028a20 | |||
| ecd8ca7d4d | |||
| 6fcd327ca4 | |||
| c6b809eb66 | |||
| 037f9974da | |||
| b2fcdc40d5 | |||
| 6016387e07 | |||
| 96bbf5fc81 | |||
| f7cf37f338 | |||
| 8e3e44769e | |||
| 2d11685b7b | |||
| 8bb3095fb1 | |||
| 799ad6ca66 | |||
| bd6ff747cb | |||
| 010c52adeb | |||
| 88008b7cfc | |||
| 42b32af986 | |||
| 4944c972a6 | |||
| 83445dd314 | |||
| 53ae56e887 | |||
| 1c587abcdc | |||
| 99f95ffc40 | |||
| a8ed162c9c | |||
| e5ea980347 | |||
| 4ce26c707e | |||
| 4343dbbde8 | |||
| cdecce96e7 | |||
| 8a6e06bbf0 | |||
| f767362c41 | |||
| 9bf7c621a4 | |||
|
|
4085913bc3 | ||
|
|
f36373b718 | ||
|
|
ed39fde776 | ||
|
|
b8837bffdc | ||
|
|
cad6b26fdc | ||
|
|
52f17178ab | ||
|
|
6fa0ca3b89 | ||
| fb00c0b8ef | |||
| 343c8a4319 | |||
| a368356c6f | |||
| f8e87ac49b | |||
| 6a2e8400c1 | |||
|
|
40613e3418 | ||
|
|
016cfcb7cd | ||
| e797546edb | |||
| 16ca2bd984 | |||
| fb796254cf | |||
| 77bd649251 | |||
| 1471381b12 | |||
| fc6c1da3e0 | |||
| ebac413997 | |||
|
|
9fa17c1360 | ||
|
|
982b401b28 | ||
|
|
26b864a314 | ||
|
|
f2fae9184f | ||
|
|
32db4a19d2 | ||
|
|
613f6de483 | ||
|
|
f89849218a | ||
|
|
05341be534 | ||
| 45b99d85ff | |||
| a0fdebd13e | |||
| fb1ff6e4fd | |||
| 6f64ed1032 | |||
| 91a5340b23 | |||
| 8883a9ee51 | |||
| 610ada505f | |||
| 236f484e10 | |||
|
|
3383bcaff3 | ||
|
|
83352dd284 | ||
| b27efd118b | |||
|
|
18fcb6bb97 | ||
| 5baa09f0c1 | |||
|
|
bfff55ab08 | ||
|
|
051922b4c2 | ||
| 9dd80be36d | |||
|
|
873905a288 | ||
|
|
f8066431d3 | ||
| 5c655dd84c | |||
| 00aefefc31 | |||
|
|
d865a60151 | ||
| 1eef5bb239 | |||
|
|
0457792d99 | ||
|
|
8c9f0ae922 | ||
|
|
44a8186830 | ||
|
|
d4698301ad | ||
|
|
b7d3d849eb | ||
|
|
cb33176e8b | ||
|
|
6edf466220 | ||
| 0d4452d0f5 | |||
| e02f74d77d | |||
| 47a8739db5 | |||
| 760e8b0491 | |||
| fe518a0d8f | |||
| 227849a14c | |||
| 9e2c23cf2d | |||
| acd241e31e | |||
| 9cfc98bb67 | |||
| 6a9407f15c | |||
| af79e26855 | |||
| 02a404b805 | |||
| f2e97df44c | |||
| 63a695dcc5 | |||
| 66cf0689e1 | |||
| c7b8187829 | |||
| 5cfc350c13 | |||
| a3ef66bbfb | |||
| 738728f647 | |||
| abbb4e2dff | |||
| c3fa8a6d33 | |||
| fb2b912f93 | |||
| 46c5c62e15 | |||
| 60fdbb8ac4 | |||
| 86bd5eaa07 | |||
| 57122cc2f9 | |||
| 91a8058a3a | |||
| 97836c5f4e | |||
| 1a8cfefa4d | |||
| 0e97a63103 | |||
| 24269cc774 | |||
| d960d94c0d | |||
| 663d63b009 | |||
| 7118631213 | |||
| ff34017a03 | |||
| 96a7a2acab | |||
| 71c830fc2e | |||
| 271e7d2157 | |||
| cf5e5a1d1e | |||
| 186d6931ac | |||
| 6ec686040c | |||
| 211cef298c | |||
| 8de41bdd99 | |||
| 7a5c9c7ef8 | |||
| 4dec85ee60 | |||
| 4622509356 | |||
| 30e44d6bf2 | |||
| e403bbca0b | |||
| 93e06a5765 | |||
| 718f6ab366 | |||
| 6f776576ab | |||
| fcdaeb2e8f | |||
| 1e679ce50b | |||
| fe4be69051 | |||
| 06ba14e8be | |||
| ca1b196942 | |||
| dc5d8afe32 | |||
| b843fd9188 | |||
| d56173eceb | |||
| 97621bca67 | |||
| 7e986b2088 | |||
| cfc2fd1b47 | |||
| 905486fff9 | |||
| 6acf4bc927 | |||
| 64a1aeef2c | |||
| 6db88eb8bd | |||
| 4e416aaf44 | |||
| 71b9f15e40 | |||
| 4dc2bfc8bf | |||
| 31c1055f3d | |||
| 3da2229a9c | |||
| 624289cc8e | |||
| 9edc8a0d5a | |||
| 3bf914471a | |||
| 7d3c8a2d27 | |||
| f12628bec3 | |||
| c1734e6d12 | |||
| 4bff860c01 | |||
| 6a8b83f750 | |||
| ab9718b7c6 | |||
| 0a9235bcd9 | |||
| eff2f2ba41 | |||
| db644c93ff | |||
| 28e031265c | |||
| 84abd006ad | |||
| 5f4a327c2e | |||
| c5102590cc | |||
| 072264faad | |||
| 6b74bc155e | |||
| 9d506b11a3 | |||
| f47b3673a7 | |||
| dbb8be502a | |||
| 170747741f | |||
| e4a3acdd68 | |||
| 953bdef657 | |||
| 64ef0fa160 | |||
| c1f40c1030 | |||
| 8de584b292 | |||
| cb7bb01671 | |||
| a7b2bb820b | |||
| be9c0cff61 | |||
| 6ac6ad0c0a | |||
| dbc69def0b | |||
| b8061966be | |||
| 0e0af73633 | |||
| 2a2aeed045 | |||
| fdc007f609 | |||
| dec55cfb2d | |||
| 3997af171e | |||
| d963cdae35 | |||
| 8ec209422a | |||
| 8ca86b1e14 | |||
| ffba4e9cef | |||
| 544192ad5f | |||
| 08b0564dba | |||
| 009c49247d | |||
| dd7a3ced4d | |||
| ceff85fcfd | |||
| bb62f9fbd6 | |||
| 7bbbf54775 | |||
| 1b506cb820 | |||
| 3f988d1529 | |||
| 2da28cea01 | |||
| 42e6013d95 | |||
| 3c8dbe70dc | |||
| 4a1989fb79 | |||
| b559dbbe66 | |||
| d72fb6e3e8 | |||
| 092722fad8 | |||
| 63633e8891 | |||
| 61cdfa264e | |||
| 6262b0581a | |||
| 8694b31066 | |||
| 5a541271b8 | |||
|
|
9b14e9079b | ||
| fd26d14380 | |||
| 3ebaef0789 | |||
| 51bb0a021f | |||
| b7c1692efa | |||
| bce5fb658c | |||
| b9bc40187f | |||
| 3da4ee4808 | |||
| 6571e8f592 | |||
| 5c13047a0b | |||
| 4908bb2cfe | |||
| a01ca43837 | |||
| a9a01e3154 | |||
| 468c54a30f | |||
| 9177e01910 | |||
| 417f72af4a | |||
| df6d70b20d | |||
| 0b12df14db | |||
| 1590e1eef2 | |||
| 6896bc0772 | |||
| ce1abb0ae2 | |||
| ac63d52b14 | |||
| e902f85b36 | |||
| 225fedde3a | |||
| 66e31e5d0c | |||
| 852065ad38 | |||
| d88fc2c9c0 | |||
| 4d92588390 | |||
| 89524290c5 | |||
| 86c86dfb8a | |||
| bdae774c62 | |||
| d70c7fdbdf | |||
| f14885a541 | |||
| 0013e91f6e | |||
| aa315f6fec | |||
| 9425380002 | |||
| 0f5bce592b | |||
| 294f80032c | |||
| a4064a15ec | |||
| 7e5064ba3c | |||
| eac45b86a6 | |||
| f0448485c8 | |||
| f2308f0312 | |||
| 76a2cfd1a0 | |||
|
|
edca5494d4 | ||
| d480c9efd6 | |||
| a106068af4 | |||
| d55253a81b | |||
| adede330fb | |||
| f2f370e40e | |||
| 86bb87bb37 | |||
| bb80eb43fd | |||
| a692ed65f3 | |||
| 60e50f9492 | |||
| e28f3492ef | |||
| f637b480b1 | |||
| 955e9ca871 | |||
| 8df72edd52 | |||
| f3b05bbffd | |||
| 95011e2b3e | |||
| cad0bf8a95 | |||
| f760e60089 | |||
| 6c76e1c47a | |||
| b5f4219635 | |||
| 5190f7b856 | |||
| 14756fd6e8 | |||
| e66537ee32 | |||
| 825ecc1d73 | |||
| 05bfbfe381 | |||
| 430240a6ad | |||
| 860e35258c | |||
| d9c39d7a26 | |||
| 52fd55eea5 | |||
| cb11532b58 | |||
| dce63713f9 | |||
| fb9ff653ef | |||
| 57f53813c8 | |||
| fc183bfd2f | |||
| c025a027c6 | |||
| db2101d85c | |||
| a01a9910b5 | |||
| 4e1ecc0e34 | |||
| 90225a9380 | |||
| 3026c8708d | |||
| 63975cc88e | |||
| a622c4d6fa | |||
| e124bb18df | |||
| 152728afca | |||
| 38d672b665 | |||
| d2c299301a | |||
| 25fb6b2b46 | |||
| 5b5de5253c | |||
| 9a7dd6ec9a | |||
| 4085f721be | |||
| ffc915cae1 | |||
| a6c90b3df5 | |||
| a6d9fa6ce3 | |||
| 7fd2442f8b | |||
| 8b37ecea9e | |||
| 35fc9f60df | |||
| 68e89dc1ad | |||
| 129fb31b74 | |||
| a2c353ca41 | |||
| cb74abfce5 | |||
| ca7314923e | |||
| 74f625a53a | |||
| 3a5fed3dd9 | |||
| 6158143220 | |||
| f8182ddb85 | |||
| b7c3f9f607 | |||
| 8763ea23fa | |||
| b412e7b3b7 | |||
| 98e5d182bb | |||
| ffc0f5abb7 | |||
| 816cf00dac | |||
| e34bc7453e | |||
| 3b2ccbf33b | |||
| 6ecfbdf56d | |||
| b49e1c50f5 | |||
| d7389dfcfe | |||
| cf5cee3e53 | |||
| 8593263506 | |||
| 4422a4d09b | |||
| 9ecb50e377 | |||
| 8a4b40c6ec | |||
| bba667db30 | |||
| ca0d256bbb | |||
| dc2fd07632 | |||
| 32fe008eef | |||
| 2b938903b6 | |||
| 080db09d2c | |||
| 0efa52fe00 | |||
| c4214798e3 | |||
| fdf510153d | |||
| edb16d7107 | |||
| c49f400201 | |||
| db7de6edf8 | |||
| a0b14233e0 | |||
| 1a479706e2 | |||
| 2719e166a8 | |||
| 051684db23 | |||
| 805cec76ce | |||
| 899c195fd5 | |||
| f5937fc4d6 | |||
| 8cf7b349df | |||
| bf8f8b9e6f | |||
| edc0b1c492 | |||
| a85d58aac1 | |||
| 10860e1bb2 | |||
| 46e6eeca9d | |||
| 80be86454d | |||
| d5f5a0e30b | |||
| 826c27874d | |||
| 4e917e8cf8 | |||
| 051210caf5 | |||
| 284fe58848 | |||
| 38c9732da5 | |||
| dee13c03ae | |||
| 6103b70a47 | |||
| 96ffae2062 | |||
| 4180721aed | |||
| 4ab0845333 | |||
| 3f9a4e95a3 | |||
| 834d60ff16 | |||
| 650d96974f | |||
| 7f5cd0567b | |||
| af159b89b6 | |||
| efe286c181 | |||
| 821bb5b45c | |||
| c92ed92f7c | |||
| 88f6b349ea | |||
| 6c4afac8f8 | |||
| 6273990b00 | |||
| 1a1fd926dd | |||
| affa2a3a57 | |||
| 73a748d8b3 | |||
| fa4d264df4 | |||
| 1b1da33882 | |||
| ccfb774f33 | |||
| 5215e8a315 | |||
| 97a3901cb9 | |||
| 034e87a8ef | |||
| 156fbd72d4 | |||
| 8ec3e01737 | |||
| 1655bedabe | |||
| ac6b580a7e | |||
| c6692c2509 | |||
| 12846a68b9 | |||
| 21f5808b12 | |||
| 64244a60fe | |||
| 4cd7fdb436 | |||
| 6daf98d47d | |||
| c260597799 | |||
| d59e204002 | |||
| 117d891ff2 | |||
| 1e451af508 | |||
| 051f5e22e7 | |||
| 6873c23309 | |||
| a65971be00 | |||
| 4b5baaff8c | |||
| 0840d2e083 | |||
| 085a225eb4 | |||
| b575871a8e | |||
| c96e162845 | |||
| c471d59b3c | |||
| 187f340e88 | |||
| 77ea1f741e | |||
| bff2713bbd | |||
| cf666aad11 | |||
| 93e72230a1 | |||
| b81308da8b | |||
| 0441b53da2 | |||
| 4853a5b3ad | |||
| 40a0d2c37d | |||
| 2e815a4c37 | |||
| 81ed820602 | |||
| b3a657b7d6 | |||
| 8247e7c69c | |||
| 67b7472868 | |||
| 13e4740d0a | |||
| 48db305541 | |||
| 6f512a144c | |||
| cf46139bef | |||
| 14a583e154 | |||
| 5b6753c484 | |||
| f153b31464 | |||
| 6f60ecbf2e | |||
| 9c57ba4da7 | |||
| d84d982eb4 | |||
|
|
2f6f40362a | ||
| e15b18fbcf | |||
| ad5cc6ade6 | |||
| 6b94215a7c | |||
| 9c98411bcb | |||
| b235ab1c28 | |||
| d4e11494e8 | |||
| e6dbf2bde9 | |||
| 5aa0284f28 | |||
| 8b2a50a21f | |||
| a7839df748 | |||
| 3155969954 | |||
| 067a0bf229 | |||
| 009991fa88 | |||
| ffbe8fc5e0 | |||
| 610ed95296 | |||
| d3f4a895ff | |||
| 51c7c376d7 | |||
| 393197eca1 | |||
| 67096f8e0e | |||
| c312a05d6b | |||
| b575695f90 | |||
| 65bcf83517 | |||
| f07a179448 | |||
| ed2c447730 | |||
| cb4c48d025 | |||
| 1a21fa85ac | |||
| 191fa5406d | |||
| 6959dacfc4 | |||
| ced11ab336 | |||
| 6686aef4fa | |||
| 9ede545e56 | |||
| a74066cf62 | |||
| 0a7e99bbb3 | |||
| 913f584469 | |||
| 20278804bf | |||
| 631f1b9427 | |||
| 5e0106beb5 | |||
| d37e01f93e | |||
|
|
d4492ec7ac | ||
| 60d24259f4 | |||
| 8e6b3b7260 | |||
| e2cbd5ee0b | |||
| 1e87677ea7 | |||
| cb3494cb39 | |||
| ce81be9dcb | |||
| 2cc02c8c85 | |||
| f5b2ee79d6 | |||
| 0ba6ebb20f | |||
| 3d2df4e255 | |||
| 33b6ff1c1e | |||
| 2859f8ca2f | |||
| f1aa67ceda | |||
| 1c66d1e2fc | |||
| 44e6d7adbc | |||
| 61a6d4a880 | |||
| e37237cb71 | |||
| 9a5a196e41 | |||
| 68f6d8553c | |||
| 6fe8e73fca | |||
| 241545c0cb | |||
| 3b2310ece1 | |||
| e1adde0978 | |||
| 3b17bce71a | |||
| 999efc64eb | |||
| 05c99642cb | |||
| cd6f4831ae | |||
| 2778315aed | |||
| ff8d67a780 | |||
| 2a5f9a629d | |||
| 75b27858dd | |||
| 034e2d7ff3 | |||
| 1f69c16f2a | |||
| 8d24512413 | |||
| 09009003e3 | |||
| 048486146c | |||
| b688fa570a | |||
| 0eba0c4e15 | |||
| f8bbfa2b1e | |||
| fec2715dc1 | |||
|
|
941a25b116 | ||
| 741d808db2 | |||
| 69683a4e6a | |||
| e5a48e9684 | |||
| 6722ab5f50 | |||
| 810b2ab5a1 | |||
| 5992fdd456 | |||
| 3c4f8787a6 | |||
| 0c24aa1270 | |||
| 988d9995c5 | |||
| f75df0a425 | |||
| 9f14eb2ca3 | |||
| 6f9f880b79 | |||
| 2d2310daca | |||
| dff04d26ca | |||
| 4390c12180 | |||
| 1b4d13e452 | |||
| afda5e0e7f | |||
| cd354e9456 | |||
| b0e32e8ad9 | |||
| 79c9e6258f | |||
| 90b9c66bea | |||
| e7b21dcd3d | |||
| e30361ad1e | |||
| d8c659f866 | |||
| 5533303d86 | |||
| 1633b9baaf | |||
| a9725eb439 | |||
| a0aadef31b | |||
| ac88fd1d02 | |||
| e3e318312d | |||
| 4c08fb7d26 | |||
| d83ff12560 | |||
| 818ef8481d | |||
| f8cd446133 | |||
| 804b991921 | |||
| 817068aa71 | |||
|
|
0cca343612 | ||
| 6532bf255b |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,3 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
custom: ['https://www.tinkoff.ru/rm/ovsyannikov.aleksey113/ObMJ712472', 'https://boosty.to/insanusmokrassar']
|
||||
custom: ['https://tonscan.org/address/UQAtuSLJ76Zehc3qP-eRYMR98fPIu_oOp_atcpVX55zxHwTU']
|
||||
|
||||
3
.github/workflows/greetings.yml
vendored
3
.github/workflows/greetings.yml
vendored
@@ -5,6 +5,9 @@ on: [pull_request, issues]
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
pull-requests: write
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
|
||||
6
.github/workflows/kdocs.yml
vendored
6
.github/workflows/kdocs.yml
vendored
@@ -10,12 +10,12 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
java-version: 17
|
||||
- name: Build
|
||||
run: ./gradlew dokkaHtml
|
||||
run: ./gradlew dokkaHtmlMultiModule
|
||||
- name: Publish KDocs
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/build/dokka/html
|
||||
publish_dir: ./build/dokka/htmlMultiModule
|
||||
publish_branch: kdocs
|
||||
|
||||
23
.github/workflows/packages_publishing.yml
vendored
23
.github/workflows/packages_publishing.yml
vendored
@@ -7,23 +7,30 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
java-version: 17
|
||||
- name: Setup LibCurl
|
||||
run: sudo apt update && sudo apt install -y libcurl4-openssl-dev
|
||||
- name: Rewrite version
|
||||
run: |
|
||||
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
||||
cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
||||
rm gradle.properties
|
||||
mv gradle.properties.tmp gradle.properties
|
||||
- name: KotlinSymbolProcessing execution
|
||||
run: ./gradlew kspCommonMainKotlinMetadata
|
||||
- name: Build
|
||||
run: ./gradlew build
|
||||
- name: Publish to Gitea
|
||||
continue-on-error: true
|
||||
run: ./gradlew publishAllPublicationsToGiteaRepository
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
- name: API compatibility check
|
||||
run: ./gradlew apiCheck
|
||||
- name: Publish to GithubPackages
|
||||
continue-on-error: true
|
||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
||||
env:
|
||||
GITHUBPACKAGES_USER: ${{ github.actor }}
|
||||
GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||
GITHUB_USER: ${{ github.actor }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Publish to Gitea
|
||||
continue-on-error: true
|
||||
run: ./gradlew publishAllPublicationsToInmoNexusRepository
|
||||
env:
|
||||
INMONEXUS_USER: ${{ secrets.INMONEXUS_USER }}
|
||||
INMONEXUS_PASSWORD: ${{ secrets.INMONEXUS_PASSWORD }}
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
.idea
|
||||
.kotlin
|
||||
out/*
|
||||
*.iml
|
||||
target
|
||||
@@ -8,7 +9,9 @@ settings.xml
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
bin/
|
||||
|
||||
local.properties
|
||||
kotlin-js-store/
|
||||
secret.gradle
|
||||
.aider*
|
||||
|
||||
727
CHANGELOG.md
727
CHANGELOG.md
@@ -1,5 +1,732 @@
|
||||
# TelegramBotAPI changelog
|
||||
|
||||
## 27.1.2
|
||||
|
||||
* `Core`:
|
||||
* Try to fix cancelling on timeout for long polling
|
||||
* Since this update phrase `Something web wrong` will not happen from this library 😭
|
||||
|
||||
## 27.1.1
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.26.1` -> `0.26.2`
|
||||
* `Core`:
|
||||
* Make `BusinessLocation#location` optional (fix of [#990](https://github.com/InsanusMokrassar/ktgbotapi/issues/990))
|
||||
|
||||
## 27.1.0
|
||||
|
||||
* `Core`:
|
||||
* Improve support of local bot api servers files. Next call factories will try to resolve file locally before real call:
|
||||
* [DownloadFileRequestCallFactory.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileRequestCallFactory.kt) (for [DownloadFile.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFile.kt) as well)
|
||||
* [DownloadFileChannelRequestCallFactory.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/bot/ktor/base/DownloadFileChannelRequestCallFactory.kt) (for [DownloadFileStream.kt](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/DownloadFileStream.kt) as well)
|
||||
|
||||
## 27.0.0
|
||||
|
||||
**THIS UPDATE MAY CONTAIN BREAKING CHANGES. IN CASE OF ANY MIGRATION PROBLEMS FEEL FREE TO ASK IN [OUR CHAT](https://t.me/ktgbotapi_chat)**
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `2.1.20` -> `2.2.0`
|
||||
* `Serialization`: `1.8.1` -> `1.9.0`
|
||||
* `Ktor`: `3.1.3` -> `3.2.2`
|
||||
* `MicroUtils`: `0.25.7` -> `0.26.1`
|
||||
* `KSLog`: `1.4.1` -> `1.5.0`
|
||||
* `Common`:
|
||||
* In most `data` classes with non-public constructors has been added `ConsistentCopyVisibility` annotation, preventing
|
||||
public nature in difference with constructor
|
||||
* Absence of several API methods for requests has been fixed
|
||||
|
||||
## 26.1.0
|
||||
|
||||
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.1](https://core.telegram.org/bots/api-changelog#july-3-2025)**
|
||||
|
||||
**THIS UPDATE _MAY_ CONTAINS BREAKING CHANGES**
|
||||
|
||||
## 26.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES IN BEHAVIOUR BUILDER AND CORE. BE CAREFUL ON UPDATE**
|
||||
|
||||
* `Version`:
|
||||
* `Serialization`: `1.8.0` -> `1.8.1`
|
||||
* `Coroutines`: `1.10.1` -> `1.10.2`
|
||||
* `Ktor`: `3.1.1` -> `3.1.3`
|
||||
* `MicroUtils`: `0.25.3` -> `0.25.7`
|
||||
* `Core`:
|
||||
* **POTENTIALLY BREAKING CHANGE** Long polling has been reworked a bit
|
||||
* **BREAKING CHANGE** `RequestsExecutor` got property `RequestsExecutor.Log: KSLog`
|
||||
* `BehaviourContext`:
|
||||
* **BREAKING CHANGE** All triggers and waiters become non-suspend functions
|
||||
* **BREAKING CHANGE** Behaviour of counted extensions (commands, data callback queries, etc.) has been changed a bit: now each one will
|
||||
create subcontext and work in it
|
||||
* New extension `BehaviourContext.launchInNewSubContext` which will launch some job in subcontext of receiver
|
||||
|
||||
## 25.0.1
|
||||
|
||||
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 9.0](https://core.telegram.org/bots/api-changelog#april-11-2025)**
|
||||
|
||||
* `Core`:
|
||||
* Previously named `Gift` now presented by `Gift.Regular`
|
||||
* Fixes in `MultipartRequestCallFactory` for correct handling of all `MultipartRequest.Common` inheritors
|
||||
* `Username` now can be safely created with `Username.prepare`
|
||||
* Add extensions `String.splitFor(Text|Caption|StoryCaption)` for preparing several texts for several
|
||||
messages/captions/story captions
|
||||
|
||||
## 24.0.2
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `2.1.10` -> `2.1.20`
|
||||
* `Ktor`: `3.1.0` -> `3.1.1`
|
||||
* `MicroUtils`: `0.24.7` -> `0.25.3`
|
||||
* `DefaultKTgBotAPIKSLog` will drop `CancellationException`s by default
|
||||
* You may configure `DefaultKTgBotAPIKSLog` in simple way with `SetDefaultKTgBotAPIKSLog`
|
||||
* `BehaviourBuilder`:
|
||||
* `FSM`:
|
||||
* Fix chains cancelling on their ends
|
||||
|
||||
## 24.0.1
|
||||
|
||||
* `Core`:
|
||||
* Now you may upload photos with `EditChatMessageMedia`
|
||||
|
||||
## 24.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES IN `subcontextUpdatesFilter` WORK. TAKE CARE IN MIGRATION**
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.24.6` -> `0.24.7`
|
||||
* `Core`:
|
||||
* `ForumContentMessage` got property `threadCreatingInfo` which represents information about topic where message has been sent
|
||||
* `BehaviourBuilder`:
|
||||
* Fix of overall `subcontextUpdatesFilter` behaviour. In fact, this update will fix its affection on scenaries
|
||||
|
||||
## 23.2.1
|
||||
|
||||
* `Core`:
|
||||
* Fix of `year` field in `Birthdate`
|
||||
|
||||
## 23.2.0
|
||||
|
||||
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 8.3](https://core.telegram.org/bots/api-changelog#february-12-2025)**
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.24.5` -> `0.24.6`
|
||||
* `Ktor`: `3.0.3` -> `3.1.0`
|
||||
|
||||
## 23.1.2
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `2.1.0` -> `2.1.10`
|
||||
* `Serialization`: `1.7.3` -> `1.8.0`
|
||||
* `MicroUtils`: `0.24.4` -> `0.24.5`
|
||||
* `KSLog`: `1.4.0` -> `1.4.1`
|
||||
|
||||
## 23.1.1
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.24.0` -> `0.24.4`
|
||||
* `Core`:
|
||||
* Replace `removeFirst` with `removeAt(0)` in `createTextSources`
|
||||
|
||||
## 23.1.0
|
||||
|
||||
**THIS UPDATE CONTAINS ADDING SUPPORT OF [Telegram Bots API 8.2](https://core.telegram.org/bots/api-changelog#january-1-2025)**
|
||||
|
||||
## 23.0.0
|
||||
|
||||
* `Version`:
|
||||
* `Coroutines`: `1.9.0` -> `1.10.1`
|
||||
* `MicroUtils`: `0.23.2` -> `0.24.0`
|
||||
* `KSLog`: `1.3.6` -> `1.4.0`
|
||||
* `Ktor`: `3.0.2` -> `3.0.3`
|
||||
* `Core`:
|
||||
* All old factory methods for `TextSource`s took suffix `TextSource`. For example: `regular` -> `regularTextSource`.
|
||||
That has been for excluding names resolution ambiguity with extensions for `EntitiesBuilder`
|
||||
|
||||
## 22.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||
|
||||
**IN THIS UPDATE HAS BEEN REWORKED EVENTS API IN WEBAPPS**
|
||||
|
||||
**THIS UPDATE ADDING SUPPORT OF [BOT API 8.0](https://core.telegram.org/bots/api-changelog#november-17-2024) AND [BOT API 8.1](https://core.telegram.org/bots/api-changelog#december-4-2024)**
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.23.1` -> `0.23.2`
|
||||
* `Ktor`: `3.0.1` -> `3.0.2`
|
||||
|
||||
## 21.0.1
|
||||
|
||||
* `Core`:
|
||||
* Improvements in `Update.sourceUser` extension
|
||||
* Add extension `PrivateChat.toUser`
|
||||
* Builder methods of `TextSource`s (like `pre` which returns `PreTextSource`) lost suppression of `redundant inline`
|
||||
due to its redundancy
|
||||
* Add `mention` builders for `EntitiesBuilder` with `UserId` as variant instead of `User`
|
||||
* `BehaviourBuilder`:
|
||||
* Add support of several rounds for `CombinedSubcontextInitialAction`. Now it will try hard to execute all its
|
||||
`SubAction` while all actions will not be completed successfully OR all left actions will not complete with errors
|
||||
|
||||
## 21.0.0
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `2.0.21` -> `2.1.0`
|
||||
* `MicroUtils`: `0.23.0` -> `0.23.1`
|
||||
* `BehaviourBuilder`:
|
||||
* Add special `val data: BehaviourContextData` into all realizations of `BehaviourContext`
|
||||
* Add `CombinedSubcontextInitialAction` and functions
|
||||
`buildSubcontextInitialAction`/`buildSubcontextInitialActionWithSubActions`
|
||||
* Add `subcontextInitialAction` for all the functions-builders of `BehaviourContext` and
|
||||
`additionalSubcontextInitialAction` to all triggers
|
||||
|
||||
## 20.0.1
|
||||
|
||||
* `Core`:
|
||||
* Fix of logger propagation (fix of [#860](https://github.com/InsanusMokrassar/ktgbotapi/issues/860))
|
||||
* Add opportunity to modify keyboards (fix of [#761](https://github.com/InsanusMokrassar/ktgbotapi/issues/761))
|
||||
* Fields of `OrderInfo` became nullable (fix of [#917](https://github.com/InsanusMokrassar/ktgbotapi/issues/917))
|
||||
* Add default `toString` to `ChatType` (fix of [#919](https://github.com/InsanusMokrassar/ktgbotapi/issues/919))
|
||||
* Fix of method in `CreateInvoiceLink` (merging of [#920](https://github.com/InsanusMokrassar/ktgbotapi/issues/920), made by [byteduck-exploit](https://github.com/byteduck-exploit))
|
||||
|
||||
## 20.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS SUPPORT OF [BOTS API 7.11](https://core.telegram.org/bots/api-changelog#october-31-2024)**
|
||||
|
||||
* `All`:
|
||||
* **ALL SEND METHODS GOT PARAMETER `allowPaidBroadcast` WHICH POTENTIALLY MAY SPEND MONEYS FROM BOT BALANCE**
|
||||
|
||||
## 19.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||
|
||||
**THIS UPDATE CONTAINS UPGRADE UP TO KTOR 3.0 (thanks to [@d1snin](https://github.com/d1snin))**
|
||||
|
||||
* `Version`:
|
||||
* `Ktor`: `2.3.12` -> `3.0.1`
|
||||
* `MicroUtils`: `0.22.7` -> `0.23.0`
|
||||
|
||||
## 18.2.3
|
||||
|
||||
* `Core`:
|
||||
* Add default middleware `ExceptionsThrottlerTelegramBotMiddleware`
|
||||
* Make `TelegramBotMiddlewaresPipelinesHandler` to be default `TelegramBotPipelinesHandler`
|
||||
* Make `DefaultKtorRequestsExecutor` now uses `runCatching` instead of `runCatchingSafely`
|
||||
* `onRequestResultPresented` lambda now accepts non-nullable `result`
|
||||
|
||||
## 18.2.2
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `2.0.20` -> `2.0.21`
|
||||
* `MicroUtils`: `0.22.4` -> `0.22.7`
|
||||
* `Core`:
|
||||
* Fixes in blockquotes serializations
|
||||
* Now `RawMessageEntity` is public. It is still under `Warning` annotation and is subject of changes
|
||||
* `BehaviourBuilder`:
|
||||
* Add `CommonMessageFilterExcludeCommand` to filter commands in messages
|
||||
* Add `minus` operation for `SimpleFilter`s
|
||||
|
||||
## 18.2.1
|
||||
|
||||
* `Version`:
|
||||
* `Serialization`: `1.7.2` -> `1.7.3`
|
||||
* `Coroutines`: `1.8.1` -> `1.9.0`
|
||||
* `MicroUtils`: `0.22.2` -> `0.22.4`
|
||||
|
||||
## 18.2.0
|
||||
|
||||
**THIS UPDATE CONTAINS SUPPORT OF [BOTS API 7.10](https://core.telegram.org/bots/api-changelog#september-6-2024)**
|
||||
|
||||
* `Core`:
|
||||
* Customize `GiveawayCreated` to use stars in some cases
|
||||
* `GiveawayInfo` lost parameter `premiumMonths` because of it is no included by default
|
||||
* `GiveawayPublicResults` lost parameter `publicWinners` because of its abcence in Telegram Bot API
|
||||
* Fix `GiveawayPublicResults` to be correctly deserializable
|
||||
* Fix `GiveawayPrivateResults` to be correctly deserializable
|
||||
* Fixes in deserialization of updates with giveaways
|
||||
* `BehaviourBuilder`:
|
||||
* Extension `buildBehaviourWithLongPolling` will not report absence of `/privacy` handling
|
||||
* `WebApp`:
|
||||
* `MainButton` has been deprecated in favor to `BottomButton`. Their functionality is equal
|
||||
|
||||
## 18.1.0
|
||||
|
||||
* `BehaviourBuilder`:
|
||||
* Add `createSubContextAndDoSynchronouslyWithUpdatesFilter` as old logic of `createSubContextAndDoWithUpdatesFilter`
|
||||
* `createSubContextAndDoWithUpdatesFilter` has been renamed to `createSubContextAndDoAsynchronouslyWithUpdatesFilter`
|
||||
|
||||
## 18.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||
|
||||
This update contains solution for [issue #888](https://github.com/InsanusMokrassar/ktgbotapi/issues/888), made by
|
||||
[@Nik-mmzd](https://github.com/Nik-mmzd)
|
||||
|
||||
---
|
||||
|
||||
**Migration (step-by-step)**
|
||||
|
||||
Replace in a whole project:
|
||||
|
||||
1. `RestrictedChatMember` -> `RestrictedMemberChatMember`
|
||||
2. `BannedChatMember` -> `RestrictedChatMember`
|
||||
|
||||
---
|
||||
|
||||
**Changes:**
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `2.0.10` -> `2.0.20`
|
||||
* `Serialization`: `1.7.1` -> `1.7.2`
|
||||
* `MicroUtils`: `0.22.0` -> `0.22.2`
|
||||
* `KSLog`: `1.3.5` -> `1.3.6`
|
||||
* `Ktor`: `2.3.11` -> `2.3.12`
|
||||
* `Core`:
|
||||
* `RestrictedChatMember` has been renamed to `RestrictedMemberChatMember`
|
||||
* `BannedChatMember` has been renamed to `RestrictedChatMember`
|
||||
* `KickedChatMember` now implements `RestrictedChatMember` (due to rename)
|
||||
* All `ChatMember`s now use `PreviewUser`s instead of `User`s
|
||||
* `Utils`:
|
||||
* Add a lot of extensions like `ChatMember.isMember`
|
||||
* Add a lot of extensions like `ChatMemberUpdated.joinedChat`
|
||||
|
||||
## 17.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS SUPPORT OF BOTS API 7.9**
|
||||
|
||||
* 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
|
||||
|
||||
**Add support of [Telegram Bots API 7.0](https://core.telegram.org/bots/api-changelog#december-29-2023)**
|
||||
|
||||
**IN THIS UPDATE KLOCK DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-time` UP TO 5.3.0 VERSION**
|
||||
|
||||
**IN THIS UPDATE KRYPTO DEPENDENCY CHANGED TO `com.soywiz.korge:korlibs-crypto` UP TO 5.3.0 VERSION**
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.20.23` -> `0.20.26`
|
||||
* `Korlibs`: `4.0.10` -> `5.3.0`
|
||||
* `Core`:
|
||||
* `Message` now inherited by two variants: `AccessibleMessage` and `InaccessibleMessage`
|
||||
* `Common`:
|
||||
* In most places `disableWebPagePreview` has been replaced by new `LinkPreviewOptions`
|
||||
* In most places arguments `replyToMessageId` and `allowSendingWithoutReply` has been replaced with
|
||||
`ReplyParameters`
|
||||
* In `reply` extension two parameters have been added: `replyInChatId` and `replyInThreadId`
|
||||
|
||||
## 9.4.3
|
||||
|
||||
**IetfLanguageCode has been renamed to IetfLang in MicroUtils**
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `1.9.21` -> `1.9.22`
|
||||
* `MicroUtils`: `0.20.19` -> `0.20.23`
|
||||
|
||||
## 9.4.2
|
||||
|
||||
* `Version`:
|
||||
* `Serialization`: `1.6.1` -> `1.6.2`
|
||||
* `Ktor`: `2.3.6` -> `2.3.7`
|
||||
* `MicroUtils`: `0.20.15` -> `0.20.19`
|
||||
* `UUID`: `0.8.1` -> `0.8.2`
|
||||
|
||||
## 9.4.1
|
||||
|
||||
* Replace warning about two bots from `LongPolling` to `DefaultKtorRequestsExecutor`
|
||||
|
||||
## 9.4.0
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `1.9.20` -> `1.9.21`
|
||||
* `Serialization`: `1.6.0` -> `1.6.1`
|
||||
* `Ktor`: `2.3.5` -> `2.3.6`
|
||||
* `MicroUtils`: `0.20.12` -> `0.20.15`
|
||||
|
||||
## 9.3.0
|
||||
|
||||
This release become possible thanks to [Anton Lakotka](https://youtrack.jetbrains.com/users/anton.lakotka)
|
||||
|
||||
**THIS RELEASE CONTAINS UPDATES UP TO RELEASE CANDIDATES VERSIONS**
|
||||
|
||||
**UPDATE MAY HAVE BREAKING CHANGES**
|
||||
|
||||
**SINCE THIS UPDATE IT WILL BE REQUIRED TO USE JDK 17+ FOR DEVELOPMENT**
|
||||
|
||||
* `Version`:
|
||||
* `Kotlin`: `1.8.22` -> `1.9.20`
|
||||
* `Serialization`: `1.5.1` -> `1.6.0`
|
||||
* `KorLibs`: `4.0.3` -> `4.0.10`
|
||||
* `UUID`: `0.7.1` -> `0.8.1`
|
||||
* `Ktor`: `2.3.4` -> `2.3.5`
|
||||
* `MicroUtils`: `0.19.9` -> `0.20.12`
|
||||
|
||||
## 9.2.4
|
||||
|
||||
* `Utils`:
|
||||
* New extensions `*.parseCommandsWithNamedArgs`
|
||||
* `BehaviourBuilder`:
|
||||
* In expectaters and triggers of `commands` add `*WithNamedArgs` variants
|
||||
* In expectaters and triggers of `commands` add opportunity to use custom separator
|
||||
|
||||
## 9.2.3
|
||||
|
||||
* `Core`:
|
||||
* Fix in `VoiceContent#createResend`
|
||||
|
||||
## 9.2.2
|
||||
|
||||
* `Core`:
|
||||
* Fix of [#793](https://github.com/InsanusMokrassar/ktgbotapi/issues/793): Add `PreviewChat`
|
||||
|
||||
## 9.2.1
|
||||
|
||||
* `Version`:
|
||||
* `Ktor`: `2.3.3` -> `2.3.4`
|
||||
* `Core`:
|
||||
* All `ChatMember` inheritors have fixes `status` field
|
||||
|
||||
## 9.2.0
|
||||
|
||||
**Add support of [Telegram Bots API 6.9](https://core.telegram.org/bots/api-changelog#september-22-2023)**
|
||||
|
||||
* Rename `ChatAdministratorRightsImpl` -> `ChatCommonAdministratorRights`
|
||||
* All the request chat keyboards has changed their parameters `ChatAdministratorRights` to `ChatCommonAdministratorRights`
|
||||
|
||||
## 9.1.2
|
||||
|
||||
* `Core`:
|
||||
* Fix of `MessageContent` serialization
|
||||
|
||||
## 9.1.1
|
||||
|
||||
* `Core`:
|
||||
* Potential fix of incorrect parsing in `RawMessageEntity`
|
||||
|
||||
## 9.1.0
|
||||
|
||||
**This update contains adding of [Telegram Bot API 6.8](https://core.telegram.org/bots/api-changelog#august-18-2023) support**
|
||||
|
||||
* `Version`:
|
||||
* `Coroutines`: `1.7.2` -> `1.7.3`
|
||||
* `Ktor`: `2.3.2` -> `2.3.3`
|
||||
* `MicroUtils`: `0.19.7` -> `0.19.9`
|
||||
|
||||
## 9.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES: USERNAMES OF BOTS NOW BECAME NULLABLE**
|
||||
|
||||
* `Version`:
|
||||
* `Coroutines`: `1.6.4` -> `1.7.1`
|
||||
* `Ktor`: `2.3.1` -> `2.3.2`
|
||||
* `MicroUtils`: `0.19.4` -> `0.19.7`
|
||||
* `Core`:
|
||||
* **All bots now have nullable usernames just like common users ([#772](https://github.com/InsanusMokrassar/ktgbotapi/issues/772))**
|
||||
* Decrease possible errors in updates handling by additional handling of update deserialization wrapping ([#773](https://github.com/InsanusMokrassar/ktgbotapi/issues/773))
|
||||
* New interface `GetUpdatesRequest`. You may implement it to show default telegram bot ktor executor that this
|
||||
request is an updates request and should be handled in a different way
|
||||
* Now it is possible to get raw updates with `GetUpdatesRaw` request
|
||||
* `Utils`:
|
||||
* Improve extension `Update.sourceChat` to add opportunity to select some chats by logic different with the default
|
||||
|
||||
## 8.1.0
|
||||
|
||||
**PARTIALLY BREAKING CHANGES: Exclude `.*Impl` classcasts from `ClassCastsNew`**
|
||||
|
||||
* `Version`:
|
||||
* `MicroUtils`: `0.19.2` -> `0.19.4`
|
||||
* `Utils`:
|
||||
* Add deep links formatting for internal `tg://` prefix (thanks to [@klimatov](https://github.com/klimatov))
|
||||
* Exclude `.*Impl` classcasts from `ClassCastsNew`
|
||||
|
||||
## 8.0.1
|
||||
|
||||
* `Version`:
|
||||
* `UUID`: `0.7.0` -> `0.7.1`
|
||||
* `Ktor`: `2.3.0` -> `2.3.1`
|
||||
* `MicroUtils`: `0.19.1` -> `0.19.2`
|
||||
|
||||
## 8.0.0
|
||||
|
||||
**THIS UPDATE CONTAINS BREAKING CHANGES**
|
||||
|
||||
**ALL PROJECT DEPRECATIONS HAVE BEEN REMOVED**
|
||||
|
||||
**IN THIS UPDATE KORLIBS HAVE BEEN UPDATED TO VERSION `4.0.2`. SINCE THAT VERSION A LOT OF PACKAGES HAVE BEEN RENAMED.
|
||||
MIGRATIONS USED IN THIS LIB:**
|
||||
|
||||
* `com.soywiz.klock` -> `korlibs.time`
|
||||
* `com.soywiz.krypto` -> `korlibs.crypto`
|
||||
|
||||
* `Versions`:
|
||||
* `Korlibs`: `3.4.0` -> `4.0.3`
|
||||
* `MicroUtils`: `0.18.4` -> `0.19.1`
|
||||
|
||||
## 7.1.3
|
||||
|
||||
* `Versions`:
|
||||
* `Serialization`: `1.5.0` -> `1.5.1`
|
||||
* `MicroUtils`: `0.18.1` -> `0.18.4`
|
||||
* `Core`:
|
||||
* Actualize kdocs in `InputFile`
|
||||
* `BehaviourBuilder`:
|
||||
* Now it is possible to use `waitMediaContent`/`waitMediaContentMessage`/`onMediaContent`
|
||||
* Add `onMention`/`waitMention` functionality
|
||||
* Add opportunity to map content with extensions to `Flow`
|
||||
|
||||
## 7.1.2
|
||||
|
||||
* `Versions`:
|
||||
* `MicroUtils`: `0.18.0` -> `0.18.1`
|
||||
* `Core`:
|
||||
* Now it is possible to serialize `Sticker`s
|
||||
|
||||
## 7.1.1
|
||||
|
||||
* `Versions`:
|
||||
* `Kotlin`: `1.8.20` -> `1.8.21`
|
||||
* `MicroUtils`: `0.17.8` -> `0.18.0`
|
||||
* `Utils`:
|
||||
* Fixes in `makeLinkToMessage`
|
||||
|
||||
## 7.1.0
|
||||
|
||||
**This update contains changes according to the [Telegram Bot API 6.7](https://core.telegram.org/bots/api-changelog#april-21-2023)**
|
||||
|
||||
* `API`:
|
||||
* Rename `editMessageCaption` to `editMessageMedia` due to wrong old naming
|
||||
* Add `edit` extensions for `InlineMessageIdentifier`s
|
||||
* `BehaviourBuilder`:
|
||||
* `BehaviourContext` extensions `onDeepLink` and `waitDeepLinks` now can be used with `Regex` or `String` as first parameters
|
||||
|
||||
## 7.0.2
|
||||
|
||||
_This update brings experimental support of `linuxX64` and `mingwX64` platforms_
|
||||
|
||||
* `Versions`:
|
||||
* `Kotlin`: `1.8.10` -> `1.8.20`
|
||||
* `MicroUtils`: `0.17.5` -> `0.17.8`
|
||||
* `Ktor`: `2.2.4` -> `2.3.0`
|
||||
* `Core`:
|
||||
* New `RequestsExecutor` - `MultipleClientKtorRequestsExecutor`
|
||||
* Old `KtorRequestsExecutor` has been renamed to `DefaultKtorRequestsExecutor`
|
||||
* `KtorRequestsExecutor` now is `expect class`
|
||||
* On `JS`, `JVM` and `MinGWX64` platforms it is `DefaultKtorRequestsExecutor`
|
||||
* On `LinuxX64` platform it is `MultipleClientKtorRequestsExecutor`
|
||||
|
||||
## 7.0.1
|
||||
|
||||
* `Core`:
|
||||
* New interface `WithChat` which contains `chat` field
|
||||
* `Message` now inherits `WithChat`
|
||||
* `ChatMemberUpdated` now inherits `WithChat`
|
||||
* `Utils`:
|
||||
* Improvements in `same`-notations
|
||||
|
||||
## 7.0.0
|
||||
|
||||
This update contains support of [Telegram Bot API 6.6](https://core.telegram.org/bots/api-changelog#march-9-2023)
|
||||
|
||||
**THIS VERSION CONTAINS BREAKING CHANGES**:
|
||||
|
||||
* All previous deprecations have been removed
|
||||
* Fully reworked mechanism of stickers creating and adding
|
||||
* All separations of stickers types like `Animeted` have been replaces with type `StickerFormat`
|
||||
* New `InputSticker` type (and all subtypes) as replacements for old raw fields in methods
|
||||
* Reworked mechanism of files uploading
|
||||
|
||||
Other changes
|
||||
|
||||
* `Versions`:
|
||||
* `MicroUtils`: `0.17.3` -> `0.17.5`
|
||||
|
||||
## 6.1.0
|
||||
|
||||
* `Versions`:
|
||||
* `MicroUtils`: `0.17.2` -> `0.17.3`
|
||||
* `API`:
|
||||
* Fix of [#732](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/732)
|
||||
|
||||
## 6.0.3
|
||||
|
||||
* `Versions`:
|
||||
|
||||
31
README.md
31
README.md
@@ -1,9 +1,11 @@
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#february-3-2023)
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#july-3-2025)
|
||||
|
||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
||||
|:---:|:---:|
|
||||
| Useful repos | [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) |
|
||||
| Misc | [](https://github.com/KotlinBy/awesome-kotlin) [](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) |
|
||||
| Docs | [](https://tgbotapi.inmo.dev/index.html) [](https://docs.inmo.dev/tgbotapi/index.html) |
|
||||
|:----------------------:|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||
| Useful repos | [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) |
|
||||
| Misc | [](https://github.com/KotlinBy/awesome-kotlin) [](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) |
|
||||
| Platforms |   |
|
||||
| Experimental Platforms | [](https://kotlinlang.org/docs/native-target-support.html#tier-1) [](https://kotlinlang.org/docs/native-target-support.html#tier-1) |
|
||||
|
||||
<!--- [](https://t.me/ktgbotapi) --->
|
||||
|
||||
@@ -116,5 +118,22 @@ suspend fun main() {
|
||||
### More examples
|
||||
|
||||
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).
|
||||
|
||||
### Bot API Server Notice
|
||||
|
||||
Under the hood, default bots realizations will try to use links
|
||||
([PathedFile](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/files/PathedFile.kt)#filePath) as files each
|
||||
time you are trying to download file from telegram in any way - via saving to file, use stream or download as byte array.
|
||||
To let bot correctly download files from bot api server, you must:
|
||||
|
||||
* Run bot api server locally
|
||||
to proxy requests for files to the server where bot api server has been hosted
|
||||
* In case of local bot api server (shared one host machine) you must ensure that access to bot api server has been
|
||||
granted for your bot. For example, [aiogram/telegram-bot-api](https://hub.docker.com/r/aiogram/telegram-bot-api) image
|
||||
use `101` UID/GID in linux for user and group as owners. So, your bot must run under user included in `101` group
|
||||
(like `systemd-journal`) or be `101` UID user (like `systemd-resolve`)
|
||||
* **OR** Use some reverse proxy (like nginx). It will allow you to broadcast your bots files without linux rights problems
|
||||
* Set [TelegramAPIUrlsKeeper](tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/utils/TelegramAPIUrlsKeeper.kt)#fileLinkUrlMapper
|
||||
to map urls to let bot execute requests to your nginx proxy
|
||||
53
build.gradle
53
build.gradle
@@ -1,8 +1,8 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
mavenLocal()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -14,13 +14,34 @@ buildscript {
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.kotlin.dokka)
|
||||
alias(libs.plugins.versions)
|
||||
alias(libs.plugins.validator)
|
||||
alias(libs.plugins.nmcp.aggregation)
|
||||
}
|
||||
|
||||
|
||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||
nmcpAggregation {
|
||||
centralPortal {
|
||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||
validationTimeout = Duration.ofSeconds(0)
|
||||
publishingType = "USER_MANAGED"
|
||||
}
|
||||
|
||||
publishAllProjectsProbablyBreakingProjectIsolation()
|
||||
}
|
||||
}
|
||||
|
||||
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
google()
|
||||
maven { url "https://git.inmo.dev/api/packages/InsanusMokrassar/maven" }
|
||||
maven { url "https://nexus.inmo.dev/repository/maven-releases/" }
|
||||
mavenLocal()
|
||||
}
|
||||
if (it != rootProject.findProject("docs")) {
|
||||
tasks.whenTaskAdded { task ->
|
||||
@@ -42,20 +63,28 @@ private String getCurrentVersionChangelog() {
|
||||
return changelogDataOS.toString().trim()
|
||||
}
|
||||
|
||||
if (new File(projectDir, "secret.gradle").exists()) {
|
||||
apply from: './secret.gradle'
|
||||
|
||||
def githubTokenVariableName = "GITHUB_RELEASE_TOKEN"
|
||||
def githubTokenVariableFromEnv = System.getenv(githubTokenVariableName)
|
||||
|
||||
def secretFile = new File(projectDir, "secret.gradle")
|
||||
if (secretFile.exists() || project.hasProperty(githubTokenVariableName) || (githubTokenVariableFromEnv != "" && githubTokenVariableFromEnv != null)) {
|
||||
if (secretFile.exists()) {
|
||||
apply from: './secret.gradle'
|
||||
}
|
||||
apply plugin: "com.github.breadmoirai.github-release"
|
||||
def githubReleaseToken = project.hasProperty(githubTokenVariableName) ? project.property(githubTokenVariableName).toString() : githubTokenVariableFromEnv
|
||||
|
||||
githubRelease {
|
||||
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
||||
token githubReleaseToken
|
||||
|
||||
owner "InsanusMokrassar"
|
||||
repo "TelegramBotAPI"
|
||||
owner = "InsanusMokrassar"
|
||||
repo = "TelegramBotAPI"
|
||||
|
||||
tagName "v$library_version"
|
||||
releaseName "$library_version"
|
||||
targetCommitish "$library_version"
|
||||
tagName = "v$library_version"
|
||||
releaseName = "$library_version"
|
||||
targetCommitish = "$library_version"
|
||||
|
||||
body getCurrentVersionChangelog()
|
||||
body = getCurrentVersionChangelog()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ plugins {
|
||||
|
||||
project.description = "Full collection of all built-in tgbotapi tools"
|
||||
|
||||
apply from: "$mppProjectWithSerializationPresetPath"
|
||||
apply from: "$mppProjectWithSerialization"
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
@@ -54,8 +54,8 @@ Object callback = {
|
||||
skipDeprecated.set(true)
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file("./"))
|
||||
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/"))
|
||||
localDirectory.set(file("../"))
|
||||
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/ktgbotapi"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
allprojects {
|
||||
ext {
|
||||
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
|
||||
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle"
|
||||
File templatesFolder = new File("$rootProject.projectDir.absolutePath${File.separatorChar}gradle${File.separatorChar}templates")
|
||||
|
||||
publishGradlePath = "${rootProject.projectDir.absolutePath}/publish.gradle"
|
||||
Map properties = new HashMap<String, String>()
|
||||
|
||||
if (templatesFolder.exists() && templatesFolder.isDirectory()) {
|
||||
templatesFolder.listFiles().each {
|
||||
properties[it.name - ".gradle"] = it.absolutePath
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
ext {
|
||||
properties.forEach { k, v ->
|
||||
it[k] = v
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("getPublishableModules") {
|
||||
doLast {
|
||||
rootProject.subprojects.each { project ->
|
||||
if (project.plugins.hasPlugin('maven-publish')) {
|
||||
println(":${project.name}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,8 @@ kotlin.js.generate.externals=true
|
||||
kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
# https://github.com/google/ksp/issues/2491
|
||||
ksp.useKSP2=false
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=6.0.3
|
||||
library_version=27.1.2
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
[versions]
|
||||
|
||||
kotlin = "1.8.10"
|
||||
kotlin-serialization = "1.5.0"
|
||||
kotlin-coroutines = "1.6.4"
|
||||
kotlin = "2.2.0"
|
||||
kotlin-serialization = "1.9.0"
|
||||
kotlin-coroutines = "1.10.2"
|
||||
|
||||
javax-activation = "1.1.1"
|
||||
|
||||
korlibs = "3.4.0"
|
||||
uuid = "0.7.0"
|
||||
ktor = "2.2.4"
|
||||
korlibs = "5.4.0"
|
||||
uuid = "0.8.4"
|
||||
ktor = "3.2.2"
|
||||
|
||||
ksp = "1.8.10-1.0.9"
|
||||
kotlin-poet = "1.12.0"
|
||||
ksp = "2.2.0-2.0.2"
|
||||
kotlin-poet = "2.2.0"
|
||||
|
||||
microutils = "0.17.2"
|
||||
microutils = "0.26.2"
|
||||
kslog = "1.5.0"
|
||||
|
||||
github-release-plugin = "2.4.1"
|
||||
dokka = "1.7.20"
|
||||
versions = "0.52.0"
|
||||
|
||||
github-release-plugin = "2.5.2"
|
||||
dokka = "2.0.0"
|
||||
|
||||
validator = "0.18.1"
|
||||
nmcp = "1.0.2"
|
||||
|
||||
[libraries]
|
||||
|
||||
@@ -31,23 +37,34 @@ kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js", version.ref =
|
||||
|
||||
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
|
||||
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
|
||||
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
|
||||
ktor-client-winhttp = { module = "io.ktor:ktor-client-winhttp", version.ref = "ktor" }
|
||||
ktor-server = { module = "io.ktor:ktor-server", version.ref = "ktor" }
|
||||
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
|
||||
|
||||
javax-activation = { module = "javax.activation:activation", version.ref = "javax-activation" }
|
||||
|
||||
korlibs-klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "korlibs" }
|
||||
korlibs-krypto = { module = "com.soywiz.korlibs.krypto:krypto", version.ref = "korlibs" }
|
||||
korlibs-klock = { module = "com.soywiz.korge:korlibs-time", version.ref = "korlibs" }
|
||||
korlibs-krypto = { module = "com.soywiz.korge:korlibs-crypto", version.ref = "korlibs" }
|
||||
|
||||
uuid = { module = "com.benasher44:uuid", version.ref = "uuid" }
|
||||
|
||||
microutils-colors-common = { module = "dev.inmo:micro_utils.colors.common", version.ref = "microutils" }
|
||||
microutils-coroutines = { module = "dev.inmo:micro_utils.coroutines", version.ref = "microutils" }
|
||||
microutils-serialization-base64 = { module = "dev.inmo:micro_utils.serialization.base64", version.ref = "microutils" }
|
||||
microutils-serialization-encapsulator = { module = "dev.inmo:micro_utils.serialization.encapsulator", version.ref = "microutils" }
|
||||
microutils-serialization-typedSerializer = { module = "dev.inmo:micro_utils.serialization.typed_serializer", version.ref = "microutils" }
|
||||
microutils-serialization-mapper = { module = "dev.inmo:micro_utils.serialization.mapper", version.ref = "microutils" }
|
||||
microutils-languageCodes = { module = "dev.inmo:micro_utils.language_codes", version.ref = "microutils" }
|
||||
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
|
||||
microutils-fsm-common = { module = "dev.inmo:micro_utils.fsm.common", version.ref = "microutils" }
|
||||
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" }
|
||||
|
||||
# ksp dependencies
|
||||
|
||||
@@ -67,3 +84,7 @@ github-release-plugin = { module = "com.github.breadmoirai:github-release", vers
|
||||
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||
kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
|
||||
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||
kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
|
||||
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" }
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
project.version = "$version"
|
||||
project.group = "$group"
|
||||
|
||||
apply from: "$publishGradlePath"
|
||||
apply from: "$mpp_publish"
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-Xcontext-parameters")
|
||||
}
|
||||
js (IR) {
|
||||
browser()
|
||||
nodejs()
|
||||
@@ -25,7 +28,6 @@ kotlin {
|
||||
jsTest {
|
||||
dependencies {
|
||||
implementation libs.kotlin.test.js
|
||||
implementation libs.kotlin.test.junit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,13 @@ project.version = "$library_version"
|
||||
project.group = "$library_group"
|
||||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
freeCompilerArgs.add("-Xcontext-parameters")
|
||||
}
|
||||
jvm {
|
||||
compilations.main {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
jvmTarget = "17"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,6 +16,9 @@ kotlin {
|
||||
browser()
|
||||
nodejs()
|
||||
}
|
||||
linuxX64()
|
||||
mingwX64()
|
||||
linuxArm64()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
@@ -35,13 +41,20 @@ kotlin {
|
||||
jsTest {
|
||||
dependencies {
|
||||
implementation libs.kotlin.test.js
|
||||
implementation libs.kotlin.test.junit
|
||||
}
|
||||
}
|
||||
all {
|
||||
languageSettings {
|
||||
optIn('dev.inmo.tgbotapi.utils.RiskFeature')
|
||||
optIn('dev.inmo.tgbotapi.utils.PreviewFeature')
|
||||
optIn('dev.inmo.micro_utils.common.Warning')
|
||||
optIn('dev.inmo.micro_utils.common.PreviewFeature')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
111
gradle/templates/mpp_publish.gradle
Normal file
111
gradle/templates/mpp_publish.gradle
Normal 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)
|
||||
}
|
||||
}
|
||||
}
|
||||
1
gradle/templates/mpp_publish.kpsb
Normal file
1
gradle/templates/mpp_publish.kpsb
Normal 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}}
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||
|
||||
100
publish.gradle
100
publish.gradle
@@ -1,100 +0,0 @@
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
task javadocsJar(type: Jar) {
|
||||
archiveClassifier.convention("javadoc")
|
||||
archiveClassifier.set("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('GITEA_TOKEN') || System.getenv('GITEA_TOKEN') != null) {
|
||||
maven {
|
||||
name = "Gitea"
|
||||
url = uri("https://git.inmo.dev/api/packages/InsanusMokrassar/maven")
|
||||
|
||||
credentials(HttpHeaderCredentials) {
|
||||
name = "Authorization"
|
||||
value = project.hasProperty('GITEA_TOKEN') ? project.property('GITEA_TOKEN') : System.getenv('GITEA_TOKEN')
|
||||
}
|
||||
|
||||
authentication {
|
||||
header(HttpHeaderAuthentication)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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":"Gitea","url":"https://git.inmo.dev/api/packages/InsanusMokrassar/maven","credsType":{"type":"dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository.CredentialsType.HttpHeaderCredentials","headerName":"Authorization","headerValueProperty":"GITEA_TOKEN"}},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||
@@ -19,4 +19,3 @@ include ":tgbotapi.behaviour_builder"
|
||||
include ":tgbotapi.behaviour_builder.fsm"
|
||||
include ":tgbotapi"
|
||||
include ":tgbotapi.webapps"
|
||||
include ":docs"
|
||||
|
||||
2523
tgbotapi.api/api/tgbotapi.api.api
Normal file
2523
tgbotapi.api/api/tgbotapi.api.api
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,20 +1,31 @@
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
id "org.jetbrains.kotlin.plugin.serialization"
|
||||
id "org.jetbrains.dokka"
|
||||
id "com.google.devtools.ksp"
|
||||
}
|
||||
|
||||
project.description = "API extensions with \"Telegram Bot API\"-like extensions for TelegramBot and RequestsExecutor"
|
||||
|
||||
apply from: "$mppProjectWithSerializationPresetPath"
|
||||
apply from: "$publishGradlePath"
|
||||
apply from: "$mppProjectWithSerialization"
|
||||
apply from: "$mpp_publish"
|
||||
|
||||
kotlin {
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
api project(":tgbotapi.core")
|
||||
api libs.microutils.ksp.variations
|
||||
}
|
||||
}
|
||||
configureEach {
|
||||
languageSettings.optIn("kotlinx.serialization.ExperimentalSerializationApi")
|
||||
}
|
||||
}
|
||||
explicitApi()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
add("kspCommonMainMetadata", libs.microutils.ksp.variations.generator)
|
||||
}
|
||||
|
||||
|
||||
@@ -12,10 +12,11 @@ import io.ktor.client.engine.*
|
||||
* @param ktorClientEngine Engine like [io.ktor.client.engine.cio.CIO]
|
||||
* @param ktorClientConfig Config block for preconfiguring of bot [HttpClient]
|
||||
*/
|
||||
data class BotBuilder internal constructor(
|
||||
@ConsistentCopyVisibility
|
||||
public data class BotBuilder internal constructor(
|
||||
var proxy: ProxyConfig? = null,
|
||||
var ktorClientEngineFactory: HttpClientEngineFactory<HttpClientEngineConfig>? = null,
|
||||
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null
|
||||
var ktorClientConfig: (HttpClientConfig<*>.() -> Unit) ? = null,
|
||||
) {
|
||||
internal fun createHttpClient(): HttpClient = ktorClientEngineFactory ?.let {
|
||||
HttpClient(
|
||||
@@ -37,12 +38,18 @@ data class BotBuilder internal constructor(
|
||||
* @return Created by [telegramBotWithCustomClientConfig] function [TelegramBot]. This executor will be preconfigured using [token] and
|
||||
* [block]
|
||||
*/
|
||||
fun buildBot(
|
||||
public fun buildBot(
|
||||
token: String,
|
||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||
testServer: Boolean = false,
|
||||
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||
block: BotBuilder.() -> Unit
|
||||
) = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||
BotBuilder().apply(block).createHttpClient()
|
||||
): TelegramBot = telegramBot(
|
||||
urlsKeeper = TelegramAPIUrlsKeeper(
|
||||
token = token,
|
||||
testServer = testServer,
|
||||
hostUrl = apiUrl,
|
||||
fileLinkUrlMapper = fileLinkUrlMapper
|
||||
),
|
||||
client = BotBuilder().apply(block).createHttpClient()
|
||||
)
|
||||
|
||||
@@ -11,7 +11,7 @@ import io.ktor.client.engine.*
|
||||
/**
|
||||
* Allows to create bot using bot [urlsKeeper] and already prepared [client]
|
||||
*/
|
||||
fun telegramBot(
|
||||
public fun telegramBot(
|
||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||
client: HttpClient = HttpClient()
|
||||
): TelegramBot = telegramBot(urlsKeeper) {
|
||||
@@ -23,11 +23,11 @@ fun telegramBot(
|
||||
* configure it with [clientConfig]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun <T: HttpClientEngineConfig> telegramBot(
|
||||
public inline fun <T: HttpClientEngineConfig> telegramBot(
|
||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||
clientFactory: HttpClientEngineFactory<T>,
|
||||
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
||||
) = telegramBot(
|
||||
): TelegramBot = telegramBot(
|
||||
urlsKeeper,
|
||||
HttpClient(clientFactory, clientConfig)
|
||||
)
|
||||
@@ -37,11 +37,11 @@ inline fun <T: HttpClientEngineConfig> telegramBot(
|
||||
* configure [HttpClient] using [clientConfig]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun telegramBot(
|
||||
public inline fun telegramBot(
|
||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||
clientEngine: HttpClientEngine,
|
||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
||||
) = telegramBot(
|
||||
): TelegramBot = telegramBot(
|
||||
urlsKeeper,
|
||||
HttpClient(clientEngine, clientConfig)
|
||||
)
|
||||
@@ -51,10 +51,10 @@ inline fun telegramBot(
|
||||
* [clientConfig]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun telegramBot(
|
||||
public inline fun telegramBot(
|
||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit
|
||||
) = telegramBot(
|
||||
): TelegramBot = telegramBot(
|
||||
urlsKeeper,
|
||||
HttpClient(clientConfig)
|
||||
)
|
||||
@@ -63,22 +63,24 @@ inline fun telegramBot(
|
||||
* Allows to create bot using bot [token], [apiUrl] (for custom api servers) and already prepared [client]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun telegramBot(
|
||||
public fun telegramBot(
|
||||
token: String,
|
||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||
testServer: Boolean = false,
|
||||
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||
client: HttpClient = HttpClient()
|
||||
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl), client)
|
||||
): TelegramBot = telegramBot(TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper), client)
|
||||
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun <T: HttpClientEngineConfig> telegramBot(
|
||||
public fun <T: HttpClientEngineConfig> telegramBot(
|
||||
token: String,
|
||||
clientFactory: HttpClientEngineFactory<T>,
|
||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||
testServer: Boolean = false,
|
||||
noinline clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
||||
) = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||
clientConfig: HttpClientConfig<T>.() -> Unit = {}
|
||||
): TelegramBot = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
|
||||
clientFactory,
|
||||
clientConfig
|
||||
)
|
||||
@@ -87,15 +89,15 @@ inline fun <T: HttpClientEngineConfig> telegramBot(
|
||||
* Allows to create bot using bot [token] and specify [HttpClientEngine] by passing [clientEngine] param and optionally
|
||||
* configure [HttpClient] using [clientConfig]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun telegramBot(
|
||||
public fun telegramBot(
|
||||
token: String,
|
||||
clientEngine: HttpClientEngine,
|
||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||
testServer: Boolean = false,
|
||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
||||
) = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||
clientConfig: HttpClientConfig<*>.() -> Unit = {}
|
||||
): TelegramBot = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
|
||||
clientEngine,
|
||||
clientConfig
|
||||
)
|
||||
@@ -104,13 +106,13 @@ inline fun telegramBot(
|
||||
* Allows to create bot using bot [token] and [apiUrl] and specify [HttpClientEngine] by configuring [HttpClient] using
|
||||
* [clientConfig]
|
||||
*/
|
||||
@Suppress("NOTHING_TO_INLINE")
|
||||
inline fun telegramBot(
|
||||
public fun telegramBot(
|
||||
token: String,
|
||||
apiUrl: String = telegramBotAPIDefaultUrl,
|
||||
testServer: Boolean = false,
|
||||
noinline clientConfig: HttpClientConfig<*>.() -> Unit
|
||||
) = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl),
|
||||
fileLinkUrlMapper: TelegramAPIUrlsKeeper.(String) -> String = { "${fileBaseUrl}/$it" },
|
||||
clientConfig: HttpClientConfig<*>.() -> Unit
|
||||
): TelegramBot = telegramBot(
|
||||
TelegramAPIUrlsKeeper(token, testServer, apiUrl, fileLinkUrlMapper),
|
||||
clientConfig
|
||||
)
|
||||
|
||||
@@ -3,5 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.local.Close
|
||||
|
||||
@Suppress("unused")
|
||||
suspend inline fun TelegramBot.close() = execute(Close)
|
||||
public suspend inline fun TelegramBot.executeClose(): Boolean = execute(Close)
|
||||
|
||||
@@ -5,38 +5,49 @@ import dev.inmo.tgbotapi.requests.DeleteMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.MediaGroupCollectionContent
|
||||
|
||||
suspend fun TelegramBot.deleteMessage(
|
||||
public suspend fun TelegramBot.deleteMessage(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageId
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
DeleteMessage(chatId, messageId)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.deleteMessage(
|
||||
public suspend fun TelegramBot.deleteMessage(
|
||||
chat: Chat,
|
||||
messageId: MessageId
|
||||
) = deleteMessage(chat.id, messageId)
|
||||
): Boolean = deleteMessage(chat.id, messageId)
|
||||
|
||||
suspend fun TelegramBot.deleteMessage(
|
||||
message: Message
|
||||
) = deleteMessage(message.chat, message.messageId)
|
||||
public suspend fun TelegramBot.deleteMessage(
|
||||
message: AccessibleMessage
|
||||
): Boolean {
|
||||
val mediaGroupContent = ((message as? ContentMessage<*>) ?.content as? MediaGroupCollectionContent<*>)
|
||||
if (mediaGroupContent == null) {
|
||||
return deleteMessage(message.chat, message.messageId)
|
||||
} else {
|
||||
return mediaGroupContent.group.map {
|
||||
deleteMessage(it.sourceMessage)
|
||||
}.all { it }
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun TelegramBot.delete(
|
||||
public suspend fun TelegramBot.delete(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageId
|
||||
) = deleteMessage(chatId, messageId)
|
||||
): Boolean = deleteMessage(chatId, messageId)
|
||||
|
||||
suspend fun TelegramBot.delete(
|
||||
public suspend fun TelegramBot.delete(
|
||||
chat: Chat,
|
||||
messageId: MessageId
|
||||
) = deleteMessage(chat, messageId)
|
||||
): Boolean = deleteMessage(chat, messageId)
|
||||
|
||||
suspend fun TelegramBot.delete(
|
||||
message: Message
|
||||
) = deleteMessage(message)
|
||||
public suspend fun TelegramBot.delete(
|
||||
message: AccessibleMessage
|
||||
): Boolean = deleteMessage(message)
|
||||
|
||||
suspend fun Message.delete(
|
||||
public suspend fun AccessibleMessage.delete(
|
||||
requestsExecutor: TelegramBot
|
||||
) = requestsExecutor.deleteMessage(this)
|
||||
): Boolean = requestsExecutor.deleteMessage(this)
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.DeleteMessages
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
public suspend fun TelegramBot.deleteMessages(
|
||||
chatId: ChatIdentifier,
|
||||
messageIds: List<MessageId>
|
||||
): Boolean = messageIds.chunked(deleteMessagesLimit.last).map {
|
||||
execute(
|
||||
DeleteMessages(
|
||||
chatId = chatId,
|
||||
messageIds = it
|
||||
)
|
||||
)
|
||||
}.all { it }
|
||||
|
||||
public suspend fun TelegramBot.deleteMessages(
|
||||
chatId: ChatIdentifier,
|
||||
messageIds: Array<MessageId>
|
||||
): Boolean = deleteMessages(
|
||||
chatId = chatId,
|
||||
messageIds = messageIds.toList()
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.deleteMessages(
|
||||
messagesMetas: List<Message.MetaInfo>
|
||||
): Boolean = messagesMetas.groupBy { it.chatId }.map { (chatId, messages) ->
|
||||
deleteMessages(
|
||||
chatId = chatId,
|
||||
messageIds = messages.map { it.messageId }
|
||||
)
|
||||
}.all { it }
|
||||
|
||||
@JvmName("deleteMessagesWithMessages")
|
||||
public suspend fun TelegramBot.deleteMessages(
|
||||
messages: List<AccessibleMessage>
|
||||
): Boolean = deleteMessages(messages.map { it.metaInfo })
|
||||
|
||||
public suspend fun TelegramBot.delete(
|
||||
chatId: ChatIdentifier,
|
||||
messageIds: List<MessageId>
|
||||
): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||
|
||||
public suspend fun TelegramBot.delete(
|
||||
chatId: ChatIdentifier,
|
||||
messageIds: Array<MessageId>
|
||||
): Boolean = deleteMessages(chatId = chatId, messageIds = messageIds)
|
||||
|
||||
public suspend fun TelegramBot.delete(
|
||||
messagesMetas: List<Message.MetaInfo>
|
||||
): Boolean = deleteMessages(messagesMetas)
|
||||
|
||||
@JvmName("deleteWithMessages")
|
||||
public suspend fun TelegramBot.delete(
|
||||
messages: List<AccessibleMessage>
|
||||
): Boolean = deleteMessages(messages)
|
||||
@@ -5,60 +5,68 @@ import dev.inmo.tgbotapi.requests.ForwardMessage
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.Seconds
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.PossiblyForwardedMessage
|
||||
import dev.inmo.tgbotapi.types.threadId
|
||||
|
||||
suspend fun TelegramBot.forwardMessage(
|
||||
public suspend fun TelegramBot.forwardMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
startTimestamp: Seconds? = null,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false
|
||||
) = execute(
|
||||
ForwardMessage(fromChatId, toChatId, messageId, threadId, disableNotification, protectContent)
|
||||
): PossiblyForwardedMessage = execute(
|
||||
ForwardMessage(fromChatId, toChatId, messageId, threadId, startTimestamp, disableNotification, protectContent)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.forwardMessage(
|
||||
public suspend fun TelegramBot.forwardMessage(
|
||||
fromChat: Chat,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageId,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
startTimestamp: Seconds? = null,
|
||||
disableNotification: 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,
|
||||
toChat: Chat,
|
||||
messageId: MessageId,
|
||||
threadId: MessageThreadId? = toChat.id.threadId,
|
||||
startTimestamp: Seconds? = null,
|
||||
disableNotification: 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,
|
||||
toChat: Chat,
|
||||
messageId: MessageId,
|
||||
threadId: MessageThreadId? = toChat.id.threadId,
|
||||
startTimestamp: Seconds? = null,
|
||||
disableNotification: 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,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
startTimestamp: Seconds? = null,
|
||||
disableNotification: 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,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
threadId: MessageThreadId? = toChat.id.threadId,
|
||||
startTimestamp: Seconds? = null,
|
||||
disableNotification: 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)
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.send.copyMessages
|
||||
import dev.inmo.tgbotapi.requests.ForwardMessages
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import kotlin.jvm.JvmName
|
||||
|
||||
public suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
messageIds: List<MessageId>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = messageIds.chunked(forwardMessagesLimit.last).flatMap {
|
||||
execute(
|
||||
ForwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = it,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
public suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
messageIds: Array<MessageId>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = messageIds.toList(),
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
messagesMetas: List<Message.MetaInfo>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = messagesMetas.groupBy { it.chatId }.flatMap { (chatId, messages) ->
|
||||
forwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = chatId,
|
||||
messageIds = messages.map { it.messageId },
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
}
|
||||
|
||||
@JvmName("forwardMessagesWithMessages")
|
||||
public suspend fun TelegramBot.forwardMessages(
|
||||
toChatId: ChatIdentifier,
|
||||
messages: List<AccessibleMessage>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
messagesMetas = messages.map { it.metaInfo },
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.forward(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
messageIds: List<MessageId>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = messageIds,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.forward(
|
||||
toChatId: ChatIdentifier,
|
||||
fromChatId: ChatIdentifier,
|
||||
messageIds: Array<MessageId>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
fromChatId = fromChatId,
|
||||
messageIds = messageIds,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.forward(
|
||||
toChatId: ChatIdentifier,
|
||||
messagesMetas: List<Message.MetaInfo>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
messagesMetas = messagesMetas,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
|
||||
@JvmName("forwardWithMessages")
|
||||
public suspend fun TelegramBot.forward(
|
||||
toChatId: ChatIdentifier,
|
||||
messages: List<AccessibleMessage>,
|
||||
threadId: MessageThreadId? = toChatId.threadId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
removeCaption: Boolean = false
|
||||
): List<MessageId> = forwardMessages(
|
||||
toChatId = toChatId,
|
||||
messages = messages,
|
||||
threadId = threadId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
removeCaption = removeCaption
|
||||
)
|
||||
@@ -5,22 +5,22 @@ import dev.inmo.tgbotapi.requests.GetUpdates
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
|
||||
suspend fun TelegramBot.getUpdates(
|
||||
offset: UpdateIdentifier? = null,
|
||||
public suspend fun TelegramBot.getUpdates(
|
||||
offset: UpdateId? = null,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
) = execute(
|
||||
): List<Update> = execute(
|
||||
GetUpdates(
|
||||
offset, limit, timeout, allowed_updates
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.getUpdates(
|
||||
public suspend fun TelegramBot.getUpdates(
|
||||
lastUpdate: Update,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
) = getUpdates(
|
||||
): List<Update> = getUpdates(
|
||||
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
||||
)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.GetUpdatesRaw
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.update.abstracts.Update
|
||||
import kotlinx.serialization.json.JsonArray
|
||||
|
||||
public suspend fun TelegramBot.getRawUpdates(
|
||||
offset: UpdateId? = null,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
): JsonArray = execute(
|
||||
GetUpdatesRaw(
|
||||
offset, limit, timeout, allowed_updates
|
||||
)
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.getRawUpdates(
|
||||
lastUpdate: Update,
|
||||
limit: Int = getUpdatesLimit.last,
|
||||
timeout: Seconds? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
): JsonArray = getRawUpdates(
|
||||
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
||||
)
|
||||
@@ -1,6 +1,6 @@
|
||||
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.content.MediaGroupPartContent
|
||||
import dev.inmo.tgbotapi.types.update.*
|
||||
@@ -12,11 +12,12 @@ import dev.inmo.tgbotapi.utils.extensions.asMediaGroupMessage
|
||||
*/
|
||||
internal fun List<Update>.convertWithMediaGroupUpdates(): List<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) {
|
||||
val message = (update.data as? PossiblySentViaBotCommonMessage<*>) ?.let {
|
||||
if (it.content is MediaGroupPartContent) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
it as PossiblySentViaBotCommonMessage<MediaGroupPartContent>
|
||||
} else {
|
||||
null
|
||||
@@ -48,10 +49,4 @@ internal fun List<Update>.convertWithMediaGroupUpdates(): List<Update> {
|
||||
return resultUpdates
|
||||
}
|
||||
|
||||
/**
|
||||
* @return [EditMessageMediaGroupUpdate] in case if [this] is [EditMessageUpdate]. When [this] object is
|
||||
* [EditChannelPostUpdate] instance - will return [EditChannelPostMediaGroupUpdate]
|
||||
*
|
||||
* @throws IllegalStateException
|
||||
*/
|
||||
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate() = this
|
||||
internal fun BaseEditMessageUpdate.toEditMediaGroupUpdate(): BaseEditMessageUpdate = this
|
||||
|
||||
@@ -1,30 +1,38 @@
|
||||
package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||
import dev.inmo.tgbotapi.abstracts.*
|
||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorScope
|
||||
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.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.LiveLocationContent
|
||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||
import kotlinx.coroutines.*
|
||||
import dev.inmo.tgbotapi.utils.launchWithBotLogger
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.currentCoroutineContext
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.FlowCollector
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlin.js.JsName
|
||||
import kotlin.jvm.JvmName
|
||||
import kotlin.math.ceil
|
||||
|
||||
@Serializable
|
||||
data class EditLiveLocationInfo(
|
||||
public data class EditLiveLocationInfo(
|
||||
override val latitude: Double,
|
||||
override val longitude: Double,
|
||||
override val horizontalAccuracy: Meters? = null,
|
||||
@@ -37,55 +45,68 @@ data class EditLiveLocationInfo(
|
||||
* Will [sendLiveLocation] with the first [EditLiveLocationInfo] data and update than. Each [liveTimeMillis] passing,
|
||||
* the message will be sent again and new edits will be applied to the new message
|
||||
*/
|
||||
suspend fun TelegramBot.handleLiveLocation(
|
||||
public suspend fun TelegramBot.handleLiveLocation(
|
||||
chatId: ChatIdentifier,
|
||||
locationsFlow: Flow<EditLiveLocationInfo>,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
||||
) {
|
||||
var currentLiveLocationMessage: ContentMessage<LocationContent>? = null
|
||||
val updateMessageJob = CoroutineScope(currentCoroutineContext().LinkedSupervisorJob()).launchSafelyWithoutExceptions(start = CoroutineStart.LAZY) {
|
||||
while (isActive) {
|
||||
delay(liveTimeMillis)
|
||||
// Remove previous location message info to resend live location message
|
||||
currentLiveLocationMessage = null
|
||||
var currentLiveLocationMessage: ContentMessage<LiveLocationContent>? = null
|
||||
val updateMessageJob = if (liveTimeMillis == indefiniteLivePeriodDelayMillis) { // do not launch refreshing of message for indefinite live locations
|
||||
null
|
||||
} else {
|
||||
val scope = currentCoroutineContext().LinkedSupervisorScope()
|
||||
scope.launchWithBotLogger(start = CoroutineStart.LAZY) {
|
||||
while (scope.isActive) {
|
||||
delay(liveTimeMillis)
|
||||
// Remove previous location message info to resend live location message
|
||||
currentLiveLocationMessage = null
|
||||
}
|
||||
}
|
||||
}
|
||||
locationsFlow.collect {
|
||||
val capturedLiveLocationMessage = currentLiveLocationMessage
|
||||
if (capturedLiveLocationMessage == null) {
|
||||
updateMessageJob.start()
|
||||
updateMessageJob ?.start()
|
||||
currentLiveLocationMessage = send(
|
||||
chatId,
|
||||
it.latitude,
|
||||
it.longitude,
|
||||
ceil(liveTimeMillis.toDouble() / 1000).toInt(),
|
||||
if (liveTimeMillis == indefiniteLivePeriodDelayMillis) {
|
||||
LiveLocation.INDEFINITE_LIVE_PERIOD
|
||||
} else {
|
||||
ceil(liveTimeMillis.toDouble() / 1000).toInt()
|
||||
},
|
||||
it.horizontalAccuracy,
|
||||
it.heading,
|
||||
it.proximityAlertRadius,
|
||||
threadId,
|
||||
businessConnectionId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
allowPaidBroadcast,
|
||||
effectId,
|
||||
replyParameters,
|
||||
it.replyMarkup
|
||||
).also {
|
||||
sentMessageFlow ?.emit(it)
|
||||
}
|
||||
} else {
|
||||
edit(
|
||||
capturedLiveLocationMessage,
|
||||
it.latitude,
|
||||
it.longitude,
|
||||
it.horizontalAccuracy,
|
||||
it.heading,
|
||||
it.proximityAlertRadius,
|
||||
it.replyMarkup
|
||||
message = capturedLiveLocationMessage,
|
||||
latitude = it.latitude,
|
||||
longitude = it.longitude,
|
||||
horizontalAccuracy = it.horizontalAccuracy,
|
||||
heading = it.heading,
|
||||
proximityAlertRadius = it.proximityAlertRadius,
|
||||
replyMarkup = it.replyMarkup
|
||||
).also {
|
||||
sentMessageFlow ?.emit(it)
|
||||
}
|
||||
@@ -99,20 +120,22 @@ suspend fun TelegramBot.handleLiveLocation(
|
||||
*/
|
||||
@JvmName("handleLiveLocationWithLocation")
|
||||
@JsName("handleLiveLocationWithLocation")
|
||||
suspend fun TelegramBot.handleLiveLocation(
|
||||
public suspend fun TelegramBot.handleLiveLocation(
|
||||
chatId: ChatIdentifier,
|
||||
locationsFlow: Flow<Location>,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
||||
) {
|
||||
handleLiveLocation(
|
||||
chatId,
|
||||
locationsFlow.map {
|
||||
chatId = chatId,
|
||||
locationsFlow = locationsFlow.map {
|
||||
EditLiveLocationInfo(
|
||||
it.latitude,
|
||||
it.longitude,
|
||||
@@ -122,13 +145,15 @@ suspend fun TelegramBot.handleLiveLocation(
|
||||
(it as? WithReplyMarkup) ?.replyMarkup as? InlineKeyboardMarkup
|
||||
)
|
||||
},
|
||||
liveTimeMillis,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
sentMessageFlow
|
||||
liveTimeMillis = liveTimeMillis,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
allowPaidBroadcast = allowPaidBroadcast,
|
||||
effectId = effectId,
|
||||
replyParameters = replyParameters,
|
||||
sentMessageFlow = sentMessageFlow
|
||||
)
|
||||
}
|
||||
|
||||
@@ -138,31 +163,35 @@ suspend fun TelegramBot.handleLiveLocation(
|
||||
*/
|
||||
@JvmName("handleLiveLocationWithLatLong")
|
||||
@JsName("handleLiveLocationWithLatLong")
|
||||
suspend fun TelegramBot.handleLiveLocation(
|
||||
public suspend fun TelegramBot.handleLiveLocation(
|
||||
chatId: ChatIdentifier,
|
||||
locationsFlow: Flow<Pair<Double, Double>>,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
sentMessageFlow: FlowCollector<ContentMessage<LocationContent>>? = null
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
sentMessageFlow: FlowCollector<ContentMessage<LiveLocationContent>>? = null
|
||||
) {
|
||||
handleLiveLocation(
|
||||
chatId,
|
||||
locationsFlow.map { (lat, long) ->
|
||||
chatId = chatId,
|
||||
locationsFlow = locationsFlow.map { (lat, long) ->
|
||||
EditLiveLocationInfo(
|
||||
lat,
|
||||
long
|
||||
)
|
||||
},
|
||||
liveTimeMillis,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
sentMessageFlow
|
||||
liveTimeMillis = liveTimeMillis,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
allowPaidBroadcast = allowPaidBroadcast,
|
||||
effectId = effectId,
|
||||
replyParameters = replyParameters,
|
||||
sentMessageFlow = sentMessageFlow
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,47 +1,35 @@
|
||||
package dev.inmo.tgbotapi.extensions.api
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import com.soywiz.klock.TimeSpan
|
||||
import dev.inmo.micro_utils.coroutines.LinkedSupervisorJob
|
||||
import dev.inmo.micro_utils.coroutines.launchSafelyWithoutExceptions
|
||||
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
|
||||
import korlibs.time.DateTime
|
||||
import korlibs.time.TimeSpan
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.edit
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.editLiveLocation
|
||||
import dev.inmo.tgbotapi.extensions.api.edit.location.live.stopLiveLocation
|
||||
import dev.inmo.tgbotapi.extensions.api.send.send
|
||||
import dev.inmo.tgbotapi.extensions.api.send.sendLiveLocation
|
||||
import dev.inmo.tgbotapi.requests.send.SendLiveLocation
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.buttons.KeyboardMarkup
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.location.LiveLocation
|
||||
import dev.inmo.tgbotapi.types.location.Location
|
||||
import dev.inmo.tgbotapi.types.location.StaticLocation
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.ContentMessage
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.message.content.LocationContent
|
||||
import dev.inmo.tgbotapi.utils.extensions.threadIdOrNull
|
||||
import io.ktor.utils.io.core.Closeable
|
||||
import korlibs.time.millisecondsLong
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.CoroutineStart
|
||||
import kotlinx.coroutines.currentCoroutineContext
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlin.js.JsName
|
||||
import kotlin.jvm.JvmName
|
||||
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
|
||||
*/
|
||||
class LiveLocationProvider internal constructor(
|
||||
public class LiveLocationProvider internal constructor(
|
||||
private val requestsExecutor: TelegramBot,
|
||||
scope: CoroutineScope,
|
||||
autoCloseTimeDelay: Double,
|
||||
@@ -53,23 +41,23 @@ class LiveLocationProvider internal constructor(
|
||||
}
|
||||
}
|
||||
private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay)
|
||||
val leftUntilCloseMillis: TimeSpan
|
||||
public val leftUntilCloseMillis: TimeSpan
|
||||
get() = autoCloseTime - DateTime.now()
|
||||
|
||||
var isClosed: Boolean = false
|
||||
public var isClosed: Boolean = false
|
||||
private set
|
||||
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
||||
|
||||
var message: ContentMessage<LocationContent> = initMessage
|
||||
public var message: ContentMessage<LocationContent> = initMessage
|
||||
private set
|
||||
val lastLocation: LiveLocation
|
||||
public val lastLocation: LiveLocation
|
||||
get() = message.content.location as LiveLocation
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun updateLocation(
|
||||
public suspend fun updateLocation(
|
||||
location: LiveLocation,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
): LiveLocation {
|
||||
@@ -77,7 +65,7 @@ class LiveLocationProvider internal constructor(
|
||||
message = requestsExecutor.editLiveLocation(
|
||||
message,
|
||||
location,
|
||||
replyMarkup
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
return lastLocation
|
||||
} else {
|
||||
@@ -98,7 +86,7 @@ class LiveLocationProvider internal constructor(
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend fun TelegramBot.startLiveLocation(
|
||||
public suspend fun TelegramBot.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chatId: ChatIdentifier,
|
||||
latitude: Double,
|
||||
@@ -108,28 +96,32 @@ suspend fun TelegramBot.startLiveLocation(
|
||||
initHeading: Degrees? = null,
|
||||
initProximityAlertRadius: Meters? = null,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocationProvider {
|
||||
val liveTimeAsDouble = liveTimeMillis.toDouble()
|
||||
val locationMessage = execute(
|
||||
SendLiveLocation(
|
||||
chatId,
|
||||
latitude,
|
||||
longitude,
|
||||
ceil(liveTimeAsDouble / 1000).toInt(),
|
||||
initHorizontalAccuracy,
|
||||
initHeading,
|
||||
initProximityAlertRadius,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
chatId = chatId,
|
||||
latitude = latitude,
|
||||
longitude = longitude,
|
||||
livePeriod = ceil(liveTimeAsDouble / 1000).toInt(),
|
||||
horizontalAccuracy = initHorizontalAccuracy,
|
||||
heading = initHeading,
|
||||
proximityAlertRadius = initProximityAlertRadius,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
allowPaidBroadcast = allowPaidBroadcast,
|
||||
effectId = effectId,
|
||||
replyParameters = replyParameters,
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
@@ -145,7 +137,7 @@ suspend fun TelegramBot.startLiveLocation(
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend fun TelegramBot.startLiveLocation(
|
||||
public suspend fun TelegramBot.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chat: Chat,
|
||||
latitude: Double,
|
||||
@@ -155,33 +147,37 @@ suspend fun TelegramBot.startLiveLocation(
|
||||
initHeading: Degrees? = null,
|
||||
initProximityAlertRadius: Meters? = null,
|
||||
threadId: MessageThreadId? = chat.id.threadId,
|
||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocationProvider = startLiveLocation(
|
||||
scope,
|
||||
chat.id,
|
||||
latitude,
|
||||
longitude,
|
||||
liveTimeMillis,
|
||||
initHorizontalAccuracy,
|
||||
initHeading,
|
||||
initProximityAlertRadius,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
scope = scope,
|
||||
chatId = chat.id,
|
||||
latitude = latitude,
|
||||
longitude = longitude,
|
||||
liveTimeMillis = liveTimeMillis,
|
||||
initHorizontalAccuracy = initHorizontalAccuracy,
|
||||
initHeading = initHeading,
|
||||
initProximityAlertRadius = initProximityAlertRadius,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
allowPaidBroadcast = allowPaidBroadcast,
|
||||
effectId = effectId,
|
||||
replyParameters = replyParameters,
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend fun TelegramBot.startLiveLocation(
|
||||
public suspend fun TelegramBot.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chatId: IdChatIdentifier,
|
||||
location: StaticLocation,
|
||||
@@ -190,33 +186,37 @@ suspend fun TelegramBot.startLiveLocation(
|
||||
initHeading: Degrees? = null,
|
||||
initProximityAlertRadius: Meters? = null,
|
||||
threadId: MessageThreadId? = chatId.threadId,
|
||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocationProvider = startLiveLocation(
|
||||
scope,
|
||||
chatId,
|
||||
location.latitude,
|
||||
location.longitude,
|
||||
liveTimeMillis,
|
||||
initHorizontalAccuracy,
|
||||
initHeading,
|
||||
initProximityAlertRadius,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
scope = scope,
|
||||
chatId = chatId,
|
||||
latitude = location.latitude,
|
||||
longitude = location.longitude,
|
||||
liveTimeMillis = liveTimeMillis,
|
||||
initHorizontalAccuracy = initHorizontalAccuracy,
|
||||
initHeading = initHeading,
|
||||
initProximityAlertRadius = initProximityAlertRadius,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
allowPaidBroadcast = allowPaidBroadcast,
|
||||
effectId = effectId,
|
||||
replyParameters = replyParameters,
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend fun TelegramBot.startLiveLocation(
|
||||
public suspend fun TelegramBot.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chat: Chat,
|
||||
location: StaticLocation,
|
||||
@@ -225,34 +225,38 @@ suspend fun TelegramBot.startLiveLocation(
|
||||
initHeading: Degrees? = null,
|
||||
initProximityAlertRadius: Meters? = null,
|
||||
threadId: MessageThreadId? = chat.id.threadId,
|
||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
replyToMessageId: MessageId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
replyParameters: ReplyParameters? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocationProvider = startLiveLocation(
|
||||
scope,
|
||||
chat.id,
|
||||
location.latitude,
|
||||
location.longitude,
|
||||
liveTimeMillis,
|
||||
initHorizontalAccuracy,
|
||||
initHeading,
|
||||
initProximityAlertRadius,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
replyToMessageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
scope = scope,
|
||||
chatId = chat.id,
|
||||
latitude = location.latitude,
|
||||
longitude = location.longitude,
|
||||
liveTimeMillis = liveTimeMillis,
|
||||
initHorizontalAccuracy = initHorizontalAccuracy,
|
||||
initHeading = initHeading,
|
||||
initProximityAlertRadius = initProximityAlertRadius,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
allowPaidBroadcast = allowPaidBroadcast,
|
||||
effectId = effectId,
|
||||
replyParameters = replyParameters,
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some of [KeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.replyKeyboard] or
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
to: Message,
|
||||
public suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
to: AccessibleMessage,
|
||||
scope: CoroutineScope,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
@@ -261,33 +265,38 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
initHeading: Degrees? = null,
|
||||
initProximityAlertRadius: Meters? = null,
|
||||
threadId: MessageThreadId? = to.threadIdOrNull,
|
||||
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = startLiveLocation(
|
||||
scope,
|
||||
to.chat,
|
||||
latitude,
|
||||
longitude,
|
||||
liveTimeMillis,
|
||||
initHorizontalAccuracy,
|
||||
initHeading,
|
||||
initProximityAlertRadius,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
to.messageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
): LiveLocationProvider = startLiveLocation(
|
||||
scope = scope,
|
||||
chat = to.chat,
|
||||
latitude = latitude,
|
||||
longitude = longitude,
|
||||
liveTimeMillis = liveTimeMillis,
|
||||
initHorizontalAccuracy = initHorizontalAccuracy,
|
||||
initHeading = initHeading,
|
||||
initProximityAlertRadius = initProximityAlertRadius,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
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
|
||||
* [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard] as a builders for that param
|
||||
*/
|
||||
suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
to: Message,
|
||||
public suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
to: AccessibleMessage,
|
||||
scope: CoroutineScope,
|
||||
location: StaticLocation,
|
||||
liveTimeMillis: Long = defaultLivePeriodDelayMillis,
|
||||
@@ -295,22 +304,27 @@ suspend inline fun TelegramBot.replyWithLiveLocation(
|
||||
initHeading: Degrees? = null,
|
||||
initProximityAlertRadius: Meters? = null,
|
||||
threadId: MessageThreadId? = to.threadIdOrNull,
|
||||
businessConnectionId: BusinessConnectionId? = to.businessConnectionId,
|
||||
disableNotification: Boolean = false,
|
||||
protectContent: Boolean = false,
|
||||
allowPaidBroadcast: Boolean = false,
|
||||
effectId: EffectId? = null,
|
||||
allowSendingWithoutReply: Boolean? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = startLiveLocation(
|
||||
scope,
|
||||
to.chat,
|
||||
location,
|
||||
liveTimeMillis,
|
||||
initHorizontalAccuracy,
|
||||
initHeading,
|
||||
initProximityAlertRadius,
|
||||
threadId,
|
||||
disableNotification,
|
||||
protectContent,
|
||||
to.messageId,
|
||||
allowSendingWithoutReply,
|
||||
replyMarkup
|
||||
): LiveLocationProvider = startLiveLocation(
|
||||
scope = scope,
|
||||
chat = to.chat,
|
||||
location = location,
|
||||
liveTimeMillis = liveTimeMillis,
|
||||
initHorizontalAccuracy = initHorizontalAccuracy,
|
||||
initHeading = initHeading,
|
||||
initProximityAlertRadius = initProximityAlertRadius,
|
||||
threadId = threadId,
|
||||
businessConnectionId = businessConnectionId,
|
||||
disableNotification = disableNotification,
|
||||
protectContent = protectContent,
|
||||
allowPaidBroadcast = allowPaidBroadcast,
|
||||
effectId = effectId,
|
||||
replyParameters = ReplyParameters(to.metaInfo, allowSendingWithoutReply = allowSendingWithoutReply),
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
|
||||
@@ -3,4 +3,4 @@ package dev.inmo.tgbotapi.extensions.api
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.local.LogOut
|
||||
|
||||
suspend inline fun TelegramBot.logOut() = execute(LogOut)
|
||||
public suspend inline fun TelegramBot.logOut(): Boolean = execute(LogOut)
|
||||
|
||||
@@ -3,48 +3,54 @@ package dev.inmo.tgbotapi.extensions.api
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.StopPoll
|
||||
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.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.Message
|
||||
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]
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.stopPoll(
|
||||
public suspend fun TelegramBot.stopPoll(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageId,
|
||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
StopPoll(chatId, messageId, replyMarkup)
|
||||
): Poll = execute(
|
||||
StopPoll(chatId, messageId, businessConnectionId, replyMarkup)
|
||||
)
|
||||
|
||||
/**
|
||||
* @param replyMarkup Some [InlineKeyboardMarkup]. See [dev.inmo.tgbotapi.extensions.utils.types.buttons.inlineKeyboard]
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.stopPoll(
|
||||
public suspend fun TelegramBot.stopPoll(
|
||||
chat: Chat,
|
||||
messageId: MessageId,
|
||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||
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]
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.stopPoll(
|
||||
public suspend fun TelegramBot.stopPoll(
|
||||
chatId: IdChatIdentifier,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
|
||||
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]
|
||||
* as a builder for that
|
||||
*/
|
||||
suspend fun TelegramBot.stopPoll(
|
||||
public suspend fun TelegramBot.stopPoll(
|
||||
chat: Chat,
|
||||
message: Message,
|
||||
message: AccessibleMessage,
|
||||
businessConnectionId: BusinessConnectionId? = chat.id.businessConnectionId,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
||||
): Poll = stopPoll(chat.id, message.messageId, businessConnectionId, replyMarkup)
|
||||
|
||||
@@ -3,28 +3,28 @@ package dev.inmo.tgbotapi.extensions.api.answers
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.answers.AnswerCallbackQuery
|
||||
import dev.inmo.tgbotapi.types.queries.callback.CallbackQuery
|
||||
import dev.inmo.tgbotapi.types.CallbackQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.CallbackQueryId
|
||||
|
||||
suspend fun TelegramBot.answerCallbackQuery(
|
||||
callbackQueryId: CallbackQueryIdentifier,
|
||||
public suspend fun TelegramBot.answerCallbackQuery(
|
||||
callbackQueryId: CallbackQueryId,
|
||||
text: String? = null,
|
||||
showAlert: Boolean? = null,
|
||||
url: String? = 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,
|
||||
text: String? = null,
|
||||
showAlert: Boolean? = null,
|
||||
url: String? = 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,
|
||||
text: String? = null,
|
||||
showAlert: Boolean? = null,
|
||||
url: String? = null,
|
||||
cachedTimeSeconds: Int? = null
|
||||
) = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
||||
): Boolean = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
||||
|
||||
@@ -2,38 +2,68 @@ package dev.inmo.tgbotapi.extensions.api.answers
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.answers.AnswerInlineQuery
|
||||
import dev.inmo.tgbotapi.requests.answers.InlineQueryResultsButton
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.query.InlineQuery
|
||||
import dev.inmo.tgbotapi.types.InlineQueryIdentifier
|
||||
import dev.inmo.tgbotapi.types.InlineQueryId
|
||||
|
||||
suspend fun TelegramBot.answerInlineQuery(
|
||||
inlineQueryID: InlineQueryIdentifier,
|
||||
public suspend fun TelegramBot.answerInlineQuery(
|
||||
inlineQueryID: InlineQueryId,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
switchPmText: String? = null,
|
||||
switchPmParameter: String? = null
|
||||
) = execute(
|
||||
button: InlineQueryResultsButton? = null
|
||||
): Boolean = execute(
|
||||
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, button)
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.answerInlineQuery(
|
||||
inlineQuery: InlineQuery,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
button: InlineQueryResultsButton? = null
|
||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
||||
|
||||
public suspend fun TelegramBot.answer(
|
||||
inlineQuery: InlineQuery,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
button: InlineQueryResultsButton? = null
|
||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, button)
|
||||
|
||||
public suspend fun TelegramBot.answerInlineQuery(
|
||||
inlineQueryID: InlineQueryId,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
switchPmText: String?,
|
||||
switchPmParameter: String?
|
||||
): Boolean = execute(
|
||||
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.answerInlineQuery(
|
||||
public suspend fun TelegramBot.answerInlineQuery(
|
||||
inlineQuery: InlineQuery,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
switchPmText: String? = null,
|
||||
switchPmParameter: String? = null
|
||||
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||
switchPmText: String?,
|
||||
switchPmParameter: String?
|
||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||
|
||||
suspend fun TelegramBot.answer(
|
||||
public suspend fun TelegramBot.answer(
|
||||
inlineQuery: InlineQuery,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
switchPmText: String? = null,
|
||||
switchPmParameter: String? = null
|
||||
) = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||
switchPmText: String?,
|
||||
switchPmParameter: String?
|
||||
): Boolean = answerInlineQuery(inlineQuery.id, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||
|
||||
@@ -4,13 +4,14 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.answers.AnswerWebAppQuery
|
||||
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
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,
|
||||
result: InlineQueryResult
|
||||
) = execute(AnswerWebAppQuery(webAppQueryId, result))
|
||||
): SentWebAppMessage = execute(AnswerWebAppQuery(webAppQueryId, result))
|
||||
|
||||
suspend fun TelegramBot.answer(
|
||||
public suspend fun TelegramBot.answer(
|
||||
webAppQueryId: WebAppQueryId,
|
||||
result: InlineQueryResult
|
||||
) = execute(AnswerWebAppQuery(webAppQueryId, result))
|
||||
): SentWebAppMessage = execute(AnswerWebAppQuery(webAppQueryId, result))
|
||||
|
||||
@@ -6,18 +6,18 @@ import dev.inmo.tgbotapi.requests.answers.payments.AnswerPreCheckoutQueryOk
|
||||
import dev.inmo.tgbotapi.types.PreCheckoutQueryId
|
||||
import dev.inmo.tgbotapi.types.payments.PreCheckoutQuery
|
||||
|
||||
suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
||||
public suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
||||
id: PreCheckoutQueryId
|
||||
) = execute(AnswerPreCheckoutQueryOk(id))
|
||||
suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
||||
): Boolean = execute(AnswerPreCheckoutQueryOk(id))
|
||||
public suspend fun TelegramBot.answerPreCheckoutQueryOk(
|
||||
preCheckoutQuery: PreCheckoutQuery
|
||||
) = answerPreCheckoutQueryOk(preCheckoutQuery.id)
|
||||
): Boolean = answerPreCheckoutQueryOk(preCheckoutQuery.id)
|
||||
|
||||
suspend fun TelegramBot.answerPreCheckoutQueryError(
|
||||
public suspend fun TelegramBot.answerPreCheckoutQueryError(
|
||||
id: PreCheckoutQueryId,
|
||||
error: String
|
||||
) = execute(AnswerPreCheckoutQueryError(id, error))
|
||||
suspend fun TelegramBot.answerPreCheckoutQueryError(
|
||||
): Boolean = execute(AnswerPreCheckoutQueryError(id, error))
|
||||
public suspend fun TelegramBot.answerPreCheckoutQueryError(
|
||||
preCheckoutQuery: PreCheckoutQuery,
|
||||
error: String
|
||||
) = answerPreCheckoutQueryError(preCheckoutQuery.id, error)
|
||||
): Boolean = answerPreCheckoutQueryError(preCheckoutQuery.id, error)
|
||||
|
||||
@@ -3,26 +3,26 @@ package dev.inmo.tgbotapi.extensions.api.answers.payments
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.answers.payments.AnswerShippingQueryError
|
||||
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.ShippingQuery
|
||||
|
||||
suspend fun TelegramBot.answerShippingQueryOk(
|
||||
id: ShippingQueryIdentifier,
|
||||
public suspend fun TelegramBot.answerShippingQueryOk(
|
||||
id: ShippingQueryId,
|
||||
shippingOptions: List<ShippingOption>
|
||||
) = execute(AnswerShippingQueryOk(id, shippingOptions))
|
||||
suspend fun TelegramBot.answerShippingQueryOk(
|
||||
): Boolean = execute(AnswerShippingQueryOk(id, shippingOptions))
|
||||
public suspend fun TelegramBot.answerShippingQueryOk(
|
||||
shippingQuery: ShippingQuery,
|
||||
shippingOptions: List<ShippingOption>
|
||||
) = answerShippingQueryOk(shippingQuery.id, shippingOptions)
|
||||
): Boolean = answerShippingQueryOk(shippingQuery.id, shippingOptions)
|
||||
|
||||
suspend fun TelegramBot.answerShippingQueryError(
|
||||
id: ShippingQueryIdentifier,
|
||||
public suspend fun TelegramBot.answerShippingQueryError(
|
||||
id: ShippingQueryId,
|
||||
error: String
|
||||
) = execute(AnswerShippingQueryError(id, error))
|
||||
suspend fun TelegramBot.answerShippingQueryError(
|
||||
): Boolean = execute(AnswerShippingQueryError(id, error))
|
||||
public suspend fun TelegramBot.answerShippingQueryError(
|
||||
shippingQuery: ShippingQuery,
|
||||
error: String
|
||||
) = answerShippingQueryError(shippingQuery.id, error)
|
||||
): Boolean = answerShippingQueryError(shippingQuery.id, error)
|
||||
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@ package dev.inmo.tgbotapi.extensions.api.bot
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.ClearMyDefaultAdministratorRights
|
||||
|
||||
suspend fun TelegramBot.clearMyDefaultAdministratorRights(
|
||||
public suspend fun TelegramBot.clearMyDefaultAdministratorRights(
|
||||
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)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.DeleteMyCommands
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.deleteMyCommands(
|
||||
public suspend fun TelegramBot.deleteMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode?
|
||||
) = execute(DeleteMyCommands(scope, languageCode))
|
||||
languageCode: IetfLang?
|
||||
): Boolean = execute(DeleteMyCommands(scope, languageCode))
|
||||
|
||||
suspend fun TelegramBot.deleteMyCommands(
|
||||
public suspend fun TelegramBot.deleteMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String? = null
|
||||
) = deleteMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
||||
): Boolean = deleteMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||
|
||||
@@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
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)
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.types.BotCommand
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.getMyCommands(
|
||||
public suspend fun TelegramBot.getMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode? = null
|
||||
) = execute(GetMyCommands(scope, languageCode))
|
||||
languageCode: IetfLang? = null
|
||||
): List<BotCommand> = execute(GetMyCommands(scope, languageCode))
|
||||
|
||||
suspend fun TelegramBot.getMyCommands(
|
||||
public suspend fun TelegramBot.getMyCommands(
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String?
|
||||
) = getMyCommands(scope, languageCode ?.let(::IetfLanguageCode))
|
||||
): List<BotCommand> = getMyCommands(scope, languageCode ?.let(::IetfLang))
|
||||
|
||||
@@ -2,11 +2,12 @@ package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
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
|
||||
) = 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)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||
import dev.inmo.tgbotapi.types.BotDescription
|
||||
|
||||
public suspend fun TelegramBot.getMyDescription(
|
||||
languageCode: IetfLang? = null
|
||||
): BotDescription = execute(GetMyDescription(languageCode))
|
||||
|
||||
public suspend fun TelegramBot.getMyDescription(
|
||||
languageCode: String?
|
||||
): BotDescription = getMyDescription(languageCode ?.let(::IetfLang))
|
||||
@@ -0,0 +1,14 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
||||
import dev.inmo.tgbotapi.types.BotName
|
||||
|
||||
public suspend fun TelegramBot.getMyName(
|
||||
languageCode: IetfLang? = null
|
||||
): BotName = execute(GetMyName(languageCode))
|
||||
|
||||
public suspend fun TelegramBot.getMyName(
|
||||
languageCode: String?
|
||||
): BotName = getMyName(languageCode ?.let(::IetfLang))
|
||||
@@ -0,0 +1,17 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyShortDescription
|
||||
import dev.inmo.tgbotapi.types.BotShortDescription
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
public suspend fun TelegramBot.getMyShortDescription(
|
||||
languageCode: IetfLang? = null
|
||||
): BotShortDescription = execute(GetMyShortDescription(languageCode))
|
||||
|
||||
public suspend fun TelegramBot.getMyShortDescription(
|
||||
languageCode: String?
|
||||
): BotShortDescription = getMyShortDescription(languageCode ?.let(::IetfLang))
|
||||
@@ -0,0 +1,9 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMe
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyStarBalance
|
||||
import dev.inmo.tgbotapi.types.chat.ExtendedBot
|
||||
import dev.inmo.tgbotapi.types.payments.stars.StarAmount
|
||||
|
||||
public suspend fun TelegramBot.getMyStarBalance(): StarAmount = execute(GetMyStarBalance)
|
||||
@@ -1,32 +1,32 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLanguageCode
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyCommands
|
||||
import dev.inmo.tgbotapi.types.BotCommand
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
public suspend fun TelegramBot.setMyCommands(
|
||||
commands: List<BotCommand>,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode?
|
||||
) = execute(SetMyCommands(commands, scope, languageCode))
|
||||
languageCode: IetfLang?
|
||||
): Boolean = execute(SetMyCommands(commands, scope, languageCode))
|
||||
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
public suspend fun TelegramBot.setMyCommands(
|
||||
vararg commands: BotCommand,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: IetfLanguageCode?
|
||||
) = setMyCommands(commands.toList(), scope, languageCode)
|
||||
languageCode: IetfLang?
|
||||
): Boolean = setMyCommands(commands.toList(), scope, languageCode)
|
||||
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
public suspend fun TelegramBot.setMyCommands(
|
||||
commands: List<BotCommand>,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String? = null
|
||||
) = setMyCommands(commands, scope, languageCode ?.let(::IetfLanguageCode))
|
||||
): Boolean = setMyCommands(commands, scope, languageCode ?.let(::IetfLang))
|
||||
|
||||
suspend fun TelegramBot.setMyCommands(
|
||||
public suspend fun TelegramBot.setMyCommands(
|
||||
vararg commands: BotCommand,
|
||||
scope: BotCommandScope = BotCommandScopeDefault,
|
||||
languageCode: String? = null
|
||||
) = setMyCommands(commands.toList(), scope, languageCode)
|
||||
): Boolean = setMyCommands(commands.toList(), scope, languageCode)
|
||||
|
||||
@@ -2,17 +2,17 @@ package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyDefaultAdministratorRights
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatAdministratorRightsImpl
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatCommonAdministratorRights
|
||||
|
||||
suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
||||
rights: ChatAdministratorRightsImpl,
|
||||
public suspend fun TelegramBot.setMyDefaultAdministratorRights(
|
||||
rights: ChatCommonAdministratorRights,
|
||||
forChannels: Boolean? = null
|
||||
) = execute(SetMyDefaultAdministratorRights(rights, forChannels))
|
||||
): Boolean = execute(SetMyDefaultAdministratorRights(rights, forChannels))
|
||||
|
||||
suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
|
||||
rights: ChatAdministratorRightsImpl
|
||||
) = setMyDefaultAdministratorRights(rights, forChannels = true)
|
||||
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForChannels(
|
||||
rights: ChatCommonAdministratorRights
|
||||
): Boolean = setMyDefaultAdministratorRights(rights, forChannels = true)
|
||||
|
||||
suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
|
||||
rights: ChatAdministratorRightsImpl
|
||||
) = setMyDefaultAdministratorRights(rights, forChannels = false)
|
||||
public suspend fun TelegramBot.setMyDefaultAdministratorRightsForGroupsAndSupergroups(
|
||||
rights: ChatCommonAdministratorRights
|
||||
): Boolean = setMyDefaultAdministratorRights(rights, forChannels = false)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyDescription
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyDescription
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
public suspend fun TelegramBot.setMyDescription(
|
||||
description: String? = null,
|
||||
languageCode: IetfLang? = null
|
||||
): Boolean = execute(SetMyDescription(description, languageCode))
|
||||
|
||||
public suspend fun TelegramBot.setMyDescription(
|
||||
description: String?,
|
||||
languageCode: String?
|
||||
): Boolean = setMyDescription(description, languageCode ?.let(::IetfLang))
|
||||
@@ -0,0 +1,19 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyCommands
|
||||
import dev.inmo.tgbotapi.requests.bot.GetMyName
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyName
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScope
|
||||
import dev.inmo.tgbotapi.types.commands.BotCommandScopeDefault
|
||||
|
||||
public suspend fun TelegramBot.setMyName(
|
||||
name: String? = null,
|
||||
languageCode: IetfLang? = null
|
||||
): Boolean = execute(SetMyName(name, languageCode))
|
||||
|
||||
public suspend fun TelegramBot.setMyName(
|
||||
name: String?,
|
||||
languageCode: String?
|
||||
): Boolean = setMyName(name, languageCode ?.let(::IetfLang))
|
||||
@@ -0,0 +1,15 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.bot
|
||||
|
||||
import dev.inmo.micro_utils.language_codes.IetfLang
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.bot.SetMyShortDescription
|
||||
|
||||
public suspend fun TelegramBot.setMyShortDescription(
|
||||
shortDescription: String? = null,
|
||||
languageCode: IetfLang? = null
|
||||
): Boolean = execute(SetMyShortDescription(shortDescription, languageCode))
|
||||
|
||||
public suspend fun TelegramBot.setMyShortDescription(
|
||||
shortDescription: String?,
|
||||
languageCode: String?
|
||||
): Boolean = setMyShortDescription(shortDescription, languageCode ?.let(::IetfLang))
|
||||
@@ -0,0 +1,25 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.business_connection.ConvertGiftToStars
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.GiftId
|
||||
import dev.inmo.tgbotapi.types.gifts.Gift
|
||||
|
||||
public suspend fun TelegramBot.convertGiftToStars(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
ownedGiftId: GiftId
|
||||
): Boolean = execute(
|
||||
ConvertGiftToStars(businessConnectionId, ownedGiftId)
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.convertGiftToStars(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
gift: Gift.Regular
|
||||
): Boolean = convertGiftToStars(
|
||||
businessConnectionId = businessConnectionId,
|
||||
ownedGiftId = with(gift) {id}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.business_connection.DeleteBusinessMessages
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
|
||||
@GenerateVariations
|
||||
public suspend fun TelegramBot.deleteBusinessMessages(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
@GenerationVariant(List::class, "messages.map { it.messageId }", "messages", AccessibleMessage::class)
|
||||
messageIds: List<MessageId>
|
||||
): Boolean = execute(
|
||||
DeleteBusinessMessages(businessConnectionId, messageIds)
|
||||
)
|
||||
@@ -0,0 +1,16 @@
|
||||
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY
|
||||
// TO REGENERATE IT JUST DELETE FILE
|
||||
// ORIGINAL FILE: DeleteBusinessMessages.kt
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import kotlin.Boolean
|
||||
import kotlin.collections.List
|
||||
|
||||
public suspend fun TelegramBot.deleteBusinessMessages(businessConnectionId: BusinessConnectionId,
|
||||
messages: List<AccessibleMessage>): Boolean = deleteBusinessMessages(
|
||||
businessConnectionId = businessConnectionId, messageIds = with(messages) {messages.map {
|
||||
it.messageId }}
|
||||
)
|
||||
@@ -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)
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.business_connection.GetBusinessAccountStarBalance
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.payments.stars.StarAmount
|
||||
|
||||
public suspend fun TelegramBot.getBusinessAccountStarBalance(
|
||||
businessConnectionId: BusinessConnectionId
|
||||
): StarAmount = execute(
|
||||
GetBusinessAccountStarBalance(businessConnectionId)
|
||||
)
|
||||
@@ -0,0 +1,27 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.micro_utils.ksp.variations.GenerateVariations
|
||||
import dev.inmo.micro_utils.ksp.variations.GenerationVariant
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.business_connection.ReadBusinessMessage
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.ChatId
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.AccessibleMessage
|
||||
import dev.inmo.tgbotapi.types.toChatId
|
||||
|
||||
@GenerateVariations
|
||||
public suspend fun TelegramBot.readBusinessMessage(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
@GenerationVariant(Chat::class, "chat.id.toChatId()", "chat")
|
||||
chatId: ChatId,
|
||||
messageId: MessageId
|
||||
): Boolean = execute(
|
||||
ReadBusinessMessage(businessConnectionId, chatId, messageId)
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.readBusinessMessage(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
message: AccessibleMessage
|
||||
): Boolean = readBusinessMessage(businessConnectionId, message.chat.id.toChatId(), message.messageId)
|
||||
@@ -0,0 +1,20 @@
|
||||
// THIS CODE HAVE BEEN GENERATED AUTOMATICALLY
|
||||
// TO REGENERATE IT JUST DELETE FILE
|
||||
// ORIGINAL FILE: ReadBusinessMessage.kt
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.types.MessageId
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.types.toChatId
|
||||
import kotlin.Boolean
|
||||
|
||||
public suspend fun TelegramBot.readBusinessMessage(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
chat: Chat,
|
||||
messageId: MessageId,
|
||||
): Boolean = readBusinessMessage(
|
||||
businessConnectionId = businessConnectionId, chatId = with(chat) {chat.id.toChatId()}, messageId
|
||||
= messageId
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.business_connection.RemoveBusinessAccountProfilePhoto
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
|
||||
public suspend fun TelegramBot.removeBusinessAccountProfilePhoto(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
isPublic: Boolean = false
|
||||
): Boolean = execute(
|
||||
RemoveBusinessAccountProfilePhoto(businessConnectionId = businessConnectionId, isPublic = isPublic)
|
||||
)
|
||||
@@ -0,0 +1,12 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountBio
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
|
||||
public suspend fun TelegramBot.setBusinessAccountBio(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
bio: String
|
||||
): Boolean = execute(
|
||||
SetBusinessAccountBio(businessConnectionId, bio)
|
||||
)
|
||||
@@ -0,0 +1,35 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.business
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.business_connection.SetBusinessAccountGiftSettings
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.gifts.AcceptedGiftTypes
|
||||
import dev.inmo.tgbotapi.types.message.abstracts.BusinessContentMessage
|
||||
|
||||
/**
|
||||
* Sets the gift settings for a business account
|
||||
*/
|
||||
public suspend fun TelegramBot.setBusinessAccountGiftSettings(
|
||||
businessConnectionId: BusinessConnectionId,
|
||||
showGiftButton: Boolean,
|
||||
acceptedGiftTypes: AcceptedGiftTypes
|
||||
): 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
|
||||
)
|
||||
@@ -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)
|
||||
)
|
||||
@@ -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)
|
||||
)
|
||||
@@ -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)
|
||||
)
|
||||
@@ -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) }
|
||||
)
|
||||
@@ -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)
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
@@ -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
|
||||
)
|
||||
)
|
||||
@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.chat.ExportChatInviteLink
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
|
||||
suspend fun TelegramBot.exportChatInviteLink(
|
||||
public suspend fun TelegramBot.exportChatInviteLink(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(ExportChatInviteLink(chatId))
|
||||
): String = execute(ExportChatInviteLink(chatId))
|
||||
|
||||
suspend fun TelegramBot.exportChatInviteLink(
|
||||
public suspend fun TelegramBot.exportChatInviteLink(
|
||||
chat: PublicChat
|
||||
) = exportChatInviteLink(chat.id)
|
||||
): String = exportChatInviteLink(chat.id)
|
||||
|
||||
@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.chat.LeaveChat
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
|
||||
suspend fun TelegramBot.leaveChat(
|
||||
public suspend fun TelegramBot.leaveChat(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(LeaveChat(chatId))
|
||||
): Boolean = execute(LeaveChat(chatId))
|
||||
|
||||
suspend fun TelegramBot.leaveChat(
|
||||
public suspend fun TelegramBot.leaveChat(
|
||||
chat: PublicChat
|
||||
) = leaveChat(chat.id)
|
||||
): Boolean = leaveChat(chat.id)
|
||||
|
||||
@@ -7,22 +7,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.closeForumTopic(
|
||||
public suspend fun TelegramBot.closeForumTopic(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
CloseForumTopic(
|
||||
chatId,
|
||||
messageThreadId
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.closeForumTopic(
|
||||
public suspend fun TelegramBot.closeForumTopic(
|
||||
chat: Chat,
|
||||
messageThreadId: MessageThreadId
|
||||
) = closeForumTopic(chat.id, messageThreadId)
|
||||
): Boolean = closeForumTopic(chat.id, messageThreadId)
|
||||
|
||||
suspend fun TelegramBot.closeForumTopic(
|
||||
public suspend fun TelegramBot.closeForumTopic(
|
||||
chat: Chat,
|
||||
forumTopic: ForumTopic
|
||||
) = closeForumTopic(chat.id, forumTopic.messageThreadId)
|
||||
): Boolean = closeForumTopic(chat.id, forumTopic.messageThreadId)
|
||||
|
||||
@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.closeGeneralForumTopic(
|
||||
public suspend fun TelegramBot.closeGeneralForumTopic(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
CloseGeneralForumTopic(chatId)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.closeGeneralForumTopic(
|
||||
public suspend fun TelegramBot.closeGeneralForumTopic(
|
||||
chat: Chat
|
||||
) = closeGeneralForumTopic(chat.id)
|
||||
): Boolean = closeGeneralForumTopic(chat.id)
|
||||
|
||||
@@ -4,15 +4,16 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.forum.CreateForumTopic
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.CustomEmojiId
|
||||
import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
import dev.inmo.tgbotapi.utils.RGBColor
|
||||
|
||||
suspend fun TelegramBot.createForumTopic(
|
||||
public suspend fun TelegramBot.createForumTopic(
|
||||
chatId: ChatIdentifier,
|
||||
name: String,
|
||||
color: RGBColor,
|
||||
iconEmojiId: CustomEmojiId? = null
|
||||
) = execute(
|
||||
): ForumTopic = execute(
|
||||
CreateForumTopic(
|
||||
chatId,
|
||||
name,
|
||||
@@ -21,9 +22,9 @@ suspend fun TelegramBot.createForumTopic(
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.createForumTopic(
|
||||
public suspend fun TelegramBot.createForumTopic(
|
||||
chat: Chat,
|
||||
name: String,
|
||||
color: RGBColor,
|
||||
iconEmojiId: CustomEmojiId? = null
|
||||
) = createForumTopic(chat.id, name, color, iconEmojiId)
|
||||
): ForumTopic = createForumTopic(chat.id, name, color, iconEmojiId)
|
||||
|
||||
@@ -7,27 +7,27 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.deleteForumTopic(
|
||||
public suspend fun TelegramBot.deleteForumTopic(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
DeleteForumTopic(
|
||||
chatId,
|
||||
messageThreadId
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.deleteForumTopic(
|
||||
public suspend fun TelegramBot.deleteForumTopic(
|
||||
chatId: ChatIdentifier,
|
||||
forumTopic: ForumTopic
|
||||
) = deleteForumTopic(chatId, forumTopic.messageThreadId)
|
||||
): Boolean = deleteForumTopic(chatId, forumTopic.messageThreadId)
|
||||
|
||||
suspend fun TelegramBot.deleteForumTopic(
|
||||
public suspend fun TelegramBot.deleteForumTopic(
|
||||
chat: Chat,
|
||||
messageThreadId: MessageThreadId
|
||||
) = deleteForumTopic(chat.id, messageThreadId)
|
||||
): Boolean = deleteForumTopic(chat.id, messageThreadId)
|
||||
|
||||
suspend fun TelegramBot.deleteForumTopic(
|
||||
public suspend fun TelegramBot.deleteForumTopic(
|
||||
chat: Chat,
|
||||
forumTopic: ForumTopic
|
||||
) = deleteForumTopic(chat.id, forumTopic.messageThreadId)
|
||||
): Boolean = deleteForumTopic(chat.id, forumTopic.messageThreadId)
|
||||
|
||||
@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.editForumTopic(
|
||||
public suspend fun TelegramBot.editForumTopic(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId,
|
||||
name: String? = null,
|
||||
iconEmojiId: CustomEmojiId? = null
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
EditForumTopic(
|
||||
chatId,
|
||||
messageThreadId,
|
||||
@@ -22,15 +22,15 @@ suspend fun TelegramBot.editForumTopic(
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.editForumTopic(
|
||||
public suspend fun TelegramBot.editForumTopic(
|
||||
chat: Chat,
|
||||
messageThreadId: MessageThreadId,
|
||||
name: String? = 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,
|
||||
forumTopic: ForumTopic,
|
||||
iconEmojiId: CustomEmojiId? = forumTopic.iconEmojiId
|
||||
) = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)
|
||||
): Boolean = editForumTopic(chatIdentifier, forumTopic.messageThreadId, forumTopic.name, iconEmojiId)
|
||||
|
||||
@@ -9,22 +9,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.editGeneralForumTopic(
|
||||
public suspend fun TelegramBot.editGeneralForumTopic(
|
||||
chatId: ChatIdentifier,
|
||||
name: String
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
EditGeneralForumTopic(
|
||||
chatId,
|
||||
name
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.editGeneralForumTopic(
|
||||
public suspend fun TelegramBot.editGeneralForumTopic(
|
||||
chat: Chat,
|
||||
name: String
|
||||
) = editGeneralForumTopic(chat.id, name)
|
||||
): Boolean = editGeneralForumTopic(chat.id, name)
|
||||
|
||||
suspend fun TelegramBot.editGeneralForumTopic(
|
||||
public suspend fun TelegramBot.editGeneralForumTopic(
|
||||
chatIdentifier: ChatIdentifier,
|
||||
forumTopic: ForumTopic,
|
||||
) = editGeneralForumTopic(chatIdentifier, forumTopic.name)
|
||||
): Boolean = editGeneralForumTopic(chatIdentifier, forumTopic.name)
|
||||
|
||||
@@ -9,12 +9,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.hideGeneralForumTopic(
|
||||
public suspend fun TelegramBot.hideGeneralForumTopic(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
HideGeneralForumTopic(chatId)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.hideGeneralForumTopic(
|
||||
public suspend fun TelegramBot.hideGeneralForumTopic(
|
||||
chat: Chat
|
||||
) = hideGeneralForumTopic(chat.id)
|
||||
): Boolean = hideGeneralForumTopic(chat.id)
|
||||
|
||||
@@ -7,22 +7,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.reopenForumTopic(
|
||||
public suspend fun TelegramBot.reopenForumTopic(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
ReopenForumTopic(
|
||||
chatId,
|
||||
messageThreadId
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.reopenForumTopic(
|
||||
public suspend fun TelegramBot.reopenForumTopic(
|
||||
chat: Chat,
|
||||
messageThreadId: MessageThreadId
|
||||
) = reopenForumTopic(chat.id, messageThreadId)
|
||||
): Boolean = reopenForumTopic(chat.id, messageThreadId)
|
||||
|
||||
suspend fun TelegramBot.reopenForumTopic(
|
||||
public suspend fun TelegramBot.reopenForumTopic(
|
||||
chat: Chat,
|
||||
forumTopic: ForumTopic
|
||||
) = reopenForumTopic(chat.id, forumTopic.messageThreadId)
|
||||
): Boolean = reopenForumTopic(chat.id, forumTopic.messageThreadId)
|
||||
|
||||
@@ -8,12 +8,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.reopenGeneralForumTopic(
|
||||
public suspend fun TelegramBot.reopenGeneralForumTopic(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
ReopenGeneralForumTopic(chatId)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.reopenGeneralForumTopic(
|
||||
public suspend fun TelegramBot.reopenGeneralForumTopic(
|
||||
chat: Chat
|
||||
) = reopenGeneralForumTopic(chat.id)
|
||||
): Boolean = reopenGeneralForumTopic(chat.id)
|
||||
|
||||
@@ -10,12 +10,12 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.unhideGeneralForumTopic(
|
||||
public suspend fun TelegramBot.unhideGeneralForumTopic(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
UnhideGeneralForumTopic(chatId)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.unhideGeneralForumTopic(
|
||||
public suspend fun TelegramBot.unhideGeneralForumTopic(
|
||||
chat: Chat
|
||||
) = unhideGeneralForumTopic(chat.id)
|
||||
): Boolean = unhideGeneralForumTopic(chat.id)
|
||||
|
||||
@@ -7,22 +7,22 @@ import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||
chatId: ChatIdentifier,
|
||||
messageThreadId: MessageThreadId
|
||||
) = execute(
|
||||
): Boolean = execute(
|
||||
UnpinAllForumTopicMessages(
|
||||
chatId,
|
||||
messageThreadId
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||
chat: Chat,
|
||||
messageThreadId: MessageThreadId
|
||||
) = unpinAllForumTopicMessages(chat.id, messageThreadId)
|
||||
): Boolean = unpinAllForumTopicMessages(chat.id, messageThreadId)
|
||||
|
||||
suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||
public suspend fun TelegramBot.unpinAllForumTopicMessages(
|
||||
chat: Chat,
|
||||
forumTopic: ForumTopic
|
||||
) = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)
|
||||
): Boolean = unpinAllForumTopicMessages(chat.id, forumTopic.messageThreadId)
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.chat.forum
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.forum.UnpinAllForumTopicMessages
|
||||
import dev.inmo.tgbotapi.requests.chat.forum.UnpinAllGeneralForumTopicMessages
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ForumTopic
|
||||
import dev.inmo.tgbotapi.types.MessageThreadId
|
||||
import dev.inmo.tgbotapi.types.chat.Chat
|
||||
|
||||
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
|
||||
chatId: ChatIdentifier
|
||||
): Boolean = execute(
|
||||
UnpinAllGeneralForumTopicMessages(
|
||||
chatId
|
||||
)
|
||||
)
|
||||
|
||||
public suspend fun TelegramBot.unpinAllGeneralForumTopicMessages(
|
||||
chat: Chat
|
||||
): Boolean = unpinAllGeneralForumTopicMessages(chat.id)
|
||||
@@ -3,36 +3,16 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.get.GetChat
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.ChannelChat
|
||||
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.types.chat.*
|
||||
import dev.inmo.tgbotapi.utils.PreviewFeature
|
||||
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChat(chatId))
|
||||
): ExtendedChat = execute(GetChat(chatId))
|
||||
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: Chat
|
||||
) = getChat(chat.id)
|
||||
): ExtendedChat = getChat(chat.id)
|
||||
|
||||
/**
|
||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||
@@ -41,9 +21,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: PublicChat
|
||||
) = getChat(chat.id) as ExtendedPublicChat
|
||||
): ExtendedPublicChat = getChat(chat.id) as ExtendedPublicChat
|
||||
|
||||
|
||||
/**
|
||||
@@ -53,9 +33,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: ChannelChat
|
||||
) = getChat(chat.id) as ExtendedChannelChat
|
||||
): ExtendedChannelChat = getChat(chat.id) as ExtendedChannelChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||
@@ -64,9 +44,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: ChannelChatImpl
|
||||
) = getChat(chat.id) as ExtendedChannelChatImpl
|
||||
): ExtendedChannelChatImpl = getChat(chat.id) as ExtendedChannelChatImpl
|
||||
|
||||
|
||||
/**
|
||||
@@ -76,9 +56,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: GroupChat
|
||||
) = getChat(chat.id) as ExtendedGroupChat
|
||||
): ExtendedGroupChat = getChat(chat.id) as ExtendedGroupChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||
@@ -87,9 +67,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: GroupChatImpl
|
||||
) = getChat(chat.id) as ExtendedGroupChatImpl
|
||||
): ExtendedGroupChatImpl = getChat(chat.id) as ExtendedGroupChatImpl
|
||||
|
||||
|
||||
/**
|
||||
@@ -99,9 +79,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: SupergroupChat
|
||||
) = getChat(chat.id) as ExtendedSupergroupChat
|
||||
): ExtendedSupergroupChat = getChat(chat.id) as ExtendedSupergroupChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||
@@ -110,9 +90,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: SupergroupChatImpl
|
||||
) = getChat(chat.id) as ExtendedSupergroupChatImpl
|
||||
): ExtendedSupergroupChatImpl = getChat(chat.id) as ExtendedSupergroupChatImpl
|
||||
|
||||
|
||||
/**
|
||||
@@ -122,9 +102,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: PrivateChat
|
||||
) = getChat(chat.id) as ExtendedPrivateChat
|
||||
): ExtendedPrivateChat = getChat(chat.id) as ExtendedPrivateChat
|
||||
|
||||
/**
|
||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||
@@ -133,9 +113,9 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: PrivateChatImpl
|
||||
) = getChat(chat.id) as ExtendedPrivateChatImpl
|
||||
): ExtendedPrivateChatImpl = getChat(chat.id) as ExtendedPrivateChatImpl
|
||||
|
||||
/**
|
||||
* Will cast incoming [dev.inmo.tgbotapi.types.chat.ExtendedChat] to a
|
||||
@@ -144,6 +124,6 @@ suspend fun TelegramBot.getChat(
|
||||
* @throws ClassCastException
|
||||
*/
|
||||
@PreviewFeature
|
||||
suspend fun TelegramBot.getChat(
|
||||
public suspend fun TelegramBot.getChat(
|
||||
chat: CommonUser
|
||||
) = getChat(chat.id) as ExtendedUser
|
||||
): ExtendedUser = getChat(chat.id) as ExtendedUser
|
||||
|
||||
@@ -4,11 +4,12 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.get.GetChatAdministrators
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
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
|
||||
) = execute(GetChatAdministrators(chatId))
|
||||
): List<AdministratorChatMember> = execute(GetChatAdministrators(chatId))
|
||||
|
||||
suspend fun TelegramBot.getChatAdministrators(
|
||||
public suspend fun TelegramBot.getChatAdministrators(
|
||||
chat: PublicChat
|
||||
) = getChatAdministrators(chat.id)
|
||||
): List<AdministratorChatMember> = getChatAdministrators(chat.id)
|
||||
|
||||
@@ -5,10 +5,10 @@ import dev.inmo.tgbotapi.requests.chat.get.GetChatMemberCount
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
|
||||
suspend fun TelegramBot.getChatMemberCount(
|
||||
public suspend fun TelegramBot.getChatMemberCount(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChatMemberCount(chatId))
|
||||
): Int = execute(GetChatMemberCount(chatId))
|
||||
|
||||
suspend fun TelegramBot.getChatMemberCount(
|
||||
public suspend fun TelegramBot.getChatMemberCount(
|
||||
chat: PublicChat
|
||||
) = getChatMemberCount(chat.id)
|
||||
): Int = getChatMemberCount(chat.id)
|
||||
|
||||
@@ -3,12 +3,13 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.get.GetChatMenuButton
|
||||
import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MenuButton
|
||||
import dev.inmo.tgbotapi.types.chat.PrivateChat
|
||||
|
||||
suspend fun TelegramBot.getChatMenuButton(
|
||||
public suspend fun TelegramBot.getChatMenuButton(
|
||||
chatId: IdChatIdentifier
|
||||
) = execute(GetChatMenuButton(chatId))
|
||||
): MenuButton = execute(GetChatMenuButton(chatId))
|
||||
|
||||
suspend fun TelegramBot.getChatMenuButton(
|
||||
public suspend fun TelegramBot.getChatMenuButton(
|
||||
chat: PrivateChat
|
||||
) = getChatMenuButton(chat.id)
|
||||
): MenuButton = getChatMenuButton(chat.id)
|
||||
|
||||
@@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
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)
|
||||
|
||||
@@ -2,5 +2,6 @@ package dev.inmo.tgbotapi.extensions.api.chat.get
|
||||
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
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)
|
||||
|
||||
@@ -9,34 +9,34 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||
|
||||
suspend fun TelegramBot.approveChatJoinRequest(
|
||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId
|
||||
) = execute(ApproveChatJoinRequest(chatId, userId))
|
||||
): Boolean = execute(ApproveChatJoinRequest(chatId, userId))
|
||||
|
||||
suspend fun TelegramBot.approveChatJoinRequest(
|
||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||
chat: PublicChat,
|
||||
userId: UserId
|
||||
) = approveChatJoinRequest(chat.id, userId)
|
||||
): Boolean = approveChatJoinRequest(chat.id, userId)
|
||||
|
||||
suspend fun TelegramBot.approveChatJoinRequest(
|
||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||
chatId: ChatIdentifier,
|
||||
user: User
|
||||
) = approveChatJoinRequest(chatId, user.id)
|
||||
): Boolean = approveChatJoinRequest(chatId, user.id)
|
||||
|
||||
suspend fun TelegramBot.approveChatJoinRequest(
|
||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||
chat: PublicChat,
|
||||
user: User
|
||||
) = approveChatJoinRequest(chat.id, user.id)
|
||||
): Boolean = approveChatJoinRequest(chat.id, user.id)
|
||||
|
||||
suspend fun TelegramBot.approveChatJoinRequest(
|
||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||
chatJoinRequest: ChatJoinRequest
|
||||
) = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||
): Boolean = approveChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||
|
||||
suspend fun TelegramBot.approve(
|
||||
public suspend fun TelegramBot.approve(
|
||||
chatJoinRequest: ChatJoinRequest
|
||||
) = approveChatJoinRequest(chatJoinRequest)
|
||||
): Boolean = approveChatJoinRequest(chatJoinRequest)
|
||||
|
||||
suspend fun TelegramBot.approveChatJoinRequest(
|
||||
public suspend fun TelegramBot.approveChatJoinRequest(
|
||||
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
||||
) = approveChatJoinRequest(chatJoinRequestUpdate.data)
|
||||
): Boolean = approveChatJoinRequest(chatJoinRequestUpdate.data)
|
||||
|
||||
@@ -1,86 +1,153 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import korlibs.time.DateTime
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.invite_links.CreateChatInviteLink
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.MembersLimit
|
||||
import dev.inmo.tgbotapi.types.TelegramDate
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
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,
|
||||
name: String? = 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,
|
||||
name: String? = 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,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
membersLimit: MembersLimit,
|
||||
name: String? = 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,
|
||||
membersLimit: MembersLimit,
|
||||
name: String? = 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,
|
||||
membersLimit: MembersLimit,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
membersLimit: MembersLimit,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
name: String? = 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,
|
||||
name: String? = 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,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
expiration: DateTime,
|
||||
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)
|
||||
|
||||
@@ -9,34 +9,34 @@ import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.update.ChatJoinRequestUpdate
|
||||
|
||||
suspend fun TelegramBot.declineChatJoinRequest(
|
||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId
|
||||
) = execute(DeclineChatJoinRequest(chatId, userId))
|
||||
): Boolean = execute(DeclineChatJoinRequest(chatId, userId))
|
||||
|
||||
suspend fun TelegramBot.declineChatJoinRequest(
|
||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||
chat: PublicChat,
|
||||
userId: UserId
|
||||
) = declineChatJoinRequest(chat.id, userId)
|
||||
): Boolean = declineChatJoinRequest(chat.id, userId)
|
||||
|
||||
suspend fun TelegramBot.declineChatJoinRequest(
|
||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||
chatId: ChatIdentifier,
|
||||
user: User
|
||||
) = declineChatJoinRequest(chatId, user.id)
|
||||
): Boolean = declineChatJoinRequest(chatId, user.id)
|
||||
|
||||
suspend fun TelegramBot.declineChatJoinRequest(
|
||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||
chat: PublicChat,
|
||||
user: User
|
||||
) = declineChatJoinRequest(chat.id, user.id)
|
||||
): Boolean = declineChatJoinRequest(chat.id, user.id)
|
||||
|
||||
suspend fun TelegramBot.declineChatJoinRequest(
|
||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||
chatJoinRequest: ChatJoinRequest
|
||||
) = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||
): Boolean = declineChatJoinRequest(chatJoinRequest.chat, chatJoinRequest.user)
|
||||
|
||||
suspend fun TelegramBot.decline(
|
||||
public suspend fun TelegramBot.decline(
|
||||
chatJoinRequest: ChatJoinRequest
|
||||
) = declineChatJoinRequest(chatJoinRequest)
|
||||
): Boolean = declineChatJoinRequest(chatJoinRequest)
|
||||
|
||||
suspend fun TelegramBot.declineChatJoinRequest(
|
||||
public suspend fun TelegramBot.declineChatJoinRequest(
|
||||
chatJoinRequestUpdate: ChatJoinRequestUpdate
|
||||
) = declineChatJoinRequest(chatJoinRequestUpdate.data)
|
||||
): Boolean = declineChatJoinRequest(chatJoinRequestUpdate.data)
|
||||
|
||||
@@ -1,187 +1,210 @@
|
||||
package dev.inmo.tgbotapi.extensions.api.chat.invite_links
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import korlibs.time.DateTime
|
||||
import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.invite_links.EditChatInviteLink
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ChatInviteLink
|
||||
import dev.inmo.tgbotapi.types.MembersLimit
|
||||
import dev.inmo.tgbotapi.types.TelegramDate
|
||||
import dev.inmo.tgbotapi.types.*
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.toTelegramDate
|
||||
|
||||
suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||
public suspend fun TelegramBot.editChatInviteLinkUnlimited(
|
||||
chatId: ChatIdentifier,
|
||||
previousLink: String,
|
||||
name: String? = 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,
|
||||
previousLink: String,
|
||||
name: String? = 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,
|
||||
previousLink: String,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: String,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: String,
|
||||
membersLimit: MembersLimit,
|
||||
name: String? = 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,
|
||||
previousLink: String,
|
||||
membersLimit: MembersLimit,
|
||||
name: String? = 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,
|
||||
previousLink: String,
|
||||
membersLimit: MembersLimit,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: String,
|
||||
membersLimit: MembersLimit,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: String,
|
||||
name: String? = 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,
|
||||
previousLink: String,
|
||||
name: String? = 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,
|
||||
previousLink: String,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: String,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: ChatInviteLink,
|
||||
name: String? = 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,
|
||||
previousLink: ChatInviteLink,
|
||||
name: String? = 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,
|
||||
previousLink: ChatInviteLink,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: ChatInviteLink,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: ChatInviteLink,
|
||||
membersLimit: MembersLimit,
|
||||
name: String? = 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,
|
||||
previousLink: ChatInviteLink,
|
||||
membersLimit: MembersLimit,
|
||||
name: String? = 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,
|
||||
previousLink: ChatInviteLink,
|
||||
membersLimit: MembersLimit,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: ChatInviteLink,
|
||||
membersLimit: MembersLimit,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: ChatInviteLink,
|
||||
name: String? = 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,
|
||||
previousLink: ChatInviteLink,
|
||||
name: String? = 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,
|
||||
previousLink: ChatInviteLink,
|
||||
expiration: DateTime,
|
||||
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,
|
||||
previousLink: ChatInviteLink,
|
||||
expiration: DateTime,
|
||||
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)
|
||||
|
||||
@@ -4,24 +4,25 @@ import dev.inmo.tgbotapi.bot.TelegramBot
|
||||
import dev.inmo.tgbotapi.requests.chat.invite_links.RevokeChatInviteLink
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ChatInviteLink
|
||||
import dev.inmo.tgbotapi.types.SecondaryChatInviteLink
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
|
||||
suspend fun TelegramBot.revokeChatInviteLink(
|
||||
public suspend fun TelegramBot.revokeChatInviteLink(
|
||||
chatId: ChatIdentifier,
|
||||
previousLink: String
|
||||
) = execute(RevokeChatInviteLink(chatId, previousLink))
|
||||
): SecondaryChatInviteLink = execute(RevokeChatInviteLink(chatId, previousLink))
|
||||
|
||||
suspend fun TelegramBot.revokeChatInviteLink(
|
||||
public suspend fun TelegramBot.revokeChatInviteLink(
|
||||
chat: PublicChat,
|
||||
previousLink: String
|
||||
) = revokeChatInviteLink(chat.id, previousLink)
|
||||
): SecondaryChatInviteLink = revokeChatInviteLink(chat.id, previousLink)
|
||||
|
||||
suspend fun TelegramBot.revokeChatInviteLink(
|
||||
public suspend fun TelegramBot.revokeChatInviteLink(
|
||||
chatId: ChatIdentifier,
|
||||
previousLink: ChatInviteLink
|
||||
) = revokeChatInviteLink(chatId, previousLink.inviteLink)
|
||||
): SecondaryChatInviteLink = revokeChatInviteLink(chatId, previousLink.inviteLink)
|
||||
|
||||
suspend fun TelegramBot.revokeChatInviteLink(
|
||||
public suspend fun TelegramBot.revokeChatInviteLink(
|
||||
chat: PublicChat,
|
||||
previousLink: ChatInviteLink
|
||||
) = revokeChatInviteLink(chat, previousLink.inviteLink)
|
||||
): SecondaryChatInviteLink = revokeChatInviteLink(chat, previousLink.inviteLink)
|
||||
|
||||
@@ -9,30 +9,30 @@ import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
|
||||
suspend fun TelegramBot.banChatMember(
|
||||
public suspend fun TelegramBot.banChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = 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,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = 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,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = 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,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
revokeMessages: Boolean? = null
|
||||
) = banChatMember(chat.id, user.id, untilDate, revokeMessages)
|
||||
): Boolean = banChatMember(chat.id, user.id, untilDate, revokeMessages)
|
||||
|
||||
@@ -6,22 +6,22 @@ import dev.inmo.tgbotapi.types.IdChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
|
||||
suspend fun TelegramBot.banChatSenderChat(
|
||||
public suspend fun TelegramBot.banChatSenderChat(
|
||||
chatId: ChatIdentifier,
|
||||
senderChatId: IdChatIdentifier
|
||||
) = execute(BanChatSenderChat(chatId, senderChatId))
|
||||
): Boolean = execute(BanChatSenderChat(chatId, senderChatId))
|
||||
|
||||
suspend fun TelegramBot.banChatSenderChat(
|
||||
public suspend fun TelegramBot.banChatSenderChat(
|
||||
chat: PublicChat,
|
||||
senderChatId: IdChatIdentifier
|
||||
) = banChatSenderChat(chat.id, senderChatId)
|
||||
): Boolean = banChatSenderChat(chat.id, senderChatId)
|
||||
|
||||
suspend fun TelegramBot.banChatSenderChat(
|
||||
public suspend fun TelegramBot.banChatSenderChat(
|
||||
chatId: IdChatIdentifier,
|
||||
senderChat: PublicChat
|
||||
) = banChatSenderChat(chatId, senderChat.id)
|
||||
): Boolean = banChatSenderChat(chatId, senderChat.id)
|
||||
|
||||
suspend fun TelegramBot.banChatSenderChat(
|
||||
public suspend fun TelegramBot.banChatSenderChat(
|
||||
chat: PublicChat,
|
||||
senderChat: PublicChat,
|
||||
) = banChatSenderChat(chat.id, senderChat)
|
||||
): Boolean = banChatSenderChat(chat.id, senderChat)
|
||||
|
||||
@@ -7,23 +7,24 @@ import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.chat.PublicChat
|
||||
import dev.inmo.tgbotapi.types.chat.User
|
||||
import dev.inmo.tgbotapi.types.chat.member.ChatMember
|
||||
|
||||
suspend fun TelegramBot.getChatMember(
|
||||
public suspend fun TelegramBot.getChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId
|
||||
) = execute(GetChatMember(chatId, userId))
|
||||
): ChatMember = execute(GetChatMember(chatId, userId))
|
||||
|
||||
suspend fun TelegramBot.getChatMember(
|
||||
public suspend fun TelegramBot.getChatMember(
|
||||
chat: PublicChat,
|
||||
userId: UserId
|
||||
) = getChatMember(chat.id, userId)
|
||||
): ChatMember = getChatMember(chat.id, userId)
|
||||
|
||||
suspend fun TelegramBot.getChatMember(
|
||||
public suspend fun TelegramBot.getChatMember(
|
||||
chatId: IdChatIdentifier,
|
||||
user: User
|
||||
) = getChatMember(chatId, user.id)
|
||||
): ChatMember = getChatMember(chatId, user.id)
|
||||
|
||||
suspend fun TelegramBot.getChatMember(
|
||||
public suspend fun TelegramBot.getChatMember(
|
||||
chat: PublicChat,
|
||||
user: User
|
||||
) = getChatMember(chat.id, user.id)
|
||||
): ChatMember = getChatMember(chat.id, user.id)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user