mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 20:10:18 +00:00
Compare commits
1341 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| efd1c8f83a | |||
| 7e57a0e4e0 | |||
| 6b977e67d0 | |||
| ab5937449c | |||
| 61d3131bf2 | |||
| 048f244449 | |||
| 6ebf4ff652 | |||
| b4c41d7dd8 | |||
| 930507ab80 | |||
| 56d3628dd3 | |||
| 56d7853f68 | |||
| 0a27d9bf28 | |||
| c74df3960c | |||
| f4b080cb45 | |||
| 350b77f6ff | |||
| 955e14f67c | |||
| ae88b7d94d | |||
| 88c62bd51c | |||
| 705bcbe352 | |||
| ffcc149c40 | |||
| 402d91f9f2 | |||
| c19bccc7d1 | |||
| 2c71377058 | |||
| 12d2c05110 | |||
| ddf46c1afd | |||
| dd0a8b99c7 | |||
| 75fb72936f | |||
| 1a6a010446 | |||
| 4c7bfe99c0 | |||
|
|
1e4b8d405e | ||
| 007112e67a | |||
| a87c21273d | |||
| ff2d1615da | |||
| 08ef146daa | |||
| a404a6c59c | |||
| 1089c716f3 | |||
| 81ad55b19f | |||
| 863c872f35 | |||
| ece6a917ed | |||
| 12248aa702 | |||
| 83ea4f6435 | |||
| 52204d8df1 | |||
| 81b9ccdf6a | |||
| fa74f12505 | |||
| be284c4d96 | |||
| 1769fcacfd | |||
| 4207d89c92 | |||
| 87ee2f280b | |||
| 3d458b2dc6 | |||
| ee1c7c6533 | |||
| 97d122c770 | |||
| 49da0faf45 | |||
| d426cb1210 | |||
| af83ac79e7 | |||
| 602f15c206 | |||
| c2f40534e6 | |||
| 5693d4d808 | |||
| 9fe55aa6ef | |||
| 8f817f1492 | |||
| 0fd146655d | |||
| 94e5f74a90 | |||
| b9bffbb71b | |||
| 5ec5c3bdfd | |||
| a5ed2a82bb | |||
| 1b7dd11e75 | |||
| 8d0307fb7f | |||
| c500f0a281 | |||
| b3abeaa5ae | |||
| 8930a66134 | |||
| 76a2a2ca74 | |||
| 7dff8af460 | |||
| 5261ab1cf0 | |||
| f45c653fca | |||
| 5e03098ca8 | |||
| 2a3d8e6e73 | |||
| 8c3dac7932 | |||
| 83fb7f7bcb | |||
| 459414e7dd | |||
| 508d51f5a9 | |||
| 36f22579b2 | |||
| d3d5f7f2e6 | |||
| 1369680419 | |||
| f6e819be62 | |||
| 553da0a3ee | |||
| bace2724da | |||
| be710612b5 | |||
| ea19c10f41 | |||
| 1b88881c62 | |||
| be62c4fe37 | |||
| d3499cdde1 | |||
| 01d04f9d2b | |||
| d290992e40 | |||
| 867bdb8bd7 | |||
| 5f0a67187f | |||
| d9638849e2 | |||
| 5568720b5b | |||
| c0c591fe08 | |||
| 3c1f8421c9 | |||
| 35b20d102c | |||
| 70e6dc8fc9 | |||
| 4f0de376ab | |||
| 10c52c695c | |||
| 2d2c745527 | |||
| 1238843bde | |||
| 1ebaa1c387 | |||
| b2bc47ec04 | |||
| 514620b2bd | |||
| 054f06e18b | |||
| 00d467d091 | |||
| 6426ed6571 | |||
| fba6707f44 | |||
| 0c2fe6bce7 | |||
| eee9fe439f | |||
| 3547c09383 | |||
| 956f02d26d | |||
| 468fc0a49b | |||
| 441f3cee3d | |||
| 1ea79b9f7f | |||
| 094f88867d | |||
| 85a8a8eedc | |||
| 28fce0b4c1 | |||
| 2f5fdcdca0 | |||
| 21799d7e4a | |||
| ca409db0ee | |||
| 33c8ee0803 | |||
| 0c0ec22348 | |||
| 24bffbbd97 | |||
| a615d1c4fd | |||
| a76b7977b3 | |||
| 6004879aef | |||
| 98ff2558e9 | |||
| 61c00b38b1 | |||
| 2096671147 | |||
| 094d58f59f | |||
| 578a66b758 | |||
| b5bb40576b | |||
| 953638ddf5 | |||
| 1c9ca7a493 | |||
| c220412b02 | |||
| 41852dde7c | |||
| 3150cd6a37 | |||
| 07de18efd8 | |||
| 9552550198 | |||
| e1c94f772d | |||
| fbed81a1b3 | |||
| b61912d99a | |||
| 5efe74171d | |||
| 393981560c | |||
| 73b355df55 | |||
| 86885e7698 | |||
| 4d9be1a995 | |||
| 596176ee93 | |||
| 2348434048 | |||
| 5c6a430f38 | |||
| 148791ad68 | |||
| 5c5a19c91a | |||
| bd60c4f411 | |||
| e5a36225f8 | |||
| bd2c13c178 | |||
| 6f1f94299b | |||
| 72b8231eab | |||
| 323e5fb391 | |||
| dca5bb40e3 | |||
| c21975a150 | |||
| 8675833b99 | |||
| faf669c035 | |||
| 2f3a683fa0 | |||
| 2a617b5c4d | |||
|
|
aa1e7eea1d | ||
| 22eac5414c | |||
| 8206aefbb6 | |||
| fb8cfed382 | |||
| 2de22a08a3 | |||
| e8022a2ded | |||
| d6cef5984b | |||
| 49bea1bcef | |||
| 85a4459072 | |||
| ce74631580 | |||
| 1e5ce6bb5c | |||
| dc89e914a1 | |||
| ee815c7335 | |||
| 69f4033807 | |||
| 0581587adf | |||
| 23f93075a4 | |||
| 6c3425d5f9 | |||
| d285590348 | |||
| 2e0ad6dd3c | |||
| 96a5e55894 | |||
| 4e3b085cdb | |||
| 8baa601af7 | |||
|
|
facd732fa8 | ||
| e19561367e | |||
| 249efeee7e | |||
| b8cc2421b6 | |||
| 2fa1a064ec | |||
| 63e864741e | |||
| e4f35c0eba | |||
| 944fe6d820 | |||
| 8ea50f36aa | |||
| 17308a6d99 | |||
| 6eabea2529 | |||
| ffe9166fee | |||
| f1be3e2819 | |||
| c4c016c438 | |||
| a85e7d7387 | |||
| fc59ab0cdd | |||
| 9ed7ded967 | |||
| a76a7ae630 | |||
| 4715eb424f | |||
| c24d536d4c | |||
| c969d88bf0 | |||
| 44e9dc9253 | |||
| 10c62bf2c7 | |||
| 20b1645935 | |||
| c5bf9ab1a2 | |||
| cd6d108a9a | |||
| 5369a85faa | |||
| 45a895f32f | |||
| 8c1d7203d2 | |||
| 7394a6e94b | |||
| a962838012 | |||
|
|
a5cc80a1eb | ||
| 064b6222e6 | |||
|
|
8d97057d2c | ||
|
|
78f006e280 | ||
| db956a803c | |||
| aeb131b2f4 | |||
| 6d80c2bddc | |||
| 6e32d4e863 | |||
| 6b62070447 | |||
| ad8710db92 | |||
| f385101e22 | |||
| 15386a63f9 | |||
| 576b25190a | |||
| dd979d8626 | |||
| e60eb68b67 | |||
| 91212eaa3a | |||
| 65c1f018ac | |||
| 5b13d3dded | |||
|
|
2447d3e51f | ||
|
|
4203a0fdfe | ||
| ddd32a81c0 | |||
| db7a42fa9b | |||
| 5e2df1cb4a | |||
| 21c0e375f5 | |||
| 4ac01d0104 | |||
| 9c15410c4e | |||
| c5ff0dbc54 | |||
| 19d221fc29 | |||
| 179a724d20 | |||
| ad9bc36f8c | |||
| 5a192b00d4 | |||
| 2a33b22afb | |||
| db1e01688d | |||
| 22e71354dd | |||
| 2e560db865 | |||
| 016fc81b71 | |||
| b6e72c2399 | |||
| e1e2b93269 | |||
| 834e31906a | |||
| 5831cc6d37 | |||
| 0cce72de8d | |||
| 3919359f79 | |||
| e51a4b7702 | |||
| 702c1bc1ff | |||
| 6557e8af10 | |||
| edcebb03c0 | |||
| 9a3fc19992 | |||
| 7f9faa69c8 | |||
| 5b98c5f821 | |||
| 40bd8d0987 | |||
| 2aa6497374 | |||
| b9cb7b62fa | |||
| 04679beb52 | |||
| 64e9289afb | |||
| d4f24ee0cd | |||
| 3e5d939ea5 | |||
| 24f91e4aee | |||
| fe169fafaf | |||
| aeb6fad409 | |||
| 94ad758814 | |||
| 5f01e26377 | |||
| f82ac0ce9d | |||
| c8491765e9 | |||
| 53a3e11836 | |||
| fcccbe3252 | |||
| 584bf06109 | |||
| ef0083079e | |||
| 0d01e9bc78 | |||
| 89aef3d77b | |||
| 24c47b00d4 | |||
| a046a72392 | |||
| a5a530c9bd | |||
| 9cf82a3564 | |||
| 46cc37be62 | |||
| 1fbaf396aa | |||
| 76985501f5 | |||
| 8d8bcfba01 | |||
| e0f3957249 | |||
| 3f1b018808 | |||
| 7af5ab17b7 | |||
| 0fec35f0dc | |||
| ee81f49a75 | |||
| 807952201b | |||
| 5d6ba0f59e | |||
| 3a61b522ab | |||
| 83304023a6 | |||
| f62e13aaca | |||
| ae1fb25336 | |||
| 4e3ea6cd80 | |||
| 148203eabf | |||
| 4465b573ca | |||
| f0dda60630 | |||
| 47135a1b65 | |||
| d8f830c60f | |||
| 226b8dee21 | |||
| a109771d20 | |||
| c028434f30 | |||
| d5c6ce32bb | |||
| d92cac5e07 | |||
| 9b21b5290c | |||
| 13ca63d27d | |||
| ad917dda1b | |||
| 7b1344e9c8 | |||
| c4fbd2f1c6 | |||
| c90bcea42c | |||
| e75c93d626 | |||
| 58dcbe8751 | |||
| 17806cde25 | |||
| f147a3d620 | |||
| 9eb6008a73 | |||
| f7d2c8bbd2 | |||
| f42cf78969 | |||
| 9a14932511 | |||
| 149ecf175b | |||
| 2049fea82a | |||
| 40d94cca70 | |||
| c8ad68ea69 | |||
| c66d64adbc | |||
| b475976ff1 | |||
| ea8db5b851 | |||
| af2fabf1ca | |||
| abc0457a36 | |||
| 8dbdbdee13 | |||
| 0c31379ff5 | |||
| 3b3cf81aaa | |||
| 1642075a75 | |||
| 760c9f2916 | |||
| 219238cf19 | |||
| 762087fc09 | |||
| 142fae1ede | |||
| 95abc72bf3 | |||
| 1d37a7446c | |||
| 7d35114b5d | |||
| 75f4226772 | |||
| 96d980cb8a | |||
| ed077ae1bc | |||
| 9540797ffc | |||
| 217b01994e | |||
| 6b89c94ef1 | |||
| e25ce57f6a | |||
| 530394fd15 | |||
| 3e891d50fd | |||
| adf5fd6288 | |||
| e7a2dc51aa | |||
| 399793243b | |||
| 3801025ff1 | |||
| 0ad2d9afc4 | |||
| a303700b56 | |||
| 42bf896f7a | |||
| 0bce522101 | |||
| 3c75d6a2c7 | |||
| 93eebe37ce | |||
| f893803939 | |||
| 0b92edc05e | |||
| 190d83b22b | |||
| 7ec4fc460a | |||
| 75cebf5aa3 | |||
| a241c91adf | |||
| 4f920abb61 | |||
| 6ba9a31fb9 | |||
| 65801f5104 | |||
| 9e82211473 | |||
|
|
560179a574 | ||
|
|
cffcf2277e | ||
|
|
cb9a20a9d1 | ||
|
|
45ea103c9a | ||
|
|
c00adb0784 | ||
|
|
38826a5e7e | ||
| b2915857d7 | |||
| 067e36adc6 | |||
|
|
12a35da4b6 | ||
|
|
022e6f623a | ||
|
|
30c138029e | ||
| 732e2a3906 | |||
| c5e089a45d | |||
|
|
919b1590e3 | ||
| 0c1017901f | |||
| fd6e4b0522 | |||
| 21c5d42dc2 | |||
| 77dff639f0 | |||
| 47fe048b10 | |||
| ee8cc2aa46 | |||
| b9de002517 | |||
| 449f2727c4 | |||
| 8712914126 | |||
| 69b64e9908 | |||
| 656bb68739 | |||
| 7f69052dea | |||
| b60fab4871 | |||
| bf28a8b0a6 | |||
| 85270dd12d | |||
| e39dd2d086 | |||
| e10d47b7e4 | |||
| 1e181bc042 | |||
| 61cf9936fb | |||
| 65fd3ced36 | |||
| 66d37b72eb | |||
| 55b1d3734d | |||
| 45b32fd6f7 | |||
| fcd8f20a90 | |||
| 18e6b9e471 | |||
| f5b248f534 | |||
| 3ebcbe2860 | |||
| 3829e04b0c | |||
| 39fa36426f | |||
| a265e5ecbf | |||
| 86e78c4ba0 | |||
| a6451ca394 | |||
| 521a3a8c35 | |||
| 173839c677 | |||
| bb7d47a33b | |||
| 5c0e58caec | |||
| 72c3623d30 | |||
| fe1831fc19 | |||
| 7825ec3010 | |||
| 12184cd2be | |||
| e90e25ab01 | |||
| 004ff0b490 | |||
| 07faba7d38 | |||
| e5584cd8b4 | |||
| 6acc9ef2b0 | |||
| 169fc0401a | |||
| dcfcea65cb | |||
| eedb36ede7 | |||
| eaee334ff6 | |||
| 5c694e8625 | |||
| 0306c40fb2 | |||
| fd915553e3 | |||
| ec1c0ba8bb | |||
| 12a64ec1d1 | |||
| 59d7a7c781 | |||
| cabfd7c76b | |||
| f12f52899c | |||
|
|
ed067db20f | ||
| b055268979 | |||
| 2584839d66 | |||
| 63946e860d | |||
| 90df436c63 | |||
| d3c8b49b10 | |||
| c1372b55bc | |||
| b6c7ece995 | |||
| 44e7c80f43 | |||
| 1e41e95333 | |||
| 03d4d715c0 | |||
| ab060d02ea | |||
| f447be02dc | |||
| eb923a6338 | |||
| 0914710cc7 | |||
| 1f7450844f | |||
| 167c214e35 | |||
| 42a8d649cd | |||
| eb3f180cc6 | |||
| 70f96ac8fa | |||
| d69b2e09d5 | |||
| 946b0222df | |||
| 7da315dbaf | |||
| 87071ca52c | |||
| b2770e3ecc | |||
| df63ccfe07 | |||
| 694bec22a2 | |||
| 6a3588bb8d | |||
| a26568aa29 | |||
| cd30660256 | |||
| 1846d20b0d | |||
| f13207064e | |||
| 61be689aca | |||
| 03f8d65bb6 | |||
| 2dc8beba8a | |||
| 5451adf4ac | |||
| 9982534001 | |||
| c0451d4c8f | |||
| a9d65944e6 | |||
| 39598dcb69 | |||
| 3069a6084c | |||
| e7bbce3fa7 | |||
| 0b361163f2 | |||
| 6aba2ff641 | |||
| 6b761ab37d | |||
| b9c8a89af9 | |||
| a42c5c63c4 | |||
| fc1a029acb | |||
| f90ae2f918 | |||
| 019b260888 | |||
| 0831f2fa75 | |||
| 32ae9d2b16 | |||
| b975a1b036 | |||
| f4b1e4a150 | |||
| 97031512d4 | |||
| 353df43109 | |||
| 4e55460834 | |||
| e2e235bd6c | |||
| 8ced95bc2f | |||
| 685e4af8f5 | |||
| 0b2f7a3899 | |||
| 112c86c9da | |||
| 1ddd138ff7 | |||
| 1a5d1cde78 | |||
| 5b620014cb | |||
| 80093cb5a9 | |||
| 9f8e8ee21b | |||
| 3de3bb6133 | |||
| 308fb9274b | |||
| d14ca7bbdc | |||
| dbdd9b5ad2 | |||
| 6dd27cb0bf | |||
| 210a52485b | |||
| 5c11b60ea6 | |||
| 60c3a0d7af | |||
| 8d777e1c0e | |||
| 4e019eb8bb | |||
| bd80562c2a | |||
| 9fc07f2ff3 | |||
| a4bae5133a | |||
| 7bb272f2fa | |||
| 72cf38d3bb | |||
| 0adee13cba | |||
| f9e3e57f24 | |||
| d7d4adc8e4 | |||
| e9b074a36c | |||
| 65cba0f014 | |||
| 36202133a1 | |||
| 66f7801b32 | |||
| e7265829d1 | |||
| 9ad5bfbc57 | |||
| aba62ba930 | |||
| 40d702a311 | |||
| 233d893b5a | |||
| 0faca5838c | |||
| 838f62aa84 | |||
| bc21a680bc | |||
| 8bb60bea34 | |||
| 8daadcff95 | |||
| 2a1e624641 | |||
| 696822db02 | |||
| ded501d963 | |||
| 86e506c33d | |||
| 9902b00e85 | |||
| 53524abcbb | |||
| 7639b15dc6 | |||
| 61b720c61f | |||
| baf4c74b69 | |||
| 367cfff2cb | |||
| 75e8d0f62d | |||
| c521a5f9a4 | |||
| c5513365c2 | |||
| d184ce7a0f | |||
| a3bff3f24d | |||
| a835b1dcbb | |||
| ffed2b80a5 | |||
| ff24b9f35b | |||
| 1287852334 | |||
| fc2f177e38 | |||
| 1efd4dce6e | |||
| 69b5a16b17 | |||
| 77b531ad06 | |||
| a98d5d9abd | |||
| 104653ac41 | |||
| 63337b8285 | |||
| 5cc0bbb31b | |||
| 563d784603 | |||
| 0d9f18f346 | |||
| 23ceaf8e97 | |||
| fe2dffd8b5 | |||
| eeb46817c3 | |||
| 5ab00da31d | |||
| 841ae73f7c | |||
| 41b4d29917 | |||
| f8b3c44146 | |||
| f0eb670c3f | |||
| fe5d94f31e | |||
| 7901d0a223 | |||
| 799f9123ba | |||
| f77f010e66 | |||
| 67ddf8d809 | |||
| 81afa46253 | |||
| a5bba76f07 | |||
| d882cf9c97 | |||
| 2e27b8b64d | |||
| 4df800eaa9 | |||
| 8d27349868 | |||
| 2a89c41a58 | |||
| 098b5cc393 | |||
| 10f4817283 | |||
| 4449893608 | |||
| 3a53f41f66 | |||
| 7cd366d893 | |||
| 1309a4111c | |||
| 0ca815760b | |||
| eca0680f2f | |||
| d472d371ed | |||
| 4748b6813a | |||
| a2ea15d4b0 | |||
| 27dc302f5d | |||
| baf8ed3a77 | |||
| 18913af3c3 | |||
| 51871ea94c | |||
| 6a625d7b9f | |||
| 0b93b472a3 | |||
| ff16f9a315 | |||
| 86bfe043a5 | |||
| fa18e7299d | |||
| c986025075 | |||
| e8a7ea9ce4 | |||
| 30f35e5488 | |||
| b626974ea7 | |||
| 128b782a27 | |||
| dc83b8d77a | |||
| 2aac6c0bde | |||
| b637d0d2a6 | |||
| d12cba2343 | |||
| 450c7e6474 | |||
| a35fb40a66 | |||
| 8731aa2c26 | |||
| 32e305537d | |||
| ec0a10e36e | |||
| 131ec4d6d5 | |||
| ecc608f51a | |||
| 040654f131 | |||
| 9e73d0c461 | |||
| d67c80bc99 | |||
| b0eef4f82d | |||
| fbe91a6321 | |||
| 15066c9d63 | |||
| e0bf67d8f9 | |||
| 1dc3ce2fb5 | |||
| 0c71133969 | |||
| 1359dd549f | |||
| c425e2ecc3 | |||
| 4d63e3a17d | |||
| d34deade0d | |||
| 2f52ad45a4 | |||
| 1d99e632a4 | |||
| cdcfaf5a29 | |||
| f3590762f3 | |||
| e0ff14b7fe | |||
| 9983e111ec | |||
| 08b8710772 | |||
| fc71e028c4 | |||
| 30a4a7bd8b | |||
| b973278b0a | |||
| ae2f4579e2 | |||
| a4bf6911c7 | |||
| 73b3daa68b | |||
| 09748615ae | |||
| 2dc8521aed | |||
| 81de59f37c | |||
| fb61a94c5e | |||
| 26fd5e51bf | |||
| c1ab9da4c4 | |||
| 6b414d64b0 | |||
| 5a3edc2b44 | |||
| 6dcdc2ab7f | |||
| a2ae4f71de | |||
| 5d87b86afe | |||
| ef22735894 | |||
| c0ea479fe3 | |||
| 0846e816e9 | |||
| d837c9d605 | |||
| d1993842c3 | |||
| 4e8a9dcff0 | |||
| 10eb15e172 | |||
| 0320da7614 | |||
| 7aa3ff180e | |||
| a882a212c2 | |||
| 1b15748f65 | |||
| 044fe5eadf | |||
| 9453ec37e7 | |||
| 3d0cbc2d2b | |||
| 198b551ebf | |||
| 1452e32293 | |||
| 946b7abcae | |||
| 879943622a | |||
| c0b4b523cf | |||
| 49e6e9cfe3 | |||
| ffadb6355b | |||
| 9cc402b42d | |||
| b9341f89ac | |||
| ac07f44c81 | |||
| 2e53247726 | |||
| e2dddf96a1 | |||
| ce0fceb240 | |||
| 633239961a | |||
| 8b79b15777 | |||
| a28cf5ddff | |||
| 8c2cffc8e3 | |||
| b933361258 | |||
| 383e722d07 | |||
| 3125c2fc1b | |||
| 965b8c3c50 | |||
| 94745ef373 | |||
| aee5ab564b | |||
| c70f0b65dd | |||
| 30e6f68228 | |||
| 00873a255c | |||
| 6bd423dc11 | |||
| c5ada8cea0 | |||
| 0cb3df4d1a | |||
| b22118b400 | |||
| 2006e45b57 | |||
| c091098feb | |||
| 6cf8d47cbf | |||
| 3dc4e9dda4 | |||
| 6407ad1a93 | |||
| f974e5787f | |||
| 28a9bbd310 | |||
| 599d5a51e3 | |||
| 25f8d15a4b | |||
| 66c2cb2d30 | |||
| 74fb448378 | |||
| 3417ec060f | |||
| 4f54a00003 | |||
| 4fb187da30 | |||
| 7637b6f69a | |||
| 9df9af193c | |||
| ba4b4c4b64 | |||
| fa0861b8bc | |||
| 20494e1d4a | |||
| a404008dee | |||
| 881205dd80 | |||
| 2096c44811 | |||
| 1a3da33589 | |||
| be28c9bd5d | |||
| a193ef5fd5 | |||
| 7c43d3aaa5 | |||
| e034afc75c | |||
| 08e3326d1a | |||
| 6dd1825b98 | |||
| bd4eb29fc1 | |||
| 2cc66ef13c | |||
| 9a8175d1c8 | |||
| 25285b2e8a | |||
| bb09f05d7b | |||
| da5e46e59f | |||
| a3f315a73a | |||
| 43583a885a | |||
| ec02257ecd | |||
| 29ee4a9396 | |||
| 2717cb4fc6 | |||
| 1ce2526401 | |||
| 74c480b07e | |||
| 657e9aa770 | |||
| 0d19952ba7 | |||
| f8cccc3e17 | |||
| bc1b7c3f25 | |||
| ec74111a9d | |||
| 2dadeb7eb7 | |||
| 24bd65501b | |||
| 574ca803fa | |||
| 947e3bf34e | |||
| 488158d8fb | |||
| 41bf3c7f0b | |||
| c2032d21cd | |||
| 6650dd9cfe | |||
| af1d6d6f1a | |||
| a5861d659d | |||
| b36f80a6d3 | |||
| 7c4f034a6c | |||
| 3b08bc6dd2 | |||
| ed87c0ad95 | |||
| c8c0fc2ce8 | |||
| 1f40ce1a81 | |||
| b0219389fc | |||
| f6ec82b449 | |||
| 71dac70635 | |||
| 98f68a9e1e | |||
| e7199e7451 | |||
| 33b50c6c68 | |||
| e4ce6f8fc7 | |||
| 8764f18ca8 | |||
| b2fa7fee9d | |||
| 0121e3a104 | |||
| f6e5664632 | |||
| c5b7c4e1f5 | |||
| 53800d49bf | |||
| d83e3eb10a | |||
| 66b4d06064 | |||
| 4fab01b2a2 | |||
| b81086c4bb | |||
| d776071cac | |||
| 5f33d05deb | |||
| 912cc7217c | |||
| 96e00f6e31 | |||
| f8ea5f9515 | |||
| 9f11c4f1c4 | |||
| 9c91980d5d | |||
| 7376eb5b10 | |||
| 6654f27f9d | |||
| d29acce417 | |||
| f0f18209f3 | |||
| 324018a0f6 | |||
| b621325e92 | |||
| 43e92555c2 | |||
|
|
5f1ca51e60 | ||
| 83edda2dfe | |||
| 1974c20229 | |||
| 499d9b1791 | |||
| 6caa7dd428 | |||
| e8ded44562 | |||
| 1e6b0381ee | |||
| 1cf7ae7438 | |||
| 311512b5db | |||
| d73fa4076f | |||
| 3620350cc0 | |||
| 54cfea9adf | |||
| 6665b6ef03 | |||
| ee6f0f3d5d | |||
| 6ec0fcadd2 | |||
| c89aa7b9ba | |||
| cf47cee36a | |||
|
|
824fa9ba09 | ||
| 654d84b1b4 | |||
|
|
c7259e7699 | ||
| 00a75801a8 | |||
| e45f9cf46a | |||
| 3b1803e851 | |||
| bf1e353615 | |||
| 99bb8d6e0d | |||
| 98d7b9c651 | |||
| 765caefc32 | |||
| 6bdefb6f8f | |||
| d5e283e7ba | |||
| a5982ac881 | |||
| c0e81b1d6d | |||
| eb879963f8 | |||
| f835167f66 | |||
| ff34b23777 | |||
| ec806dfd83 | |||
|
|
0a73dfb799 | ||
| 53b8cc4625 | |||
| 201def826e | |||
| 609a959b99 | |||
| 6a05a7ecab | |||
| 159ea6f1cc | |||
| 0886781d61 | |||
| 60d5581ec6 | |||
| 2a33216006 | |||
| 179bb66183 | |||
| 7a2ecd2dbf | |||
| fd1a15cb5d | |||
| 86a472e814 | |||
| 6d6c544aaf | |||
| dd4d5cd15d | |||
| 23dfa4f69d | |||
| a10d766295 | |||
| ea6ab8f024 | |||
| f377d61bf0 | |||
| 18c9d4e468 | |||
| 20b931138c | |||
| d7bca15693 | |||
| 957649603b | |||
| bbc56fe94c | |||
| d048958423 | |||
| f0e9267664 | |||
| 5dd7207e09 | |||
| d96d47e32c | |||
| 1ee73dd406 | |||
| e9a05c4930 | |||
| 9e771fa04a | |||
| 06ba21fc1f | |||
| 7d72d72f2c | |||
| 80d4bdfe17 | |||
| b457d11067 | |||
| 46fe16fd73 | |||
| 8e1cafb1b6 | |||
| 68d971f874 | |||
| 37a23c7e79 | |||
| b053c29ea3 | |||
| 23a1fed7dd | |||
| 87d2537bda | |||
| 6d782f28c3 | |||
| d8dbbdf549 | |||
| f317e144e6 | |||
| 05c27804ce | |||
| eb97a8e151 | |||
|
|
06639e5f3c | ||
| 82b7bf676f | |||
| 4f9cb531c0 | |||
| 09bbb1945c | |||
| 7bedc4caf0 | |||
| 6a73aa1525 | |||
| e1ee541005 | |||
|
|
2d2fe01227 | ||
|
|
af53682b1f | ||
|
|
c8a5552c9e | ||
|
|
ffa78ebfe1 | ||
| e85e7d02f7 | |||
| 37ad279ab4 | |||
| 3b41dc1fbf | |||
| 5747383ed1 | |||
| 18a6efabb8 | |||
| dcb837b155 | |||
| 03755e9eef | |||
|
|
b9db2d544d | ||
| 800d14561e | |||
| 2378237fc5 | |||
| 35e28c00cb | |||
| 1913f1a900 | |||
| cbfd34098d | |||
| e5618f4705 | |||
| c9f2166e7d | |||
| eb960290c6 | |||
| 100f8b564a | |||
| 8e1ad9ffbc | |||
| 8875e2a986 | |||
| 7478b151eb | |||
| 959136479e | |||
| a52a62837e | |||
| 17dd694044 | |||
| 34fcfe2e20 | |||
| 64862ecd2d | |||
| c9edbbf7af | |||
| a2f9a5a432 | |||
| 8337da34ca | |||
| f45956b554 | |||
| bec1255d67 | |||
| 39ca29279f | |||
| 70b592baad | |||
| 403aa684a8 | |||
| 48c6f103b5 | |||
| e326d289cb | |||
| 7fd9c4c897 | |||
| 347a6212d4 | |||
| e10e257c80 | |||
| 5e7bc96b44 | |||
| 79d0eda61d | |||
| 9916b3f469 | |||
| 2bac5f0eed | |||
|
|
01eb072caa | ||
| 496af479b0 | |||
| 386e91e28b | |||
| 91dbcecefc | |||
| 2d743e4c19 | |||
| 8804a24013 | |||
| 8b5244d8df | |||
| 034901a479 | |||
| 7043647584 | |||
| acd9505a5d | |||
| 46c33d5ec4 | |||
| 89dc7a4b2a | |||
| e4f305b3ec | |||
| d56c132201 | |||
| d336e177dd | |||
| 15e29286fb | |||
| 314ceed78e | |||
| 3fa3aa50d9 | |||
| 571296b9a0 | |||
| 3f13e5d062 | |||
| 1874023c05 | |||
| dc0fda2066 | |||
| c0d4a4f01b | |||
| 603762bc22 | |||
| 4db82d6ce2 | |||
| 9bf8f56254 | |||
| 9c926a2265 | |||
| 747854f4f4 | |||
| dcfb14553d | |||
| 6eaa9d699b | |||
| 6788c4d1dd | |||
| 6420737a82 | |||
| 4c36750431 | |||
| fd022742aa | |||
| 0472e35752 | |||
| 768d00eedd | |||
| e9347075ed | |||
|
|
3da74b0c66 | ||
|
|
8b79c5c76b | ||
|
|
a1b471d2ca | ||
|
|
e2c7125f6c | ||
| ec8df3c31c | |||
| 94a35349aa | |||
| 046402454f | |||
| c3978f2dab | |||
| 1019fd4d19 | |||
| 76a9fd1a55 | |||
| aec4c7323a | |||
| 7bdfd5cf69 | |||
| ce95a60fbc | |||
| 3c17a67b01 | |||
| 35bf5b9e9d | |||
| 0087d02b5f | |||
| 212d8946c8 | |||
| 319e43901a | |||
| da01955507 | |||
| 095382040c | |||
| 5545708d38 | |||
| 5d06d86549 | |||
| c081e5c457 | |||
| 555c2ffa04 | |||
| bcee64c103 | |||
| 44a35bd26e | |||
| 1f5c719294 | |||
| 6013c3ba86 | |||
| d4551490f7 | |||
| cc0498a89a | |||
| 0b78c0382f | |||
| c91426a910 | |||
| 5d1c59ff75 | |||
| d2228e274c | |||
| 790959ea49 | |||
| ce9f7f35dc | |||
| 4f984d1dbc | |||
| c83da6be70 | |||
|
|
710438489c | ||
| 6f650f6d6c | |||
| 2d15e13ae6 | |||
| d60ee7b8a5 | |||
| 8f882e9825 | |||
| 48e946c2d0 | |||
| 1758d80020 | |||
| 63b2bd61b5 | |||
| ff2c70fc76 | |||
| e3bfc4472a | |||
| 1cff6f616f | |||
| 1dfe4bf276 | |||
| e4b09032cd | |||
| e8e54a0aea | |||
| 8f85b4cba3 | |||
| 46d65a271d | |||
| e088329ce1 | |||
| 8d9ebb754b | |||
| c0a43077ad | |||
| 1811a63a13 | |||
| cba0e30710 | |||
| ff0b7faa48 | |||
| 975898660c | |||
| cfb7f35d20 | |||
| 147889a66a | |||
| ed9ed715a0 | |||
| a9a3f55c8d | |||
| 58943f2504 | |||
| 5f7633a57e | |||
| 65cfc3220d | |||
| 36d30ef91b | |||
| 41e5c579a2 | |||
| bbf63c51ec | |||
| fb91199f83 | |||
| d76c09ffb2 | |||
| acfb7066d2 | |||
| 7507c107b4 | |||
| 2acb177ad6 | |||
| b5a14077fd | |||
| 5f60bf003f | |||
| f9b2c4c403 | |||
| c909774403 | |||
| 670cfcca13 | |||
| 130e00b62b | |||
| ca4beee95f | |||
| ca784e67df | |||
| 835b8b34f9 | |||
| e6430a729c | |||
| 6c4c9f2fc6 | |||
| 310a7e6e82 | |||
| 7375894645 | |||
| 69973c597b | |||
| 22e8b06fda | |||
| 7ede53fdbb | |||
| ca9051920d | |||
| b477e8d585 | |||
| 8ae2f57d55 | |||
| 1fb2ecf15f | |||
| 6073d914d5 | |||
| 16f55d70af | |||
| b484a31a4a | |||
| 0a162c4129 | |||
| 648f1b488b | |||
| 5fbde4bc06 | |||
| 2a276d9272 | |||
| 9ae252717d | |||
| 456143a266 | |||
| 0bcc98e126 | |||
| ab9ceba41c | |||
| 7cd5666e88 | |||
| 35dcd6ada7 | |||
| ec37df82a9 | |||
| 220cb47615 | |||
| d79b8a337a | |||
| cef6a6f741 | |||
| 9471df1f2d | |||
| f121e5f9c3 | |||
| 7f4fe318c5 | |||
| dbf5c2dbb2 | |||
| 105415873d | |||
| ff32fd1dfc | |||
| 006251ed07 | |||
| 9307582654 | |||
| fe11a2119e | |||
| c31403c1a2 | |||
| 0260e7bedc | |||
| fa43a55f26 | |||
| e9e1f4b9cf | |||
| e7b5b9184d | |||
| 81aa3f2307 | |||
| a9fe584504 | |||
| 4c8861ba79 | |||
| 0ec18cbf06 | |||
| 7008f312dc | |||
| 85317a510e | |||
| d629aa206e | |||
| 6394e1a52b | |||
| 23dca3d307 | |||
| 3032aa8474 | |||
| db19b69ca0 | |||
| f3827f81a7 | |||
| 0532dbb1ae | |||
| efc2681da8 | |||
| 735ed9fd86 | |||
| e856dc4754 | |||
| 0706ff1f95 | |||
| 336b830b0b | |||
| 1a638fe0a5 | |||
| 45467e5bd7 | |||
| 8419b0ab6a | |||
| 49573607fb | |||
| 35fe48db35 | |||
| 590db3e672 | |||
| ea40474c47 | |||
| 7354389f2d | |||
| 1f20ae16aa | |||
| 095c91bf39 | |||
| dc173d752c | |||
| a1788e35b2 | |||
| ea224fd765 | |||
| 7f51544bb9 | |||
| dfb22b0e89 | |||
| e675e841da | |||
| dea43aad8e | |||
| 52e25e934d | |||
| acc067585d | |||
| 47aa1a0795 | |||
| b40cc0c1ea | |||
| b5632626ad | |||
| 67fafdac00 | |||
| 738e628a89 | |||
| 420b846466 | |||
| 05e8c9c90d | |||
| e776c5182f | |||
| be5b3745b9 | |||
| 0de1d9cfda | |||
| 01da98d2fe | |||
| e985100c21 | |||
| 671faabef9 | |||
| bb9c9e22a2 | |||
| 42228f0eaa | |||
| dafd0a8ece | |||
| bee9d82372 | |||
| ec6cf0f029 | |||
| 9cee22165d | |||
| a58aad1198 | |||
| aa78d99179 | |||
| 603efe9259 | |||
| 21e3e10222 | |||
| 34eb6eb4bf | |||
| 565a724b9c | |||
| e87c4a0126 | |||
| 9b16d5d82b | |||
| 9747c8bff1 | |||
| 3ee84700f4 | |||
| 04a463f42c | |||
| 668a201789 | |||
| b336b17eef | |||
| 76b25d719a | |||
| a4d077dd17 | |||
| 469712150b | |||
| fad27ede78 | |||
| 1de90412b3 | |||
| 215c8793e1 | |||
| 54835f97d1 | |||
| 923e929670 | |||
| 37488e92e6 | |||
| 830ca8122d | |||
| fbb2758bdb | |||
| a5c3e06f1c | |||
| c6fb50c4a6 | |||
| 976c0b86dc | |||
| fee5d8f925 | |||
| 808746e12d | |||
| 3fb80dd475 | |||
| db8ea0da94 | |||
| fbdfb714a3 | |||
| 1facfbc2b7 | |||
| 914a0662a9 | |||
| eda3003b7d | |||
| 459942de36 | |||
| 17f64f9b48 | |||
| 3f896c2240 | |||
| 94f8c971c5 | |||
| c43109c063 | |||
| f6058e29b4 | |||
| 3a37311331 | |||
| 9fe1472e64 | |||
| f1480c40a7 | |||
| 88eebdc448 | |||
| 8c76283db5 | |||
| 7668c48081 | |||
| 35d2135f73 | |||
| 1cb0e096be | |||
| 31f7c7f31b | |||
| 82d3b3bc48 | |||
| b3734a5c2a | |||
| 55b8736d50 | |||
| 3334fd3ca6 | |||
|
|
e2416b405a | ||
| 14f012fbfa | |||
| 1ff55057f2 | |||
| 71b5e33dbc | |||
| 08d9d183f4 | |||
| 7183634fd6 | |||
| cf9f270651 | |||
| bd87938e9c | |||
| ba76eaeb90 | |||
| d8492ae168 | |||
| 0db85232d3 | |||
| bcf2325be8 | |||
| 51174a13de | |||
| dfc1fa4d7e | |||
| 10a1d1cb38 | |||
| 6c39dc4d06 | |||
| 4877b8958e | |||
| db9c460e66 | |||
| 2bd5d53b2a | |||
| 577436843d | |||
| 048aa93044 | |||
| 4e49de0dd7 | |||
| 9dc5a7624d | |||
| 21a15db031 | |||
| a6aa4b8758 | |||
| e85d5df03e | |||
| 6833640c48 | |||
| c22c1bb144 | |||
| 8293d6683c | |||
| 7e6e892c45 | |||
| 43ac09a79b | |||
| ee1f115d77 | |||
| 7d85b6fb88 | |||
| 013944c5c9 | |||
| 55ed3e165b | |||
| 9c0106d229 | |||
| 9cd2a6220c | |||
| 033ec8f2da | |||
| 274afe8efc | |||
| e60630b331 | |||
| f6692a22d1 | |||
| 53257ff131 | |||
| ec70813e49 | |||
| 54589ed17b | |||
| 1d3736c44e | |||
| 8ef7acab2d | |||
| c3fca5c6c4 | |||
| 84d2c88032 | |||
| b7ec2f2b86 | |||
| 97d6d3ad13 | |||
| 3dd428c7d9 | |||
| 688de1053b | |||
| a4fae36b22 | |||
| 909a7fd26a | |||
| 041232e260 | |||
| d4c409107a | |||
| a0db95d929 | |||
| fb34b0bec1 | |||
| d18863b7b3 | |||
| c5c8a743e6 | |||
| 89881a7349 | |||
| 865edf385f | |||
| c85faa73c0 | |||
| 6b3f836096 | |||
| 574ffbc44d | |||
| a0120afb08 | |||
| 0b4b4950c2 | |||
| b3391330a0 | |||
| 518dee46b3 | |||
| c9de4bc79e | |||
| badb138bc1 | |||
| 4b980d3f44 | |||
| b11da02c8b | |||
| 71c0b688e8 | |||
| d61aa8b50e | |||
| be64287c42 | |||
| e7027047cb | |||
| 944d15f326 | |||
| ba2c4cbb30 | |||
| 244a1e5175 | |||
| 9c9a938d94 | |||
| a2a403045b | |||
| 6858af14f8 | |||
| 779009c2a6 | |||
| b22d8a5a25 | |||
| 54e3c43999 | |||
| f8a312acb3 | |||
| a51e68be04 | |||
| 39dab0b970 | |||
| b42a6ca0cf | |||
| a34e67722b | |||
| c0e660c8d3 | |||
| 7cca12930c | |||
| 5da60b4ac2 | |||
| 51dac40e45 | |||
| 51fc33960a | |||
| b89b798eb6 | |||
| a9326bb374 | |||
| edad64c6e3 | |||
| 8c06322586 | |||
| 9684e55c12 | |||
| d7d92cd83f | |||
| 7229d96ce7 | |||
| c32ab031dd | |||
| a8d7104145 | |||
| ff550fafde | |||
| 1dbb0e669d | |||
| 723818f04f | |||
| 0c107bc512 | |||
| 945df1bc5f | |||
| 239d740587 | |||
| 5fdcf252b2 | |||
| a17ae07e50 | |||
| 8bbfa2ee24 | |||
| 4b908f9975 | |||
| 542fcef6da | |||
| 0959c0b0d7 | |||
| 4f2a8e49bc | |||
| 0ce9080efc |
3
.github/FUNDING.yml
vendored
Normal file
3
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
custom: ['https://www.tinkoff.ru/rm/ovsyannikov.aleksey113/ObMJ712472']
|
||||
11
.github/dependabot.yml
vendored
Normal file
11
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
# To get started with Dependabot version updates, you'll need to specify which
|
||||
# package ecosystems to update and where the package manifests are located.
|
||||
# Please see the documentation for all configuration options:
|
||||
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "gradle" # See documentation for possible values
|
||||
directory: "/tgbotapi.core" # Location of package manifests
|
||||
schedule:
|
||||
interval: "daily"
|
||||
12
.github/labeler.yml
vendored
Normal file
12
.github/labeler.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
api: "TelegramBotAPI-api/**"
|
||||
utils: "TelegramBotAPI-utils/**"
|
||||
behaviour-builder: "TelegramBotAPI-behaviour_builder/**"
|
||||
behaviour-builder_fsm: "TelegramBotAPI-behaviour_builder-fsm/**"
|
||||
core: "TelegramBotAPI-core/**" # currently not work
|
||||
|
||||
code: "**/*.kt"
|
||||
gradle: "**/*.gradle"
|
||||
versions: "**/gradle.properties"
|
||||
markdown:
|
||||
- "**/*.md"
|
||||
- "!CHANGELOG.md"
|
||||
2
.github/pull_request_template.md
vendored
Normal file
2
.github/pull_request_template.md
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
* Please, be sure that you have read [Contributing](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/CONTRIBUTING.md) file. Of course, this line must be removed during PR preparation :)
|
||||
* Describe your changes, shortly. As example (or format) you can look at the body of any [Project releases](https://github.com/InsanusMokrassar/TelegramBotAPI/releases)
|
||||
13
.github/workflows/greetings.yml
vendored
Normal file
13
.github/workflows/greetings.yml
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
name: Greetings
|
||||
|
||||
on: [pull_request, issues]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: 'Welcome with your first issue'
|
||||
pr-message: 'Welcome with your first PullRequest'
|
||||
21
.github/workflows/kdocs.yml
vendored
Normal file
21
.github/workflows/kdocs.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Publish KDocs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
publishing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Build
|
||||
run: ./gradlew dokkaHtml
|
||||
- name: Publish KDocs
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./docs/build/dokka/html
|
||||
publish_branch: kdocs
|
||||
19
.github/workflows/label.yml
vendored
Normal file
19
.github/workflows/label.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# This workflow will triage pull requests and apply a label based on the
|
||||
# paths that are modified in the pull request.
|
||||
#
|
||||
# To use this workflow, you will need to set up a .github/labeler.yml
|
||||
# file with configuration. For more information, see:
|
||||
# https://github.com/actions/labeler/blob/master/README.md
|
||||
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request
|
||||
|
||||
jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ github.actor == github.repository_owner }}
|
||||
steps:
|
||||
- uses: actions/labeler@v2
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
24
.github/workflows/packages_publishing.yml
vendored
Normal file
24
.github/workflows/packages_publishing.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Publish package to GitHub Packages
|
||||
on: [push]
|
||||
jobs:
|
||||
publishing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- 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: Build
|
||||
run: ./gradlew build
|
||||
- name: Publish
|
||||
continue-on-error: true
|
||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel
|
||||
env:
|
||||
GITHUBPACKAGES_USER: ${{ github.actor }}
|
||||
GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -8,3 +8,7 @@ settings.xml
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
|
||||
local.properties
|
||||
kotlin-js-store/
|
||||
secret.gradle
|
||||
|
||||
15
.travis.yml
Normal file
15
.travis.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
language: java
|
||||
install: true
|
||||
|
||||
os: linux
|
||||
dist: trusty
|
||||
jdk: oraclejdk8
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- stage: build
|
||||
script: ./gradlew build -s -x jvmTest -x jsIrTest -x jsIrBrowserTest -x jsIrNodeTest -x jsLegacyTest -x jsLegacyBrowserTest -x jsLegacyNodeTest
|
||||
- state: test
|
||||
script: ./gradlew allTests
|
||||
- state: dokka
|
||||
script: ./gradlew dokkaHtml
|
||||
2111
CHANGELOG.md
2111
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
10
CONTRIBUTING.md
Normal file
10
CONTRIBUTING.md
Normal file
@@ -0,0 +1,10 @@
|
||||
# Contributing
|
||||
|
||||
In case you wish to contribute this project, there are several small things you must remember:
|
||||
|
||||
* Give maintainers opportunity to manage your Pull request. It is required for two reasons
|
||||
* For more efficient Pull Requests handling (it is much easier for me to fix something small directly in your pull request than ask to fix some small things after each review)
|
||||
* Usually, you will set as a target `master` branch, but I prefer to include code into separated version branch firstly. So, if you will give me opporunity to change Pull Request, I will be available to change base branch
|
||||
* Currently in Pull Requests there are several bots. The most important is Travis bot and it must always successfuly build code from your Pull Request
|
||||
|
||||
This project was built on the idea of strongly-typed declaration of TelegramBotAPI. So, do not worry if maintaners will change your pull requests: you are already cool because you have contributed this project:)
|
||||
4
LICENSE
4
LICENSE
@@ -178,7 +178,7 @@
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
@@ -186,7 +186,7 @@
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright 2018 Insanus
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
271
README.md
271
README.md
@@ -1,206 +1,111 @@
|
||||
# TelegramBotAPI
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#april-16-2022)
|
||||
|
||||
[ ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion)
|
||||
[](https://jenkins.insanusmokrassar.com/job/TelegramBotAPI_master__publishing/)
|
||||
| [](https://github.com/KotlinBy/awesome-kotlin) [](https://github.com/InsanusMokrassar/TelegramBotAPI/actions) [](https://docs.google.com/forms/d/e/1FAIpQLSctdJHT_aEniyYT0-IUAEfo1hsIlezX2owlkEAYX4KPl2V2_A/viewform?usp=sf_link) [](https://t.me/InMoTelegramBotAPI) |
|
||||
|:---:|
|
||||
| [](https://github.com/InsanusMokrassar/TelegramBotAPI-bot_template/generate) [](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/) [](https://tgbotapi.inmo.dev/index.html) [](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
|
||||
|
||||
## What is it?
|
||||
Hello! This is a set of libraries for working with Telegram Bot API.
|
||||
|
||||
Library for Object-Oriented and type-safe work with Telegram Bot API. Most part of some specific solves or unuseful
|
||||
moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api).
|
||||
## Examples
|
||||
|
||||
## Compatibility
|
||||
There are several things you need to do to launch examples below:
|
||||
|
||||
This version compatible with [23th of January 2020 update of TelegramBotAPI (version 4.6)](https://core.telegram.org/bots/api#january-23-2020).
|
||||
There is Telegram Passport API exception of implemented functionality, which was presented in
|
||||
[August 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api-changelog#august-27-2018) update. It will be implemented
|
||||
as soon as possible. All APIs that are not included are presented
|
||||
[wiki](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Not-included-API).
|
||||
* Add `mavenCentral()` to your project repositories
|
||||
* [Maven variant](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Including-in-your-project#pomxml)
|
||||
* Add dependency `implementation "dev.inmo:tgbotapi:$tgbotapi_version"`
|
||||
* Replace `tgbotapi_version` with exact version (see last one in the table above) or put variable with this name in project
|
||||
* Alternative variant for maven [here](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Including-in-your-project#telegrambotapi)
|
||||
|
||||
## How to implement library?
|
||||
More including instructions [available here](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Including-in-your-project).
|
||||
Other configuration examples:
|
||||
|
||||
Common ways to implement this library are presented here. In some cases it will require additional steps
|
||||
like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable
|
||||
`telegrambotapi.version`, which must be set up by developer. Available versions are presented on
|
||||
[bintray](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI), next version is last published:
|
||||
* [For multiplatform](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/tree/master/ResenderBot)
|
||||
* [For JVM](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/blob/master/GetMeBot/build.gradle)
|
||||
|
||||
[ ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion)
|
||||
|
||||
Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing
|
||||
of signed artifacts in Bintray). You can:
|
||||
|
||||
* Use earlier version (available version you can find
|
||||
[here](https://mvnrepository.com/artifact/com.github.insanusmokrassar/TelegramBotAPI))
|
||||
* Add `jCenter` repository in build config
|
||||
|
||||
### Maven
|
||||
|
||||
Dependency config presented here:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.github.insanusmokrassar</groupId>
|
||||
<artifactId>TelegramBotAPI</artifactId>
|
||||
<version>${telegrambotapi.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
### Gradle
|
||||
|
||||
To use last versions you will need to add one line in repositories block of your `build.gradle`:
|
||||
|
||||
`jcenter()` or `mavenCentral()`
|
||||
|
||||
And add next line to your dependencies block:
|
||||
|
||||
```groovy
|
||||
implementation "com.github.insanusmokrassar:TelegramBotAPI:$telegrambotapi_version"
|
||||
```
|
||||
|
||||
or for old gradle:
|
||||
|
||||
```groovy
|
||||
compile "com.github.insanusmokrassar:TelegramBotAPI:$telegrambotapi_version"
|
||||
```
|
||||
|
||||
## How to work with library?
|
||||
|
||||
For now, this library have no some API god-object. Instead of this, this library has several
|
||||
important objects:
|
||||
|
||||
* [RequestsExecutor](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt)
|
||||
* [Requests](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests)
|
||||
* [Types](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types)
|
||||
|
||||
### Types
|
||||
|
||||
Types declare different objects representation. For example, `Chat` for now represented as
|
||||
interface and has several realisations:
|
||||
|
||||
* `PrivateChat`
|
||||
* `GroupChat`
|
||||
* `SupergroupChat`
|
||||
* `ChannelChat`
|
||||
|
||||
Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat),
|
||||
here it was separated for more obvious difference between chats types and their possible content.
|
||||
|
||||
The same principle work with a lot of others things in this Telegram bot API.
|
||||
|
||||
### Requests
|
||||
|
||||
Requests usually are very simple objects, but some of them are using their own
|
||||
build factories. For example, the next code show, how to get information about bot:
|
||||
### Most common example
|
||||
|
||||
```kotlin
|
||||
val requestsExecutor: RequestsExecutor = ...
|
||||
requestsExecutor.execute(GetMe())
|
||||
```
|
||||
suspend fun main() {
|
||||
val bot = telegramBot(TOKEN)
|
||||
|
||||
Or you can use new syntax:
|
||||
|
||||
```kotlin
|
||||
val bot: RequestsExecutor = ...
|
||||
bot.getMe()
|
||||
```
|
||||
|
||||
The result type of [GetMe (and getMe extension)](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
|
||||
request is
|
||||
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
|
||||
|
||||
### RequestsExecutor
|
||||
|
||||
It is base object which can be used to execute requests in API. For now by default included Ktor
|
||||
realisation of `RequestsExecutor`, but it is possible, that in future it will be extracted in separated
|
||||
project. How to create `RequestsExecutor`:
|
||||
|
||||
```kotlin
|
||||
val requestsExecutor = KtorRequestsExecutor(
|
||||
TelegramAPIUrlsKeeper(TOKEN)
|
||||
)
|
||||
```
|
||||
|
||||
Here:
|
||||
|
||||
* `KtorRequestsExecutor` - default realisation with [ktor](https://ktor.io)
|
||||
* `TelegramAPIUrlsKeeper` - special keeper, which you can save and use for getting files full urls (`resolveFileURL`
|
||||
extension inside of `PathedFile.kt`)
|
||||
* `TOKEN` is just a token of bot which was retrieved according to
|
||||
[instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
|
||||
|
||||
By default, for JVM there is implemented `CIO` client engine, but there is not server engine. Both can be changed like
|
||||
here:
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
// ...
|
||||
implementation "io.ktor:ktor-server-cio:$ktor_version" // for implementing of server engine
|
||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
|
||||
// ...
|
||||
bot.buildBehaviourWithLongPolling {
|
||||
println(getMe())
|
||||
|
||||
onCommand("start") {
|
||||
reply(it, "Hi:)")
|
||||
}
|
||||
}.join()
|
||||
}
|
||||
```
|
||||
|
||||
You can avoid using of `server` dependency in case if you will not use `Webhook`s. In this case,
|
||||
dependencies list will be simplify:
|
||||
In this example you will see information about this bot at the moment of starting and answer with `Hi:)` every time it
|
||||
gets message `/start`
|
||||
|
||||
```groovy
|
||||
dependencies {
|
||||
// ...
|
||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
|
||||
// ...
|
||||
### Handling only last messages
|
||||
|
||||
```kotlin
|
||||
suspend fun main() {
|
||||
val bot = telegramBot(TOKEN)
|
||||
|
||||
val flowsUpdatesFilter = FlowsUpdatesFilter()
|
||||
bot.buildBehaviour(flowUpdatesFilter = flowsUpdatesFilter) {
|
||||
println(getMe())
|
||||
|
||||
onCommand("start") {
|
||||
reply(it, "Hi:)")
|
||||
}
|
||||
|
||||
retrieveAccumulatedUpdates(this).join()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Here was used `okhttp` realisation of client, but there are several others engines for Ktor. More information
|
||||
available on ktor.io site for [client](https://ktor.io/clients/http-client/engines.html) and [server](https://ktor.io/quickstart/artifacts.html)
|
||||
engines.
|
||||
The main difference with the previous example is that bot will get only last updates (accumulated before bot launch
|
||||
and maybe some updates it got after launch)
|
||||
|
||||
## Getting updates
|
||||
|
||||
In this library currently realised two ways to get updates from telegram:
|
||||
|
||||
* Polling - in this case bot will request updates from time to time (you can set up delay between requests)
|
||||
* Webhook via reverse proxy or something like this
|
||||
|
||||
### Updates filters
|
||||
|
||||
Currently webhook method contains `UpdatesFilter` as necessary argument for getting updates.
|
||||
`UpdatesFilter` will sort updates and throw their into different callbacks. Currently supporting
|
||||
separate getting updates for media groups - they are accumulating with debounce in one second
|
||||
(for being sure that all objects of media group was received).
|
||||
|
||||
Updates polling also support `UpdatesFilter` but it is not required to use it and you can get updates directly
|
||||
in `UpdateReceiver`, which you will provide to `startGettingOfUpdates` method
|
||||
|
||||
### Webhook set up
|
||||
|
||||
If you wish to use webhook method, you will need:
|
||||
|
||||
* White IP - your IP address or host, which available for calling. [TelegramBotAPI](https://core.telegram.org/bots/api#setwebhook)
|
||||
recommend to use some unique address for each bot which you are using
|
||||
* SSL certificate. Usually you can obtain the certificate using your domain provider, [Let'sEncrypt](https://letsencrypt.org/) or [create it](https://core.telegram.org/bots/self-signed)
|
||||
* Nginx or something like this
|
||||
|
||||
Template for Nginx server config you can find in [this gist](https://gist.github.com/InsanusMokrassar/fcc6e09cebd07e46e8f0fdec234750c4#file-nginxssl-conf).
|
||||
|
||||
For webhook you can provide `File` with public part of certificate, `URL` where bot will be available and inner `PORT` which
|
||||
will be used to start receiving of updates. Actually, you can skip passing of `File` when you have something like
|
||||
nginx for proxy forwarding.
|
||||
|
||||
In case of using `nginx` with reverse-proxy config, setting up of Webhook will look like:
|
||||
### Build a little bit more complex behaviour
|
||||
|
||||
```kotlin
|
||||
requestsExecutor.setWebhook(
|
||||
WEBHOOK_URL,
|
||||
INTERNAL_PORT,
|
||||
filter,
|
||||
ENGINE_FACTORY
|
||||
)
|
||||
```
|
||||
suspend fun main() {
|
||||
val bot = telegramBot(TOKEN)
|
||||
|
||||
Here:
|
||||
bot.buildBehaviourWithLongPolling {
|
||||
println(getMe())
|
||||
|
||||
* `WEBHOOK_URL` - the url which will be used by Telegram system to send updates
|
||||
* `INTERNAL_PORT` - the port which will be used in bot for listening of updates
|
||||
* `filter` - instance of [UpdatesFilter](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt),
|
||||
which will be used to filter incoming updates
|
||||
* `ENGINE_FACTORY` - used factory name, for example, `CIO` in case of usage `io.ktor:ktor-server-cio` as server engine
|
||||
val nameReplyMarkup = ReplyKeyboardMarkup(
|
||||
matrix {
|
||||
row {
|
||||
+SimpleKeyboardButton("nope")
|
||||
}
|
||||
}
|
||||
)
|
||||
onCommand("start") {
|
||||
val photo = waitPhoto(
|
||||
SendTextMessage(it.chat.id, "Send me your photo please")
|
||||
).first()
|
||||
|
||||
val name = waitText(
|
||||
SendTextMessage(
|
||||
it.chat.id,
|
||||
"Send me your name or choose \"nope\"",
|
||||
replyMarkup = nameReplyMarkup
|
||||
)
|
||||
).first().text.takeIf { it != "nope" }
|
||||
|
||||
sendPhoto(
|
||||
it.chat,
|
||||
photo.mediaCollection,
|
||||
entities = buildEntities {
|
||||
if (name != null) regular(name) // may be collapsed up to name ?.let(::regular)
|
||||
}
|
||||
)
|
||||
}
|
||||
}.join()
|
||||
}
|
||||
```
|
||||
|
||||
### More examples
|
||||
|
||||
You may find examples in [this project](https://github.com/InsanusMokrassar/TelegramBotAPI-examples). Besides, you are
|
||||
always welcome in our [wiki](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/About-this-project) and
|
||||
[chat](https://t.me/InMoTelegramBotAPIChat).
|
||||
|
||||
1
TelegramBotAPI.drawio
Normal file
1
TelegramBotAPI.drawio
Normal file
File diff suppressed because one or more lines are too long
100
build.gradle
100
build.gradle
@@ -1,81 +1,57 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://plugins.gradle.org/m2/" }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version"
|
||||
classpath "com.github.breadmoirai:github-release:$github_release_plugin_version"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version" apply false
|
||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version" apply false
|
||||
}
|
||||
|
||||
project.version = "0.23.1"
|
||||
project.group = "com.github.insanusmokrassar"
|
||||
|
||||
apply from: "publish.gradle"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutines_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$kotlin_serialisation_runtime_version"
|
||||
|
||||
api "com.soywiz.korlibs.klock:klock:$klock_version"
|
||||
api "com.benasher44:uuid:$uuid_version"
|
||||
|
||||
api "io.ktor:ktor-client-core:$ktor_version"
|
||||
}
|
||||
}
|
||||
commonTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-common')
|
||||
implementation kotlin('test-annotations-common')
|
||||
}
|
||||
}
|
||||
|
||||
jvmMain {
|
||||
dependencies {
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version"
|
||||
|
||||
api "io.ktor:ktor-client:$ktor_version"
|
||||
api "io.ktor:ktor-server:$ktor_version"
|
||||
|
||||
api "io.ktor:ktor-server-host-common:$ktor_version"
|
||||
api "io.ktor:ktor-client-cio:$ktor_version"
|
||||
}
|
||||
}
|
||||
jvmTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
|
||||
jsMain {
|
||||
dependencies {
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$kotlin_serialisation_runtime_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlin_coroutines_version"
|
||||
api "io.ktor:ktor-client-js:$ktor_version"
|
||||
// temporal crutch until legacy tests will be stabled or legacy target will be removed
|
||||
allprojects {
|
||||
if (it != rootProject.findProject("docs")) {
|
||||
tasks.whenTaskAdded { task ->
|
||||
if(task.name == "jsLegacyBrowserTest" || task.name == "jsLegacyNodeTest") {
|
||||
task.enabled = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getCurrentVersionChangelog() {
|
||||
OutputStream changelogDataOS = new ByteArrayOutputStream()
|
||||
exec {
|
||||
standardOutput = changelogDataOS
|
||||
commandLine './changelog_info_retriever', "$library_version", 'CHANGELOG.md'
|
||||
}
|
||||
|
||||
return changelogDataOS.toString().trim()
|
||||
}
|
||||
|
||||
if (new File(projectDir, "secret.gradle").exists()) {
|
||||
apply from: './secret.gradle'
|
||||
apply plugin: "com.github.breadmoirai.github-release"
|
||||
|
||||
githubRelease {
|
||||
token "${project.property('GITHUB_RELEASE_TOKEN')}"
|
||||
|
||||
owner "InsanusMokrassar"
|
||||
repo "TelegramBotAPI"
|
||||
|
||||
tagName "$library_version"
|
||||
releaseName "$library_version"
|
||||
targetCommitish "$library_version"
|
||||
|
||||
body getCurrentVersionChangelog()
|
||||
}
|
||||
}
|
||||
|
||||
24
changelog_info_retriever
Executable file
24
changelog_info_retriever
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
function parse() {
|
||||
version=$1
|
||||
|
||||
while IFS= read -r line && [ -z "`echo $line | grep -e "^#\+ $version"`" ]
|
||||
do
|
||||
: # do nothing
|
||||
done
|
||||
|
||||
while IFS= read -r line && [ -z "`echo $line | grep -e "^#\+"`" ]
|
||||
do
|
||||
echo "$line"
|
||||
done
|
||||
}
|
||||
|
||||
version=$1
|
||||
file=$2
|
||||
|
||||
if [ -n "$file" ]; then
|
||||
parse $version < "$file"
|
||||
else
|
||||
parse $version
|
||||
fi
|
||||
110
docs/build.gradle
Normal file
110
docs/build.gradle
Normal file
@@ -0,0 +1,110 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform"
|
||||
id "org.jetbrains.kotlin.plugin.serialization"
|
||||
id "org.jetbrains.dokka" version "$dokka_version"
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm {
|
||||
compilations.main {
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
}
|
||||
}
|
||||
js(IR) {
|
||||
browser()
|
||||
nodejs()
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
|
||||
api project(":tgbotapi.core")
|
||||
api project(":tgbotapi.api")
|
||||
api project(":tgbotapi.utils")
|
||||
api project(":tgbotapi.behaviour_builder")
|
||||
api project(":tgbotapi.behaviour_builder.fsm")
|
||||
api project(":tgbotapi")
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
dependencies {
|
||||
api project(":tgbotapi.webapps")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private List<SourceDirectorySet> findSourcesWithName(String... approximateNames) {
|
||||
return parent.subprojects
|
||||
.findAll { it != project }
|
||||
.collectMany { it.kotlin.sourceSets }
|
||||
.findAll { sourceSet -> approximateNames.any {
|
||||
nameToFilter -> sourceSet.name.contains(nameToFilter)
|
||||
}
|
||||
}.collect { it.kotlin }
|
||||
}
|
||||
|
||||
Object callback = {
|
||||
switch (true) {
|
||||
case project.hasProperty("DOKKA_PATH"):
|
||||
outputDirectory = project.property("DOKKA_PATH").toString()
|
||||
break
|
||||
case System.getenv("DOKKA_PATH") != null:
|
||||
outputDirectory = System.getenv("DOKKA_PATH")
|
||||
break
|
||||
}
|
||||
|
||||
dokkaSourceSets {
|
||||
configureEach {
|
||||
skipDeprecated.set(true)
|
||||
|
||||
sourceLink {
|
||||
localDirectory.set(file("./"))
|
||||
remoteUrl.set(new URL("https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/"))
|
||||
remoteLineSuffix.set("#L")
|
||||
}
|
||||
}
|
||||
|
||||
named("commonMain") {
|
||||
sourceRoots.setFrom(findSourcesWithName("commonMain"))
|
||||
}
|
||||
|
||||
named("jsMain") {
|
||||
sourceRoots.setFrom(findSourcesWithName("jsMain"))
|
||||
}
|
||||
|
||||
named("jvmMain") {
|
||||
sourceRoots.setFrom(findSourcesWithName("jvmMain"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.dokkaGfm(callback)
|
||||
tasks.dokkaHtml(callback)
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
1
docs/gradle.properties
Normal file
1
docs/gradle.properties
Normal file
@@ -0,0 +1 @@
|
||||
org.gradle.jvmargs=-Xmx1024m
|
||||
@@ -1,9 +1,25 @@
|
||||
org.gradle.jvmargs=-Xmx2048m
|
||||
kotlin.code.style=official
|
||||
kotlin_version=1.3.61
|
||||
kotlin_coroutines_version=1.3.3
|
||||
kotlin_serialisation_runtime_version=0.14.0
|
||||
klock_version=1.8.7
|
||||
uuid_version=0.0.7
|
||||
ktor_version=1.3.1
|
||||
org.gradle.parallel=true
|
||||
kotlin.js.generate.externals=true
|
||||
kotlin.incremental=true
|
||||
kotlin.incremental.js=true
|
||||
|
||||
gradle_bintray_plugin_version=1.8.4
|
||||
kotlin_version=1.6.10
|
||||
kotlin_coroutines_version=1.6.1
|
||||
kotlin_serialisation_runtime_version=1.3.2
|
||||
klock_version=2.7.0
|
||||
uuid_version=0.4.0
|
||||
ktor_version=1.6.8
|
||||
|
||||
micro_utils_version=0.9.24
|
||||
|
||||
javax_activation_version=1.1.1
|
||||
|
||||
|
||||
dokka_version=1.6.10
|
||||
|
||||
library_group=dev.inmo
|
||||
library_version=0.38.15
|
||||
|
||||
github_release_plugin_version=2.3.7
|
||||
|
||||
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,5 @@
|
||||
#Fri Nov 29 12:11:00 HKT 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
task javadocsJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
project.publishing.publications.all {
|
||||
// rename artifacts
|
||||
groupId "${project.group}"
|
||||
if (it.name.contains('kotlinMultiplatform')) {
|
||||
artifactId = "${project.name}"
|
||||
} else {
|
||||
artifactId = "${project.name}-$name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications.all {
|
||||
artifact javadocsJar
|
||||
|
||||
pom.withXml {
|
||||
asNode().children().last() + {
|
||||
resolveStrategy = Closure.DELEGATE_FIRST
|
||||
|
||||
description "Library for Object-Oriented and type-safe work with Telegram Bot API"
|
||||
name "Telegram Bot API"
|
||||
url "https://insanusmokrassar.github.io/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"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"bintrayConfig":{"repo":"StandardRepository","packageName":"${project.name}","packageVcs":"https://github.com/InsanusMokrassar/TelegramBotAPI"},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"Telegram Bot API","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}
|
||||
114
publish.gradle
114
publish.gradle
@@ -1,55 +1,79 @@
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
apply from: "maven.publish.gradle"
|
||||
task javadocsJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')
|
||||
key = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')
|
||||
filesSpec {
|
||||
from "${buildDir}/publications/"
|
||||
eachFile {
|
||||
String directorySubname = it.getFile().parentFile.name
|
||||
if (it.getName() == "module.json") {
|
||||
if (directorySubname == "kotlinMultiplatform") {
|
||||
it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.module")
|
||||
} else {
|
||||
it.setPath("${project.name}-${directorySubname}/${project.version}/${project.name}-${directorySubname}-${project.version}.module")
|
||||
}
|
||||
} else {
|
||||
if (directorySubname == "kotlinMultiplatform" && it.getName() == "pom-default.xml") {
|
||||
it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.pom")
|
||||
} else {
|
||||
it.exclude()
|
||||
}
|
||||
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"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
into "${project.group}".replace(".", "/")
|
||||
}
|
||||
pkg {
|
||||
repo = "StandardRepository"
|
||||
name = "${project.name}"
|
||||
vcsUrl = "https://github.com/InsanusMokrassar/TelegramBotAPI"
|
||||
licenses = ["Apache-2.0"]
|
||||
version {
|
||||
name = "${project.version}"
|
||||
released = new Date()
|
||||
vcsTag = "${project.version}"
|
||||
gpg {
|
||||
sign = true
|
||||
passphrase = project.hasProperty('signing.gnupg.passphrase') ? project.property('signing.gnupg.passphrase') : System.getenv('signing.gnupg.passphrase')
|
||||
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('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')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload.doFirst {
|
||||
publications = publishing.publications.collect {
|
||||
if (it.name.contains('kotlinMultiplatform')) {
|
||||
null
|
||||
} else {
|
||||
it.name
|
||||
|
||||
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||
apply plugin: 'signing'
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
|
||||
sign publishing.publications
|
||||
}
|
||||
|
||||
task signAll {
|
||||
tasks.withType(Sign).forEach {
|
||||
dependsOn(it)
|
||||
}
|
||||
} - null
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload.dependsOn publishToMavenLocal
|
||||
1
publish.kpsb
Normal file
1
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/TelegramBotAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||
97
readmes/exceptions_handling.md
Normal file
97
readmes/exceptions_handling.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# Exceptions handling
|
||||
|
||||
Unfortunatelly, exceptions handling in this library is a bit difficult in some places, but that have at least two reasons: flexibility and usability.
|
||||
|
||||
## "In place" handling
|
||||
|
||||
In case you know, where exceptions are happening, you may use several tools for exceptions catching:
|
||||
|
||||
* Catching with result
|
||||
* Catching with callback
|
||||
|
||||
### Catching with result
|
||||
|
||||
If you prefer to receive `Result` objects instead of some weird callbacks, you may use the next syntax:
|
||||
|
||||
```kotlin
|
||||
safelyWithResult {
|
||||
// do something
|
||||
}.onSuccess { // will be called if everything is right
|
||||
// handle success
|
||||
}.onFailure { // will be called if something went wrong
|
||||
// handle error
|
||||
it.printStackTrace()
|
||||
}.getOrThrow() // will return value or throw exception
|
||||
```
|
||||
|
||||
### Catching with callback
|
||||
|
||||
Also there is more simple (in some cases) way to handle exceptions with callbacks:
|
||||
|
||||
```kotlin
|
||||
safely(
|
||||
{
|
||||
// handle error
|
||||
it.printStackTrace()
|
||||
null // return value
|
||||
}
|
||||
) {
|
||||
// do something
|
||||
}
|
||||
```
|
||||
|
||||
### Bonus: different types of handling
|
||||
|
||||
There are two types of handling:
|
||||
|
||||
* Just safely - when you are using something to obviously retrieve value or throw exception. When handling callback has been skipped, it will throw exception by default. For example:
|
||||
```kotlin
|
||||
safely(
|
||||
{
|
||||
it.printStackTrace()
|
||||
"error"
|
||||
}
|
||||
) {
|
||||
error("Hi :)") // emulate exception throwing
|
||||
"ok"
|
||||
} // result will be with type String
|
||||
```
|
||||
* Safely without exceptions - almost the same as `safely`, but this type by default allow to return nullable value (when exception was thrown) instead of just throwing (as with `safely`):
|
||||
```kotlin
|
||||
safelyWithouExceptions {
|
||||
// do something
|
||||
} // will returns nullable result type
|
||||
```
|
||||
|
||||
## Global exceptions handling
|
||||
|
||||
The most simple way to configure exceptions handling is to change `CoroutineContext` when you are creating your `CoroutineScope` for bot processing:
|
||||
|
||||
```kotlin
|
||||
val bot = telegramBot("TOKEN")
|
||||
|
||||
bot.buildBehaviour (
|
||||
scope = scope,
|
||||
defaultExceptionsHandler = {
|
||||
it.printStackTrace()
|
||||
}
|
||||
) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
OR
|
||||
|
||||
```kotlin
|
||||
val bot = telegramBotWithBehaviour (
|
||||
"TOKEN",
|
||||
scope = scope,
|
||||
defaultExceptionsHandler = {
|
||||
it.printStackTrace()
|
||||
}
|
||||
) {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
||||
Here we have used `ContextSafelyExceptionHandler` class. It will pass default handling of exceptions and will call the block in most cases when something inside of your bot logic has thrown exception.
|
||||
5
renovate.json
Normal file
5
renovate.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": [
|
||||
"config:base"
|
||||
]
|
||||
}
|
||||
144
resources/TelegramBotAPI-libraries-hierarchy.svg
Normal file
144
resources/TelegramBotAPI-libraries-hierarchy.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 16 KiB |
@@ -1 +1,25 @@
|
||||
rootProject.name = 'TelegramBotAPI'
|
||||
pluginManagement {
|
||||
resolutionStrategy {
|
||||
eachPlugin {
|
||||
if (requested.id.id == "org.jetbrains.dokka") {
|
||||
useModule("org.jetbrains.dokka:dokka-gradle-plugin:${requested.version}")
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
include ":tgbotapi.core"
|
||||
include ":tgbotapi.api"
|
||||
include ":tgbotapi.utils"
|
||||
include ":tgbotapi.behaviour_builder"
|
||||
include ":tgbotapi.behaviour_builder.fsm"
|
||||
include ":tgbotapi.extensions.api"
|
||||
include ":tgbotapi.extensions.utils"
|
||||
include ":tgbotapi.extensions.behaviour_builder"
|
||||
include ":tgbotapi.extensions.behaviour_builder.fsm"
|
||||
include ":tgbotapi"
|
||||
include ":tgbotapi.webapps"
|
||||
include ":docs"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.fullListOfSubSource
|
||||
|
||||
interface Captioned {
|
||||
val caption: String?
|
||||
}
|
||||
|
||||
interface CaptionedOutput : Captioned {
|
||||
val parseMode: ParseMode?
|
||||
}
|
||||
|
||||
interface CaptionedInput : Captioned {
|
||||
val captionEntities: List<TextPart>
|
||||
}
|
||||
|
||||
fun CaptionedInput.fullEntitiesList() = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
interface CommonVenueData : Titled {
|
||||
override val title: String
|
||||
val address: String
|
||||
val foursquareId: String?
|
||||
val foursquareType: String? // TODO:: Rewrite with enum or interface
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
interface Livable {
|
||||
/**
|
||||
* Period in SECONDS
|
||||
*/
|
||||
val livePeriod: Int?
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
interface MimeTyped {
|
||||
val mimeType: String? // TODO::replace by something like enum or interface
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
interface Performerable {
|
||||
val performer: String?
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
interface TextSource {
|
||||
val asMarkdownSource: String
|
||||
val asMarkdownV2Source: String
|
||||
val asHtmlSource: String
|
||||
}
|
||||
|
||||
|
||||
interface MultilevelTextSource : TextSource {
|
||||
val textParts: List<TextPart>
|
||||
}
|
||||
|
||||
data class TextPart(
|
||||
val range: IntRange,
|
||||
val source: TextSource
|
||||
)
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
|
||||
|
||||
interface Titled {
|
||||
val title: String?
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
|
||||
interface ChatRequest {
|
||||
val chatId: ChatIdentifier
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
interface DisableNotification {
|
||||
val disableNotification: Boolean
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
|
||||
interface InlineMessageAction {
|
||||
val inlineMessageId: InlineMessageIdentifier
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
|
||||
interface MessageAction: ChatRequest {
|
||||
val messageId: MessageIdentifier
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
|
||||
interface ReplyMarkup {
|
||||
val replyMarkup: KeyboardMarkup?
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
|
||||
interface ReplyMessageId {
|
||||
val replyToMessageId: MessageIdentifier?
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.TelegramDate
|
||||
|
||||
interface UntilDate {
|
||||
val untilDate: TelegramDate?
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
|
||||
|
||||
abstract class BaseRequestsExecutor(
|
||||
protected val telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper
|
||||
) : RequestsExecutor
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.statement.HttpStatement
|
||||
|
||||
interface KtorCallFactory {
|
||||
suspend fun <T: Any> prepareCall(
|
||||
client: HttpClient,
|
||||
baseUrl: String,
|
||||
request: Request<T>
|
||||
) : HttpStatement?
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.BaseRequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base.MultipartRequestCallFactory
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base.SimpleRequestCallFactory
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.newRequestException
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters.EmptyLimiter
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters.RequestLimiter
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.Response
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.RetryAfterError
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.call.receive
|
||||
import io.ktor.client.features.ClientRequestException
|
||||
import io.ktor.client.statement.HttpStatement
|
||||
import io.ktor.client.statement.readText
|
||||
import kotlinx.coroutines.delay
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
class KtorRequestsExecutor(
|
||||
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
callsFactories: List<KtorCallFactory> = emptyList(),
|
||||
excludeDefaultFactories: Boolean = false,
|
||||
private val requestsLimiter: RequestLimiter = EmptyLimiter,
|
||||
private val jsonFormatter: Json = Json.nonstrict
|
||||
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
||||
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
|
||||
if (!excludeDefaultFactories) {
|
||||
asSequence().plus(SimpleRequestCallFactory()).plus(MultipartRequestCallFactory()).toList()
|
||||
} else {
|
||||
this
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun <T : Any> execute(request: Request<T>): T {
|
||||
return requestsLimiter.limit {
|
||||
var statement: HttpStatement? = null
|
||||
for (factory in callsFactories) {
|
||||
statement = factory.prepareCall(
|
||||
client,
|
||||
telegramAPIUrlsKeeper.commonAPIUrl,
|
||||
request
|
||||
)
|
||||
if (statement != null) {
|
||||
break
|
||||
}
|
||||
}
|
||||
try {
|
||||
val response = statement ?.execute() ?: throw IllegalArgumentException("Can't execute request: $request")
|
||||
val content = response.receive<String>()
|
||||
val responseObject = jsonFormatter.parse(Response.serializer(), content)
|
||||
|
||||
(responseObject.result?.let {
|
||||
jsonFormatter.fromJson(request.resultDeserializer, it)
|
||||
} ?: responseObject.parameters?.let {
|
||||
val error = it.error
|
||||
if (error is RetryAfterError) {
|
||||
delay(error.leftToRetry)
|
||||
execute(request)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
} ?: response.let {
|
||||
throw newRequestException(
|
||||
responseObject,
|
||||
content,
|
||||
"Can't get result object from $content"
|
||||
)
|
||||
})
|
||||
} catch (e: ClientRequestException) {
|
||||
val content = e.response.readText()
|
||||
val responseObject = jsonFormatter.parse(Response.serializer(), content)
|
||||
throw newRequestException(
|
||||
responseObject,
|
||||
content,
|
||||
"Can't get result object from $content"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
client.close()
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorCallFactory
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.request.*
|
||||
import io.ktor.client.statement.HttpStatement
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.http.HttpMethod
|
||||
import kotlin.collections.set
|
||||
|
||||
abstract class AbstractRequestCallFactory : KtorCallFactory {
|
||||
private val methodsCache: MutableMap<String, String> = mutableMapOf()
|
||||
override suspend fun <T : Any> prepareCall(
|
||||
client: HttpClient,
|
||||
baseUrl: String,
|
||||
request: Request<T>
|
||||
): HttpStatement? {
|
||||
val preparedBody = prepareCallBody(client, baseUrl, request) ?: return null
|
||||
|
||||
return HttpStatement(
|
||||
HttpRequestBuilder().apply {
|
||||
url(
|
||||
methodsCache[request.method()] ?: "$baseUrl/${request.method()}".also {
|
||||
methodsCache[request.method()] = it
|
||||
}
|
||||
)
|
||||
method = HttpMethod.Post
|
||||
accept(ContentType.Application.Json)
|
||||
|
||||
body = preparedBody
|
||||
},
|
||||
client
|
||||
)
|
||||
}
|
||||
|
||||
protected abstract fun <T : Any> prepareCallBody(
|
||||
client: HttpClient,
|
||||
baseUrl: String,
|
||||
request: Request<T>
|
||||
): Any?
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
|
||||
import io.ktor.utils.io.core.Closeable
|
||||
|
||||
interface RequestsExecutor : Closeable {
|
||||
/**
|
||||
* @throws com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.RequestException
|
||||
*/
|
||||
suspend fun <T : Any> execute(request: Request<T>): T
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot
|
||||
|
||||
import io.ktor.utils.io.core.Closeable
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
|
||||
interface UpdatesPoller : Closeable {
|
||||
fun start(scope: CoroutineScope = CoroutineScope(Dispatchers.Default))
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.Response
|
||||
import kotlinx.io.IOException
|
||||
|
||||
fun newRequestException(
|
||||
response: Response,
|
||||
plainAnswer: String,
|
||||
message: String? = null,
|
||||
cause: Throwable? = null
|
||||
) = response.description ?.let { description ->
|
||||
when {
|
||||
description == "Bad Request: reply message not found" -> ReplyMessageNotFoundException(response, plainAnswer, message, cause)
|
||||
description == "Bad Request: message to edit not found" -> MessageToEditNotFoundException(response, plainAnswer, message, cause)
|
||||
description.contains("Bad Request: message is not modified") -> MessageIsNotModifiedException(response, plainAnswer, message, cause)
|
||||
description == "Unauthorized" -> UnauthorizedException(response, plainAnswer, message, cause)
|
||||
else -> null
|
||||
}
|
||||
} ?: CommonRequestException(response, plainAnswer, message, cause)
|
||||
|
||||
sealed class RequestException constructor(
|
||||
val response: Response,
|
||||
val plainAnswer: String,
|
||||
message: String? = null,
|
||||
override val cause: Throwable? = null
|
||||
) : IOException(
|
||||
message ?: "Something went wrong"
|
||||
)
|
||||
|
||||
class CommonRequestException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
RequestException(response, plainAnswer, message, cause)
|
||||
|
||||
class UnauthorizedException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
RequestException(response, plainAnswer, message, cause)
|
||||
|
||||
class ReplyMessageNotFoundException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
RequestException(response, plainAnswer, message, cause)
|
||||
|
||||
class MessageIsNotModifiedException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
RequestException(response, plainAnswer, message, cause)
|
||||
|
||||
class MessageToEditNotFoundException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
|
||||
RequestException(response, plainAnswer, message, cause)
|
||||
@@ -1,67 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
|
||||
private fun now(): Long = DateTime.nowUnixLong()
|
||||
|
||||
class CommonLimiter(
|
||||
private val lockCount: Int = 10,
|
||||
private val regenTime: Long = 20 * 1000L // 20 seconds for full regen of opportunity to send message
|
||||
) : RequestLimiter {
|
||||
private var doLimit: Boolean = false
|
||||
|
||||
private val counterChannel = Channel<Unit>(Channel.UNLIMITED)
|
||||
private val scope = CoroutineScope(Dispatchers.Default)
|
||||
private val counterJob = scope.launch {
|
||||
var wasLastSecond = 0
|
||||
var lastCountTime = now()
|
||||
var limitManagementJob: Job? = null
|
||||
var removeLimitTime: Long = lastCountTime
|
||||
for (counter in counterChannel) {
|
||||
val now = now()
|
||||
if (now - lastCountTime > 1000) {
|
||||
lastCountTime = now
|
||||
wasLastSecond = 1
|
||||
} else {
|
||||
wasLastSecond++
|
||||
}
|
||||
if (wasLastSecond >= lockCount) {
|
||||
removeLimitTime = now + regenTime
|
||||
if (limitManagementJob == null) {
|
||||
limitManagementJob = launch {
|
||||
doLimit = true
|
||||
var internalNow = now()
|
||||
while (internalNow < removeLimitTime) {
|
||||
delay(removeLimitTime - internalNow)
|
||||
internalNow = now()
|
||||
}
|
||||
doLimit = false
|
||||
}
|
||||
}
|
||||
}
|
||||
if (now > removeLimitTime) {
|
||||
limitManagementJob = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val quoterChannel = Channel<Unit>(Channel.CONFLATED)
|
||||
private val tickerJob = scope.launch {
|
||||
while (isActive) {
|
||||
quoterChannel.send(Unit)
|
||||
delay(1000L)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun <T> limit(block: suspend () -> T): T {
|
||||
counterChannel.send(Unit)
|
||||
return if (!doLimit) {
|
||||
block()
|
||||
} else {
|
||||
quoterChannel.receive()
|
||||
block()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters
|
||||
|
||||
object EmptyLimiter : RequestLimiter {
|
||||
override suspend fun <T> limit(block: suspend () -> T): T = block()
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters
|
||||
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.Transient
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.math.pow
|
||||
|
||||
private sealed class RequestEvent
|
||||
private class AddRequest(
|
||||
val continuation: Continuation<Long>
|
||||
) : RequestEvent()
|
||||
private object CompleteRequest : RequestEvent()
|
||||
|
||||
@Serializable
|
||||
data class PowLimiter(
|
||||
private val minAwaitTime: Long = 0L,
|
||||
private val maxAwaitTime: Long = 10000L,
|
||||
private val powValue: Double = 4.0,
|
||||
private val powK: Double = 0.0016
|
||||
) : RequestLimiter {
|
||||
@Transient
|
||||
private val scope = CoroutineScope(Dispatchers.Default)
|
||||
@Transient
|
||||
private val eventsChannel = Channel<RequestEvent>(Channel.UNLIMITED)
|
||||
@Transient
|
||||
private val awaitTimeRange = minAwaitTime .. maxAwaitTime
|
||||
|
||||
init {
|
||||
scope.launch {
|
||||
var requestsInWork: Double = 0.0
|
||||
for (event in eventsChannel) {
|
||||
when (event) {
|
||||
is AddRequest -> {
|
||||
val awaitTime = (((requestsInWork.pow(powValue) * powK) * 1000L).toLong())
|
||||
requestsInWork++
|
||||
|
||||
event.continuation.resume(
|
||||
if (awaitTime in awaitTimeRange) {
|
||||
awaitTime
|
||||
} else {
|
||||
if (awaitTime < minAwaitTime) {
|
||||
minAwaitTime
|
||||
} else {
|
||||
maxAwaitTime
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
is CompleteRequest -> requestsInWork--
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun <T> limit(
|
||||
block: suspend () -> T
|
||||
): T {
|
||||
val delayMillis = suspendCoroutine<Long> {
|
||||
scope.launch { eventsChannel.send(AddRequest(it)) }
|
||||
}
|
||||
delay(delayMillis)
|
||||
return try {
|
||||
block()
|
||||
} finally {
|
||||
eventsChannel.send(CompleteRequest)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class DeleteMessage(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier
|
||||
) : SimpleRequest<Boolean>, MessageAction {
|
||||
override fun method(): String = "deleteMessage"
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.deleteMessage(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier
|
||||
) = execute(
|
||||
DeleteMessage(chatId, messageId)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.deleteMessage(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier
|
||||
) = deleteMessage(chat.id, messageId)
|
||||
|
||||
suspend fun RequestsExecutor.deleteMessage(
|
||||
message: Message
|
||||
) = deleteMessage(message.chat, message.messageId)
|
||||
|
||||
suspend fun Message.delete(
|
||||
requestsExecutor: RequestsExecutor
|
||||
) = requestsExecutor.deleteMessage(this)
|
||||
@@ -1,76 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import kotlinx.serialization.*
|
||||
|
||||
private val AbleToBeForwardedMessageDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<PossiblyForwardedMessage>()
|
||||
|
||||
@Serializable
|
||||
data class ForwardMessage(
|
||||
@SerialName(fromChatIdField)
|
||||
val fromChatId: ChatIdentifier,
|
||||
@SerialName(chatIdField)
|
||||
val toChatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(disableNotificationField)
|
||||
val disableNotification: Boolean = false
|
||||
): SimpleRequest<PossiblyForwardedMessage>, MessageAction {
|
||||
override val chatId: ChatIdentifier
|
||||
get() = fromChatId
|
||||
|
||||
override fun method(): String = "forwardMessage"
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<PossiblyForwardedMessage>
|
||||
get() = AbleToBeForwardedMessageDeserializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.forwardMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
disableNotification: Boolean = false
|
||||
) = execute(
|
||||
ForwardMessage(fromChatId, toChatId, messageId, disableNotification)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.forwardMessage(
|
||||
fromChat: Chat,
|
||||
toChatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
disableNotification: Boolean = false
|
||||
) = forwardMessage(fromChat.id, toChatId, messageId, disableNotification)
|
||||
|
||||
suspend fun RequestsExecutor.forwardMessage(
|
||||
fromChatId: ChatIdentifier,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
disableNotification: Boolean = false
|
||||
) = forwardMessage(fromChatId, toChat.id, messageId, disableNotification)
|
||||
|
||||
suspend fun RequestsExecutor.forwardMessage(
|
||||
fromChat: Chat,
|
||||
toChat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
disableNotification: Boolean = false
|
||||
) = forwardMessage(fromChat.id, toChat.id, messageId, disableNotification)
|
||||
|
||||
suspend fun RequestsExecutor.forwardMessage(
|
||||
toChatId: ChatIdentifier,
|
||||
message: Message,
|
||||
disableNotification: Boolean = false
|
||||
) = forwardMessage(message.chat, toChatId, message.messageId, disableNotification)
|
||||
|
||||
suspend fun RequestsExecutor.forwardMessage(
|
||||
toChat: Chat,
|
||||
message: Message,
|
||||
disableNotification: Boolean = false
|
||||
) = forwardMessage(message.chat, toChat, message.messageId, disableNotification)
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
class GetMe : SimpleRequest<ExtendedBot> {
|
||||
override fun method(): String = "getMe"
|
||||
override val resultDeserializer: DeserializationStrategy<ExtendedBot>
|
||||
get() = ExtendedBot.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.getMe() = execute(GetMe())
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateSerializerWithoutDeserialization
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.ArrayListSerializer
|
||||
|
||||
private val updatesListSerializer = ArrayListSerializer(
|
||||
UpdateSerializerWithoutDeserialization
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class GetUpdates(
|
||||
val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
|
||||
val limit: Int? = null,
|
||||
val timeout: Int? = null,
|
||||
val allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
): SimpleRequest<List<Update>> {
|
||||
override fun method(): String = "getUpdates"
|
||||
|
||||
override val resultDeserializer: DeserializationStrategy<List<Update>>
|
||||
get() = updatesListSerializer
|
||||
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.getUpdates(
|
||||
offset: UpdateIdentifier? = null,
|
||||
limit: Int? = null,
|
||||
timeout: Int? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
) = execute(
|
||||
GetUpdates(
|
||||
offset, limit, timeout, allowed_updates
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getUpdates(
|
||||
lastUpdate: Update,
|
||||
limit: Int? = null,
|
||||
timeout: Int? = null,
|
||||
allowed_updates: List<String>? = ALL_UPDATES_LIST
|
||||
) = getUpdates(
|
||||
lastUpdate.updateId + 1, limit, timeout, allowed_updates
|
||||
)
|
||||
@@ -1,133 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendLocation
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||
import com.soywiz.klock.DateTime
|
||||
import com.soywiz.klock.TimeSpan
|
||||
import io.ktor.utils.io.core.Closeable
|
||||
import kotlinx.coroutines.*
|
||||
import kotlin.math.ceil
|
||||
|
||||
private val livePeriodDelayMillis = (livePeriodLimit.last - 60L) * 1000L
|
||||
class LiveLocation internal constructor(
|
||||
private val requestsExecutor: RequestsExecutor,
|
||||
scope: CoroutineScope,
|
||||
autoCloseTimeDelay: Double,
|
||||
initMessage: ContentMessage<LocationContent>
|
||||
) : Closeable {
|
||||
private val doWhenClose = {
|
||||
scope.launch {
|
||||
requestsExecutor.stopLiveLocation(message)
|
||||
}
|
||||
}
|
||||
private val autoCloseTime = DateTime.now() + TimeSpan(autoCloseTimeDelay)
|
||||
val leftUntilCloseMillis: TimeSpan
|
||||
get() = autoCloseTime - DateTime.now()
|
||||
|
||||
var isClosed: Boolean = false
|
||||
private set
|
||||
get() = field || leftUntilCloseMillis.millisecondsLong < 0L
|
||||
|
||||
private var message: ContentMessage<LocationContent> = initMessage
|
||||
val lastLocation: Location
|
||||
get() = message.content.location
|
||||
|
||||
suspend fun updateLocation(
|
||||
location: Location,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
): Location {
|
||||
if (!isClosed) {
|
||||
message = requestsExecutor.editLiveLocation(
|
||||
message,
|
||||
location,
|
||||
replyMarkup
|
||||
)
|
||||
return lastLocation
|
||||
} else {
|
||||
error("LiveLocation is closed")
|
||||
}
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
if (isClosed) {
|
||||
return
|
||||
}
|
||||
isClosed = true
|
||||
doWhenClose()
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chatId: ChatIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocation {
|
||||
val liveTimeAsDouble = liveTimeMillis.toDouble()
|
||||
val locationMessage = execute(
|
||||
SendLocation(
|
||||
chatId,
|
||||
latitude,
|
||||
longitude,
|
||||
ceil(liveTimeAsDouble / 1000).toLong(),
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
return LiveLocation(
|
||||
this,
|
||||
scope,
|
||||
liveTimeAsDouble,
|
||||
locationMessage
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chat: Chat,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocation = startLiveLocation(
|
||||
scope, chat.id, latitude, longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chatId: ChatId,
|
||||
location: Location,
|
||||
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocation = startLiveLocation(
|
||||
scope, chatId, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.startLiveLocation(
|
||||
scope: CoroutineScope,
|
||||
chat: Chat,
|
||||
location: Location,
|
||||
liveTimeMillis: Long = livePeriodDelayMillis,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
): LiveLocation = startLiveLocation(
|
||||
scope, chat.id, location.latitude, location.longitude, liveTimeMillis, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup.EditChatMessageReplyMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class StopPoll(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : MessageAction, SimpleRequest<Poll>, ReplyMarkup {
|
||||
override fun method(): String = "stopPoll"
|
||||
override val resultDeserializer: DeserializationStrategy<Poll>
|
||||
get() = Poll.serializer()
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.stopPoll(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
StopPoll(chatId, messageId, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.stopPoll(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopPoll(chat.id, messageId, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.stopPoll(
|
||||
chatId: ChatId,
|
||||
message: Message,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopPoll(chatId, message.messageId, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.stopPoll(
|
||||
chat: Chat,
|
||||
message: Message,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopPoll(chat.id, message.messageId, replyMarkup)
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.StringDescriptor
|
||||
|
||||
@Serializable(InputFileSerializer::class)
|
||||
sealed class InputFile {
|
||||
abstract val fileId: String
|
||||
}
|
||||
|
||||
// TODO:: add checks for file url/file id regex
|
||||
/**
|
||||
* Contains file id or file url
|
||||
*/
|
||||
@Serializable(InputFileSerializer::class)
|
||||
data class FileId(
|
||||
override val fileId: String
|
||||
) : InputFile()
|
||||
|
||||
fun String.toInputFile() = FileId(this)
|
||||
|
||||
@Serializer(InputFile::class)
|
||||
internal object InputFileSerializer : KSerializer<InputFile> {
|
||||
override val descriptor: SerialDescriptor = StringDescriptor.withName(FileId::class.toString())
|
||||
override fun serialize(encoder: Encoder, obj: InputFile) = encoder.encodeString(obj.fileId)
|
||||
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString())
|
||||
}
|
||||
|
||||
// TODO:: add checks for files size
|
||||
/**
|
||||
* Contains info about file for sending
|
||||
*/
|
||||
@Serializable(InputFileSerializer::class)
|
||||
data class MultipartFile (
|
||||
val file: StorageFile,
|
||||
val mimeType: String = file.contentType,
|
||||
val filename: String = file.fileName
|
||||
) : InputFile() {
|
||||
override val fileId: String = file.generateCustomName()
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls
|
||||
import kotlinx.serialization.SerializationStrategy
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
interface SimpleRequest<T: Any> : Request<T> {
|
||||
val requestSerializer: SerializationStrategy<*>
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
inline fun <T: Any, K: SimpleRequest<T>> K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy<K>)
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class AnswerCallbackQuery(
|
||||
@SerialName(callbackQueryIdField)
|
||||
val callbackQueryId: CallbackQueryIdentifier,
|
||||
@SerialName(textField)
|
||||
val text: String? = null,
|
||||
@SerialName(showAlertField)
|
||||
val showAlert: Boolean? = null,
|
||||
@SerialName(urlField)
|
||||
val url: String? = null,
|
||||
@SerialName(cachedTimeField)
|
||||
val cachedTimeSeconds: Int? = null
|
||||
) : SimpleRequest<Boolean> {
|
||||
override fun method(): String = "answerCallbackQuery"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
fun CallbackQuery.createAnswer(
|
||||
text: String? = null,
|
||||
showAlert: Boolean? = null,
|
||||
url: String? = null,
|
||||
cachedTimeSeconds: Int? = null
|
||||
): AnswerCallbackQuery = AnswerCallbackQuery(id, text, showAlert, url, cachedTimeSeconds)
|
||||
|
||||
suspend fun RequestsExecutor.answerCallbackQuery(
|
||||
callbackQueryId: CallbackQueryIdentifier,
|
||||
text: String? = null,
|
||||
showAlert: Boolean? = null,
|
||||
url: String? = null,
|
||||
cachedTimeSeconds: Int? = null
|
||||
) = execute(AnswerCallbackQuery(callbackQueryId, text, showAlert, url, cachedTimeSeconds))
|
||||
|
||||
suspend fun RequestsExecutor.answerCallbackQuery(
|
||||
callbackQuery: CallbackQuery,
|
||||
text: String? = null,
|
||||
showAlert: Boolean? = null,
|
||||
url: String? = null,
|
||||
cachedTimeSeconds: Int? = null
|
||||
) = answerCallbackQuery(callbackQuery.id, text, showAlert, url, cachedTimeSeconds)
|
||||
@@ -1,79 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.ArrayListSerializer
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class AnswerInlineQuery(
|
||||
@SerialName(inlineQueryIdField)
|
||||
val inlineQueryID: InlineQueryIdentifier,
|
||||
@Serializable(InlineQueryAnswersResultsSerializer::class)
|
||||
@SerialName(resultsField)
|
||||
val results: List<InlineQueryResult> = emptyList(),
|
||||
@SerialName(cachedTimeField)
|
||||
val cachedTime: Int? = null,
|
||||
@SerialName(isPersonalField)
|
||||
val isPersonal: Boolean? = null,
|
||||
@SerialName(nextOffsetField)
|
||||
val nextOffset: String? = null,
|
||||
@SerialName(switchPmTextField)
|
||||
val switchPmText: String? = null,
|
||||
@SerialName(switchPmParameterField)
|
||||
val switchPmParameter: String? = null
|
||||
): SimpleRequest<Boolean> {
|
||||
override fun method(): String = "answerInlineQuery"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
fun InlineQuery.createAnswer(
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
switchPmText: String? = null,
|
||||
switchPmParameter: String? = null
|
||||
) = AnswerInlineQuery(
|
||||
id,
|
||||
results,
|
||||
cachedTime,
|
||||
isPersonal,
|
||||
nextOffset,
|
||||
switchPmText,
|
||||
switchPmParameter
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.answerInlineQuery(
|
||||
inlineQueryID: InlineQueryIdentifier,
|
||||
results: List<InlineQueryResult> = emptyList(),
|
||||
cachedTime: Int? = null,
|
||||
isPersonal: Boolean? = null,
|
||||
nextOffset: String? = null,
|
||||
switchPmText: String? = null,
|
||||
switchPmParameter: String? = null
|
||||
) = execute(
|
||||
AnswerInlineQuery(inlineQueryID, results, cachedTime, isPersonal, nextOffset, switchPmText, switchPmParameter)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.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)
|
||||
|
||||
internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ArrayListSerializer(
|
||||
InlineQueryResultSerializer
|
||||
)
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerShippingQuery
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.ArrayListSerializer
|
||||
|
||||
@Serializable
|
||||
data class AnswerShippingQueryOk(
|
||||
@SerialName(shippingQueryIdField)
|
||||
override val shippingQueryId: ShippingQueryIdentifier,
|
||||
@Serializable(ShippingOptionsSerializer::class)
|
||||
@SerialName(shippingOptionsField)
|
||||
val shippingOptions: List<ShippingOption>
|
||||
) : AnswerShippingQuery {
|
||||
@SerialName(okField)
|
||||
override val isOk: Boolean = true
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
internal object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ArrayListSerializer(
|
||||
ShippingOption.serializer()
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class AnswerShippingQueryError(
|
||||
@SerialName(shippingQueryIdField)
|
||||
override val shippingQueryId: ShippingQueryIdentifier,
|
||||
@SerialName(errorMessageField)
|
||||
val error: String
|
||||
) : AnswerShippingQuery {
|
||||
@SerialName(okField)
|
||||
override val isOk: Boolean = false
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
fun ShippingQuery.createAnswerOk(
|
||||
shippingOptions: List<ShippingOption>
|
||||
): AnswerShippingQueryOk = AnswerShippingQueryOk(
|
||||
id,
|
||||
shippingOptions
|
||||
)
|
||||
|
||||
fun ShippingQuery.createAnswerError(
|
||||
error: String
|
||||
): AnswerShippingQueryError = AnswerShippingQueryError(
|
||||
id,
|
||||
error
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.answerShippingQueryOk(
|
||||
id: ShippingQueryIdentifier,
|
||||
shippingOptions: List<ShippingOption>
|
||||
) = execute(AnswerShippingQueryOk(id, shippingOptions))
|
||||
suspend fun RequestsExecutor.answerShippingQueryOk(
|
||||
shippingQuery: ShippingQuery,
|
||||
shippingOptions: List<ShippingOption>
|
||||
) = answerShippingQueryOk(shippingQuery.id, shippingOptions)
|
||||
|
||||
suspend fun RequestsExecutor.answerShippingQueryError(
|
||||
id: ShippingQueryIdentifier,
|
||||
error: String
|
||||
) = execute(AnswerShippingQueryError(id, error))
|
||||
suspend fun RequestsExecutor.answerShippingQueryError(
|
||||
shippingQuery: ShippingQuery,
|
||||
error: String
|
||||
) = answerShippingQueryError(shippingQuery.id, error)
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.PreCheckoutQueryId
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
interface AnswerPreCheckoutQuery : SimpleRequest<Boolean> {
|
||||
override fun method(): String = "answerPreCheckoutQuery"
|
||||
override val resultDeserializer: KSerializer<Boolean>
|
||||
get() = BooleanSerializer
|
||||
|
||||
val preCheckoutQueryId: PreCheckoutQueryId
|
||||
val isOk: Boolean
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ShippingQueryIdentifier
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
interface AnswerShippingQuery : SimpleRequest<Boolean> {
|
||||
override fun method(): String = "answerShippingQuery"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
|
||||
val shippingQueryId: ShippingQueryIdentifier
|
||||
val isOk: Boolean
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.StringSerializer
|
||||
|
||||
@Serializable
|
||||
data class ExportChatInviteLink(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<String> {
|
||||
override fun method(): String = "exportChatInviteLink"
|
||||
override val resultDeserializer: DeserializationStrategy<String>
|
||||
get() = StringSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.exportChatInviteLink(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(ExportChatInviteLink(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.exportChatInviteLink(
|
||||
chat: PublicChat
|
||||
) = exportChatInviteLink(chat.id)
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class LeaveChat(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "leaveChat"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.leaveChat(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(LeaveChat(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.leaveChat(
|
||||
chat: PublicChat
|
||||
) = leaveChat(chat.id)
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||
|
||||
interface ChatMemberRequest<T: Any> : ChatRequest, SimpleRequest<T> {
|
||||
val userId: UserId
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ExtendedChatSerializer
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class GetChat(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<ExtendedChat> {
|
||||
override fun method(): String = "getChat"
|
||||
override val resultDeserializer: DeserializationStrategy<ExtendedChat>
|
||||
get() = ExtendedChatSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChat(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: Chat
|
||||
) = getChat(chat.id)
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.ArrayListSerializer
|
||||
|
||||
private val chatMembersListSerializer = ArrayListSerializer(
|
||||
AdministratorChatMemberSerializerWithoutDeserialization
|
||||
)
|
||||
|
||||
@Serializable
|
||||
data class GetChatAdministrators(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<List<AdministratorChatMember>> {
|
||||
override fun method(): String = "getChatAdministrators"
|
||||
override val resultDeserializer: DeserializationStrategy<List<AdministratorChatMember>>
|
||||
get() = chatMembersListSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.getChatAdministrators(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChatAdministrators(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.getChatAdministrators(
|
||||
chat: PublicChat
|
||||
) = getChatAdministrators(chat.id)
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.IntSerializer
|
||||
|
||||
@Serializable
|
||||
data class GetChatMembersCount(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<Int> {
|
||||
override fun method(): String = "getChatMembersCount"
|
||||
override val resultDeserializer: DeserializationStrategy<Int>
|
||||
get() = IntSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.getChatMembersCount(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChatMembersCount(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.getChatMembersCount(
|
||||
chat: PublicChat
|
||||
) = getChatMembersCount(chat.id)
|
||||
@@ -1,45 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.getChatMembersCount
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMemberDeserializationStrategy
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class GetChatMember(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId
|
||||
) : ChatMemberRequest<ChatMember> {
|
||||
override fun method(): String = "getChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<ChatMember>
|
||||
get() = ChatMemberDeserializationStrategy
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.getChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId
|
||||
) = execute(GetChatMember(chatId, userId))
|
||||
|
||||
suspend fun RequestsExecutor.getChatMember(
|
||||
chat: PublicChat,
|
||||
userId: UserId
|
||||
) = getChatMember(chat.id, userId)
|
||||
|
||||
suspend fun RequestsExecutor.getChatMember(
|
||||
chatId: ChatId,
|
||||
user: User
|
||||
) = getChatMember(chatId, user.id)
|
||||
|
||||
suspend fun RequestsExecutor.getChatMember(
|
||||
chat: PublicChat,
|
||||
user: User
|
||||
) = getChatMember(chat.id, user.id)
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class KickChatMember(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(untilDateField)
|
||||
override val untilDate: TelegramDate? = null
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "kickChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.kickChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null
|
||||
) = execute(KickChatMember(chatId, userId, untilDate))
|
||||
|
||||
suspend fun RequestsExecutor.kickChatMember(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null
|
||||
) = kickChatMember(chat.id, userId, untilDate)
|
||||
|
||||
suspend fun RequestsExecutor.kickChatMember(
|
||||
chatId: ChatId,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null
|
||||
) = kickChatMember(chatId, user.id, untilDate)
|
||||
|
||||
suspend fun RequestsExecutor.kickChatMember(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null
|
||||
) = kickChatMember(chat.id, user.id, untilDate)
|
||||
@@ -1,148 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class PromoteChatMember(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(untilDateField)
|
||||
override val untilDate: TelegramDate? = null,
|
||||
@SerialName(canChangeInfoField)
|
||||
private val canChangeInfo: Boolean? = null,
|
||||
@SerialName(canPostMessagesField)
|
||||
private val canPostMessages: Boolean? = null,
|
||||
@SerialName(canEditMessagesField)
|
||||
private val canEditMessages: Boolean? = null,
|
||||
@SerialName(canDeleteMessagesField)
|
||||
private val canDeleteMessages: Boolean? = null,
|
||||
@SerialName(canInviteUsersField)
|
||||
private val canInviteUsers: Boolean? = null,
|
||||
@SerialName(canRestrictMembersField)
|
||||
private val canRestrictMembers: Boolean? = null,
|
||||
@SerialName(canPinMessagesField)
|
||||
private val canPinMessages: Boolean? = null,
|
||||
@SerialName(canPromoteMembersField)
|
||||
private val canPromoteMembers: Boolean? = null
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "promoteChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.promoteChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
) = execute(
|
||||
PromoteChatMember(
|
||||
chatId,
|
||||
userId,
|
||||
untilDate,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.promoteChatMember(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
) = promoteChatMember(
|
||||
chat.id,
|
||||
userId,
|
||||
untilDate,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.promoteChatMember(
|
||||
chatId: ChatId,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
) = promoteChatMember(
|
||||
chatId,
|
||||
user.id,
|
||||
untilDate,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.promoteChatMember(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
canChangeInfo: Boolean? = null,
|
||||
canPostMessages: Boolean? = null,
|
||||
canEditMessages: Boolean? = null,
|
||||
canDeleteMessages: Boolean? = null,
|
||||
canInviteUsers: Boolean? = null,
|
||||
canRestrictMembers: Boolean? = null,
|
||||
canPinMessages: Boolean? = null,
|
||||
canPromoteMembers: Boolean? = null
|
||||
) = promoteChatMember(
|
||||
chat.id,
|
||||
user.id,
|
||||
untilDate,
|
||||
canChangeInfo,
|
||||
canPostMessages,
|
||||
canEditMessages,
|
||||
canDeleteMessages,
|
||||
canInviteUsers,
|
||||
canRestrictMembers,
|
||||
canPinMessages,
|
||||
canPromoteMembers
|
||||
)
|
||||
@@ -1,58 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class RestrictChatMember(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(untilDateField)
|
||||
override val untilDate: TelegramDate? = null,
|
||||
@SerialName(permissionsField)
|
||||
val permissions: ChatPermissions = ChatPermissions()
|
||||
) : ChatMemberRequest<Boolean>, UntilDate {
|
||||
override fun method(): String = "restrictChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.restrictChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
permissions: ChatPermissions = ChatPermissions()
|
||||
) = execute(RestrictChatMember(chatId, userId, untilDate, permissions))
|
||||
|
||||
suspend fun RequestsExecutor.restrictChatMember(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
untilDate: TelegramDate? = null,
|
||||
permissions: ChatPermissions = ChatPermissions()
|
||||
) = restrictChatMember(chat.id, userId, untilDate, permissions)
|
||||
|
||||
suspend fun RequestsExecutor.restrictChatMember(
|
||||
chatId: ChatId,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
permissions: ChatPermissions = ChatPermissions()
|
||||
) = restrictChatMember(chatId, user.id, untilDate, permissions)
|
||||
|
||||
suspend fun RequestsExecutor.restrictChatMember(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
untilDate: TelegramDate? = null,
|
||||
permissions: ChatPermissions = ChatPermissions()
|
||||
) = restrictChatMember(chat.id, user.id, untilDate, permissions)
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
/**
|
||||
* Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle
|
||||
*
|
||||
* Please, remember about restrictions for characters in custom title
|
||||
*/
|
||||
@Serializable
|
||||
data class SetChatAdministratorCustomTitle(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId,
|
||||
@SerialName(customTitleField)
|
||||
val customTitle: String
|
||||
) : ChatMemberRequest<Boolean> {
|
||||
override fun method(): String = "setChatAdministratorCustomTitle"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = RestrictChatMember.serializer()
|
||||
|
||||
init {
|
||||
if (customTitle.length !in customTitleLength) {
|
||||
throw IllegalArgumentException("Custom title length must be in range $customTitleLength, but was ${customTitle.length}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||
chatId: ChatId,
|
||||
userId: UserId,
|
||||
customTitle: String
|
||||
) = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
|
||||
|
||||
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||
chat: PublicChat,
|
||||
userId: UserId,
|
||||
customTitle: String
|
||||
) = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
|
||||
|
||||
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||
chatId: ChatId,
|
||||
user: User,
|
||||
customTitle: String
|
||||
) = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
|
||||
|
||||
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
|
||||
chat: PublicChat,
|
||||
user: User,
|
||||
customTitle: String
|
||||
) = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class UnbanChatMember(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(userIdField)
|
||||
override val userId: UserId
|
||||
) : ChatMemberRequest<Boolean> {
|
||||
override fun method(): String = "unbanChatMember"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.unbanChatMember(
|
||||
chatId: ChatIdentifier,
|
||||
userId: UserId
|
||||
) = execute(UnbanChatMember(chatId, userId))
|
||||
|
||||
suspend fun RequestsExecutor.unbanChatMember(
|
||||
chat: PublicChat,
|
||||
userId: UserId
|
||||
) = unbanChatMember(chat.id, userId)
|
||||
|
||||
suspend fun RequestsExecutor.unbanChatMember(
|
||||
chatId: ChatId,
|
||||
user: User
|
||||
) = unbanChatMember(chatId, user.id)
|
||||
|
||||
suspend fun RequestsExecutor.unbanChatMember(
|
||||
chat: PublicChat,
|
||||
user: User
|
||||
) = unbanChatMember(chat.id, user.id)
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.GetChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class DeleteChatPhoto(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "deleteChatPhoto"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatPhoto(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(DeleteChatPhoto(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatPhoto(
|
||||
chat: PublicChat
|
||||
) = deleteChatPhoto(chat.id)
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class PinChatMessage (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(disableNotificationField)
|
||||
override val disableNotification: Boolean = false
|
||||
): ChatRequest, SimpleRequest<Boolean>, MessageAction, DisableNotification {
|
||||
override fun method(): String = "pinChatMessage"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.pinChatMessage(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
disableNotification: Boolean = false
|
||||
) = execute(PinChatMessage(chatId, messageId, disableNotification))
|
||||
|
||||
suspend fun RequestsExecutor.pinChatMessage(
|
||||
chat: PublicChat,
|
||||
messageId: MessageIdentifier,
|
||||
disableNotification: Boolean = false
|
||||
) = pinChatMessage(chat.id, messageId, disableNotification)
|
||||
|
||||
suspend fun RequestsExecutor.pinChatMessage(
|
||||
message: Message,
|
||||
disableNotification: Boolean = false
|
||||
) = if (message.chat is PublicChat) {
|
||||
pinChatMessage(message.chat.id, message.messageId, disableNotification)
|
||||
} else {
|
||||
error("It is possible to pin messages only in non one-to-one chats")
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class SetChatDescription (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(descriptionField)
|
||||
val description: String
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
init {
|
||||
if (description.length !in chatDescriptionLength) {
|
||||
throw IllegalArgumentException("Chat description must be in $chatDescriptionLength range")
|
||||
}
|
||||
}
|
||||
|
||||
override fun method(): String = "setChatDescription"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.setChatDescription(
|
||||
chatId: ChatIdentifier,
|
||||
description: String
|
||||
) = execute(SetChatDescription(chatId, description))
|
||||
|
||||
suspend fun RequestsExecutor.setChatDescription(
|
||||
chat: PublicChat,
|
||||
description: String
|
||||
) = setChatDescription(chat.id, description)
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class SetChatPermissions (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(permissionsField)
|
||||
val permissions: ChatPermissions
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "setChatPermissions"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.setDefaultChatMembersPermissions(
|
||||
chatId: ChatIdentifier,
|
||||
permissions: ChatPermissions
|
||||
) = execute(SetChatPermissions(chatId, permissions))
|
||||
|
||||
suspend fun RequestsExecutor.setDefaultChatMembersPermissions(
|
||||
chat: PublicChat,
|
||||
permissions: ChatPermissions
|
||||
) = setDefaultChatMembersPermissions(chat.id, permissions)
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
import kotlinx.serialization.json.JsonObject
|
||||
|
||||
@Serializable
|
||||
data class SetChatPhoto (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
val photo: MultipartFile = throw IllegalArgumentException("Unfortunately, this type of objects can't be parsed automatically")
|
||||
): ChatRequest, MultipartRequest<Boolean> {
|
||||
override fun method(): String = "setChatPhoto"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val mediaMap: Map<String, MultipartFile> = mapOf(photoField to photo)
|
||||
override val paramsJson: JsonObject = toJson(serializer())
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.setChatPhoto(
|
||||
chatId: ChatIdentifier,
|
||||
photo: MultipartFile
|
||||
) = execute(SetChatPhoto(chatId, photo))
|
||||
|
||||
suspend fun RequestsExecutor.setChatPhoto(
|
||||
chat: PublicChat,
|
||||
photo: MultipartFile
|
||||
) = setChatPhoto(chat.id, photo)
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class SetChatTitle (
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(titleField)
|
||||
val title: String
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
init {
|
||||
if (title.length !in chatTitleLength) {
|
||||
throw IllegalArgumentException("Chat title must be in $chatTitleLength range")
|
||||
}
|
||||
}
|
||||
|
||||
override fun method(): String = "setChatTitle"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.setChatTitle(
|
||||
chatId: ChatIdentifier,
|
||||
title: String
|
||||
) = execute(SetChatTitle(chatId, title))
|
||||
|
||||
suspend fun RequestsExecutor.setChatTitle(
|
||||
chat: PublicChat,
|
||||
title: String
|
||||
) = setChatTitle(chat.id, title)
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class UnpinChatMessage(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "unpinChatMessage"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.unpinChatMessage(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(UnpinChatMessage(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.unpinChatMessage(
|
||||
chat: PublicChat
|
||||
) = unpinChatMessage(chat.id)
|
||||
@@ -1,31 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.DeleteChatPhoto
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class DeleteChatStickerSet(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "deleteChatStickerSet"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatStickerSet(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(DeleteChatStickerSet(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatStickerSet(
|
||||
chat: SupergroupChat
|
||||
) = deleteChatStickerSet(chat.id)
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.*
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
@Serializable
|
||||
data class SetChatStickerSet(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(stickerSetNameField)
|
||||
val stickerSetName: StickerSetName
|
||||
): ChatRequest, SimpleRequest<Boolean> {
|
||||
override fun method(): String = "setChatStickerSet"
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.setChatStickerSet(
|
||||
chatId: ChatIdentifier,
|
||||
stickerSetName: StickerSetName
|
||||
) = execute(SetChatStickerSet(chatId, stickerSetName))
|
||||
|
||||
suspend fun RequestsExecutor.setChatStickerSet(
|
||||
chat: SupergroupChat,
|
||||
stickerSetName: StickerSetName
|
||||
) = setChatStickerSet(chat.id, stickerSetName)
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||
import kotlinx.serialization.*
|
||||
|
||||
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
|
||||
|
||||
@Serializable
|
||||
data class EditChatMessageLiveLocation(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(latitudeField)
|
||||
override val latitude: Double,
|
||||
@SerialName(longitudeField)
|
||||
override val longitude: Double,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditChatMessage<LocationContent>, EditReplyMessage, EditLocationMessage {
|
||||
override fun method(): String = "editMessageLiveLocation"
|
||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
|
||||
get() = commonResultDeserializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
EditChatMessageLiveLocation(
|
||||
chatId, messageId, latitude, longitude, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editLiveLocation(chat.id, messageId, latitude, longitude, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
message: ContentMessage<LocationContent>,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editLiveLocation(message.chat, message.messageId, latitude, longitude, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
location: Location,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
EditChatMessageLiveLocation(
|
||||
chatId, messageId, location.latitude, location.longitude, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
location: Location,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editLiveLocation(chat.id, messageId, location.latitude, location.longitude, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
message: ContentMessage<LocationContent>,
|
||||
location: Location,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editLiveLocation(message.chat, message.messageId, location.latitude, location.longitude, replyMarkup)
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class EditInlineMessageLiveLocation(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
@SerialName(latitudeField)
|
||||
override val latitude: Double,
|
||||
@SerialName(longitudeField)
|
||||
override val longitude: Double,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditInlineMessage, EditReplyMessage, EditLocationMessage {
|
||||
override fun method(): String = "editMessageLiveLocation"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
EditInlineMessageLiveLocation(
|
||||
inlineMessageId, latitude, longitude, replyMarkup
|
||||
)
|
||||
)
|
||||
suspend fun RequestsExecutor.editLiveLocation(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
location: Location,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editLiveLocation(inlineMessageId, location.latitude, location.longitude, replyMarkup)
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
|
||||
import kotlinx.serialization.*
|
||||
|
||||
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<LocationContent>>()
|
||||
|
||||
@Serializable
|
||||
data class StopChatMessageLiveLocation(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditChatMessage<LocationContent>, EditReplyMessage {
|
||||
override fun method(): String = "stopMessageLiveLocation"
|
||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
|
||||
get() = commonResultDeserializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
|
||||
suspend fun RequestsExecutor.stopLiveLocation(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
StopChatMessageLiveLocation(
|
||||
chatId, messageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.stopLiveLocation(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopLiveLocation(chat.id, messageId, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.stopLiveLocation(
|
||||
message: ContentMessage<LocationContent>,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = stopLiveLocation(message.chat, message.messageId, replyMarkup)
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class StopInlineMessageLiveLocation(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditInlineMessage, EditReplyMessage {
|
||||
override fun method(): String = "stopMessageLiveLocation"
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.stopLiveLocation(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
StopInlineMessageLiveLocation(
|
||||
inlineMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.EditChatMessageMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||
import kotlinx.serialization.*
|
||||
|
||||
const val editMessageReplyMarkupMethod = "editMessageReplyMarkup"
|
||||
|
||||
private val commonResultDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<ContentMessage<MessageContent>>()
|
||||
|
||||
@Serializable
|
||||
data class EditChatMessageReplyMarkup(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditChatMessage<MessageContent>, EditReplyMessage {
|
||||
|
||||
override fun method(): String = editMessageReplyMarkupMethod
|
||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<MessageContent>>
|
||||
get() = commonResultDeserializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
EditChatMessageReplyMarkup(chatId, messageId, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageReplyMarkup(chat.id, messageId, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||
message: Message,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageReplyMarkup(message.chat.id, message.messageId, replyMarkup)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.EditInlineMessageMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import kotlinx.serialization.*
|
||||
|
||||
@Serializable
|
||||
data class EditInlineMessageReplyMarkup(
|
||||
@SerialName(inlineMessageIdField)
|
||||
override val inlineMessageId: InlineMessageIdentifier,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditInlineMessage, EditReplyMessage {
|
||||
override fun method(): String = editMessageReplyMarkupMethod
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||
|
||||
interface EditChatMessage<MT: MessageContent> : SimpleRequest<ContentMessage<MT>>, MessageAction
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
import kotlinx.serialization.DeserializationStrategy
|
||||
import kotlinx.serialization.internal.BooleanSerializer
|
||||
|
||||
interface EditInlineMessage : SimpleRequest<Boolean> {
|
||||
val inlineMessageId: InlineMessageIdentifier
|
||||
override val resultDeserializer: DeserializationStrategy<Boolean>
|
||||
get() = BooleanSerializer
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
||||
|
||||
interface EditLocationMessage {
|
||||
val latitude: Double
|
||||
val longitude: Double
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||
|
||||
interface EditMediaMessage {
|
||||
val media: InputMedia
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
interface EditReplyMessage : ReplyMarkup {
|
||||
override val replyMarkup: InlineKeyboardMarkup?
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
|
||||
interface EditTextChatMessage {
|
||||
val text: String
|
||||
val parseMode: ParseMode?
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.MediaContentMessageResultDeserializer
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text.EditChatMessageText
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.CommonMessageImpl
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent
|
||||
import kotlinx.serialization.*
|
||||
|
||||
const val editMessageCaptionMethod = "editMessageCaption"
|
||||
|
||||
@Serializable
|
||||
data class EditChatMessageCaption(
|
||||
@SerialName(chatIdField)
|
||||
override val chatId: ChatIdentifier,
|
||||
@SerialName(messageIdField)
|
||||
override val messageId: MessageIdentifier,
|
||||
@SerialName(captionField)
|
||||
override val text: String,
|
||||
@SerialName(parseModeField)
|
||||
override val parseMode: ParseMode? = null,
|
||||
@SerialName(replyMarkupField)
|
||||
override val replyMarkup: InlineKeyboardMarkup? = null
|
||||
) : EditChatMessage<MediaContent>, EditTextChatMessage, EditReplyMessage {
|
||||
|
||||
override fun method(): String = editMessageCaptionMethod
|
||||
override val resultDeserializer: DeserializationStrategy<ContentMessage<MediaContent>>
|
||||
get() = MediaContentMessageResultDeserializer
|
||||
override val requestSerializer: SerializationStrategy<*>
|
||||
get() = serializer()
|
||||
}
|
||||
|
||||
suspend fun RequestsExecutor.editMessageCaption(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
EditChatMessageCaption(chatId, messageId, text, parseMode, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.editMessageCaption(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageCaption(chat.id, messageId, text, parseMode, replyMarkup)
|
||||
|
||||
suspend fun <T> RequestsExecutor.editMessageCaption(
|
||||
message: ContentMessage<T>,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
|
||||
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user