mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-11-16 12:00:18 +00:00
Compare commits
1235 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 682f696866 | |||
| 87fff2e5d0 | |||
| 92b4ba2ff0 | |||
| 9014cdbc99 | |||
| 37317a1055 | |||
| 60c21002e1 | |||
| 78a7a3546a | |||
| 4799617ced | |||
| c70484076d | |||
| 0c92e6eeb4 | |||
| 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 |
4
.github/FUNDING.yml
vendored
4
.github/FUNDING.yml
vendored
@@ -1,5 +1,3 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
patreon: InsanusMokrassar
|
||||
|
||||
custom: ['https://paypal.me/InsanusMokrassar?locale.x=ru_RU']
|
||||
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 }}
|
||||
1
.github/write-good.yml
vendored
1
.github/write-good.yml
vendored
@@ -1 +0,0 @@
|
||||
spellchecker: true
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -8,3 +8,7 @@ settings.xml
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
|
||||
local.properties
|
||||
kotlin-js-store/
|
||||
secret.gradle
|
||||
|
||||
11
.travis.yml
11
.travis.yml
@@ -5,6 +5,11 @@ os: linux
|
||||
dist: trusty
|
||||
jdk: oraclejdk8
|
||||
|
||||
script:
|
||||
- ./gradlew build -s
|
||||
|
||||
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
|
||||
|
||||
2101
CHANGELOG.md
2101
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:)
|
||||
130
README.md
130
README.md
@@ -1,35 +1,111 @@
|
||||
# TelegramBotAPI
|
||||
# TelegramBotAPI [](https://maven-badges.herokuapp.com/maven-central/dev.inmo/tgbotapi) [](https://core.telegram.org/bots/api-changelog#april-16-2022)
|
||||
|
||||
| Common info | [](https://github.com/KotlinBy/awesome-kotlin) [](https://t.me/InMoTelegramBotAPI) [](https://travis-ci.com/InsanusMokrassar/TelegramBotAPI) |
|
||||
| -------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
||||
| TelegramBotAPI status | [](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion) [](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI) |
|
||||
| TelegramBotAPI Extensions status | [](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-api/_latestVersion) [](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-api) |
|
||||
| TelegramBotAPI Util Extensions status | [](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils/_latestVersion) [](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-utils) |
|
||||
| [](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) |
|
||||
|
||||
It is a complex of libraries for working with `TelegramBotAPI` in type-safe and strict way as much as it possible. In
|
||||
the list of this complex currently next projects:
|
||||
Hello! This is a set of libraries for working with Telegram Bot API.
|
||||
|
||||
* [TelegramBotAPI](TelegramBotAPI/README.md) - core of library. In fact it is independent library and can be used alone
|
||||
without any additional library
|
||||
* [TelegramBotAPI Extensions](TelegramBotAPI-extensions-api/README.md) - contains extensions (mostly for
|
||||
`RequestsExecutor`), which allows to use the core library in more pleasant way
|
||||
* [TelegramBotAPI Util Extensions](TelegramBotAPI-extensions-utils/README.md) - contains extensions for more comfortable
|
||||
work with commands, updates and other different things
|
||||
## Examples
|
||||
|
||||
Most part of some specific solves or unuseful
|
||||
moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api).
|
||||
There are several things you need to do to launch examples below:
|
||||
|
||||
## Ok, where should I start?
|
||||
* 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)
|
||||
|
||||
In most cases, the most simple way will be to implement
|
||||
[TelegramBotAPI Extensions](TelegramBotAPI-extensions-api/README.md) and
|
||||
[TelegramBotAPI Util Extensions](TelegramBotAPI-extensions-utils/README.md) for the reason that they contains more
|
||||
simple tools. If you want to dive deeper in the core of library or develop something for it - welcome to
|
||||
[TelegramBotAPI](TelegramBotAPI/README.md).
|
||||
More including instructions [available here](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Including-in-your-project).
|
||||
Other configuration examples:
|
||||
|
||||
Anyway, all libraries are very typical inside of them. Examples:
|
||||
* [For multiplatform](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/tree/master/ResenderBot)
|
||||
* [For JVM](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/blob/master/GetMeBot/build.gradle)
|
||||
|
||||
* In `TelegramBotAPI` common request look like `requestsExecutor.execute(SomeRequest())`
|
||||
* `TelegramBotAPI-extensions-api` typical syntax look like `requestsExecutor.someRequest()` (in most cases it would be
|
||||
better to understand to use `bot` name instead of `requestsExecutor`)
|
||||
* `TelegramBotAPI-extensions-utils` will look like `filter.filterBaseMessageUpdates(chatId).filterExactCommands(Regex("^.*$"))...`
|
||||
### Most common example
|
||||
|
||||
```kotlin
|
||||
suspend fun main() {
|
||||
val bot = telegramBot(TOKEN)
|
||||
|
||||
bot.buildBehaviourWithLongPolling {
|
||||
println(getMe())
|
||||
|
||||
onCommand("start") {
|
||||
reply(it, "Hi:)")
|
||||
}
|
||||
}.join()
|
||||
}
|
||||
```
|
||||
|
||||
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`
|
||||
|
||||
### 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()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
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)
|
||||
|
||||
### Build a little bit more complex behaviour
|
||||
|
||||
```kotlin
|
||||
suspend fun main() {
|
||||
val bot = telegramBot(TOKEN)
|
||||
|
||||
bot.buildBehaviourWithLongPolling {
|
||||
println(getMe())
|
||||
|
||||
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,48 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||
}
|
||||
|
||||
project.version = "$library_version"
|
||||
project.group = "$library_group"
|
||||
|
||||
apply from: "publish.gradle"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||
api "${project.group}:TelegramBotAPI:$library_version"
|
||||
} else {
|
||||
implementation project(":TelegramBotAPI")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 "API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference"
|
||||
name "Telegram Bot API Extensions for 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 Extensions for API","description":"API extensions which provide work with RequestsExecutor of TelegramBotAPI almost like it is described in original Telegram Bot API reference","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
||||
@@ -1,55 +0,0 @@
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
apply from: "maven.publish.gradle"
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
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')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload.doFirst {
|
||||
publications = publishing.publications.collect {
|
||||
if (it.name.contains('kotlinMultiplatform')) {
|
||||
null
|
||||
} else {
|
||||
it.name
|
||||
}
|
||||
} - null
|
||||
}
|
||||
|
||||
bintrayUpload.dependsOn publishToMavenLocal
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.DeleteMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
|
||||
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,50 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.ForwardMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
|
||||
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,10 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.getMe
|
||||
|
||||
@Deprecated(
|
||||
"Replaced",
|
||||
ReplaceWith("getMe", "com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.GetMeKt.getMe")
|
||||
)
|
||||
suspend fun RequestsExecutor.getMe() = getMe()
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.LiveLocation.editLiveLocation
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.LiveLocation.stopLiveLocation
|
||||
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.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
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,34 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.StopPoll
|
||||
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
|
||||
|
||||
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,22 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.answers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.AnswerCallbackQuery
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQueryIdentifier
|
||||
|
||||
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,29 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.answers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.AnswerInlineQuery
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueryIdentifier
|
||||
|
||||
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)
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.answers.payments
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.AnswerPreCheckoutQueryError
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.AnswerPreCheckoutQueryOk
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.PreCheckoutQueryId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery
|
||||
|
||||
suspend fun RequestsExecutor.answerPreCheckoutQueryOk(
|
||||
id: PreCheckoutQueryId
|
||||
) = execute(AnswerPreCheckoutQueryOk(id))
|
||||
suspend fun RequestsExecutor.answerPreCheckoutQueryOk(
|
||||
preCheckoutQuery: PreCheckoutQuery
|
||||
) = answerPreCheckoutQueryOk(preCheckoutQuery.id)
|
||||
|
||||
suspend fun RequestsExecutor.answerPreCheckoutQueryError(
|
||||
id: PreCheckoutQueryId,
|
||||
error: String
|
||||
) = execute(AnswerPreCheckoutQueryError(id, error))
|
||||
suspend fun RequestsExecutor.answerPreCheckoutQueryError(
|
||||
preCheckoutQuery: PreCheckoutQuery,
|
||||
error: String
|
||||
) = answerPreCheckoutQueryError(preCheckoutQuery.id, error)
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.answers.payments
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.AnswerShippingQueryError
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.AnswerShippingQueryOk
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ShippingQueryIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery
|
||||
|
||||
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,6 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMe
|
||||
|
||||
suspend fun RequestsExecutor.getMe() = execute(GetMe)
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMyCommands
|
||||
|
||||
suspend fun RequestsExecutor.getMyCommands() = execute(GetMyCommands)
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.bot.SetMyCommands
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.BotCommand
|
||||
|
||||
suspend fun RequestsExecutor.setMyCommands(
|
||||
commands: List<BotCommand>
|
||||
) = execute(SetMyCommands(commands))
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.ExportChatInviteLink
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
suspend fun RequestsExecutor.exportChatInviteLink(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(ExportChatInviteLink(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.exportChatInviteLink(
|
||||
chat: PublicChat
|
||||
) = exportChatInviteLink(chat.id)
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.LeaveChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
suspend fun RequestsExecutor.leaveChat(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(LeaveChat(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.leaveChat(
|
||||
chat: PublicChat
|
||||
) = leaveChat(chat.id)
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
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
|
||||
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChat(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.getChat(
|
||||
chat: Chat
|
||||
) = getChat(chat.id)
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.GetChatAdministrators
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
suspend fun RequestsExecutor.getChatAdministrators(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChatAdministrators(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.getChatAdministrators(
|
||||
chat: PublicChat
|
||||
) = getChatAdministrators(chat.id)
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get.GetChatMembersCount
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
suspend fun RequestsExecutor.getChatMembersCount(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(GetChatMembersCount(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.getChatMembersCount(
|
||||
chat: PublicChat
|
||||
) = getChatMembersCount(chat.id)
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members.GetChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,30 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members.KickChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,30 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members.SetChatAdministratorCustomTitle
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,27 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.members
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members.UnbanChatMember
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.DeleteChatPhoto
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatPhoto(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(DeleteChatPhoto(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatPhoto(
|
||||
chat: PublicChat
|
||||
) = deleteChatPhoto(chat.id)
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.PinChatMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
|
||||
|
||||
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,16 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.SetChatDescription
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,17 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.SetChatPermissions
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,17 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.SetChatPhoto
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,16 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.SetChatTitle
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
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,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.modify
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify.UnpinChatMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
|
||||
|
||||
suspend fun RequestsExecutor.unpinChatMessage(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(UnpinChatMessage(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.unpinChatMessage(
|
||||
chat: PublicChat
|
||||
) = unpinChatMessage(chat.id)
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers.DeleteChatStickerSet
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatStickerSet(
|
||||
chatId: ChatIdentifier
|
||||
) = execute(DeleteChatStickerSet(chatId))
|
||||
|
||||
suspend fun RequestsExecutor.deleteChatStickerSet(
|
||||
chat: SupergroupChat
|
||||
) = deleteChatStickerSet(chat.id)
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.chat.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers.SetChatStickerSet
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.StickerSetName
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
|
||||
|
||||
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,60 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.EditChatMessageLiveLocation
|
||||
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.content.LocationContent
|
||||
|
||||
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,23 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.EditInlineMessageLiveLocation
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.Location
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
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,31 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.StopChatMessageLiveLocation
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
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.content.LocationContent
|
||||
|
||||
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,15 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.LiveLocation
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation.StopInlineMessageLiveLocation
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
suspend fun RequestsExecutor.stopLiveLocation(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
StopInlineMessageLiveLocation(
|
||||
inlineMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.ReplyMarkup
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup.EditChatMessageReplyMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
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
|
||||
|
||||
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,11 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.ReplyMarkup
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup.EditInlineMessageReplyMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
suspend fun RequestsExecutor.editMessageReplyMarkup(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageReplyMarkup(inlineMessageId, replyMarkup))
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.caption
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption.EditChatMessageCaption
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
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.content.abstracts.MediaContent
|
||||
|
||||
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)
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.caption
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption.EditInlineMessageCaption
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
suspend fun RequestsExecutor.editMessageCaption(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup))
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.EditChatMessageMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
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.content.abstracts.MediaContent
|
||||
|
||||
suspend fun RequestsExecutor.editMessageMedia(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
media: InputMedia,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
EditChatMessageMedia(chatId, messageId, media, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.editMessageMedia(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
media: InputMedia,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageMedia(chat.id, messageId, media, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.editMessageMedia(
|
||||
message: ContentMessage<out MediaContent>,
|
||||
media: InputMedia,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageMedia(message.chat.id, message.messageId, media, replyMarkup)
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.EditInlineMessageMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
suspend fun RequestsExecutor.editMessageCaption(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
media: InputMedia,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.text
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text.EditChatMessageText
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
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.content.TextContent
|
||||
|
||||
suspend fun RequestsExecutor.editMessageText(
|
||||
chatId: ChatIdentifier,
|
||||
messageId: MessageIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
EditChatMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.editMessageText(
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||
|
||||
suspend fun RequestsExecutor.editMessageText(
|
||||
message: ContentMessage<TextContent>,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.edit.text
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text.EditInlineMessageText
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
|
||||
suspend fun RequestsExecutor.editMessageText(
|
||||
inlineMessageId: InlineMessageIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(EditInlineMessageText(inlineMessageId, text, parseMode, disableWebPagePreview, replyMarkup))
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.games
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.GetGameHighScoresByChat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
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.GameContent
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
userId: UserId,
|
||||
chatId: ChatId,
|
||||
messageId: MessageIdentifier
|
||||
) = execute(
|
||||
GetGameHighScoresByChat(userId, chatId, messageId)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
user: CommonUser,
|
||||
chatId: ChatId,
|
||||
messageId: MessageIdentifier
|
||||
) = getGameScore(
|
||||
user.id, chatId, messageId
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
userId: UserId,
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier
|
||||
) = getGameScore(
|
||||
userId, chat.id, messageId
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
user: CommonUser,
|
||||
chat: Chat,
|
||||
messageId: MessageIdentifier
|
||||
) = getGameScore(
|
||||
user.id, chat.id, messageId
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
userId: UserId,
|
||||
message: ContentMessage<GameContent>
|
||||
) = getGameScore(
|
||||
userId, message.chat.id, message.messageId
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
user: CommonUser,
|
||||
message: ContentMessage<GameContent>
|
||||
) = getGameScore(
|
||||
user.id, message.chat.id, message.messageId
|
||||
)
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.games
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.GetGameHighScoresByInlineMessageId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
userId: UserId,
|
||||
inlineMessageId: InlineMessageIdentifier
|
||||
) = execute(
|
||||
GetGameHighScoresByInlineMessageId(
|
||||
userId, inlineMessageId
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getGameScore(
|
||||
user: CommonUser,
|
||||
inlineMessageId: InlineMessageIdentifier
|
||||
) = getGameScore(user.id, inlineMessageId)
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.get.GetFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
|
||||
|
||||
suspend fun RequestsExecutor.getFileAdditionalInfo(
|
||||
fileId: FileId
|
||||
) = execute(
|
||||
GetFile(fileId)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getFileAdditionalInfo(
|
||||
file: TelegramMediaFile
|
||||
) = getFileAdditionalInfo(file.fileId)
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.get.GetStickerSet
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||
|
||||
suspend fun RequestsExecutor.getStickerSet(
|
||||
name: String
|
||||
) = execute(
|
||||
GetStickerSet(name)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getStickerSet(
|
||||
sticker: Sticker
|
||||
) = getStickerSet(
|
||||
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
|
||||
)
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.get
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.get.GetUserProfilePhotos
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||
|
||||
suspend fun RequestsExecutor.getUserProfilePhotos(
|
||||
userId: UserId,
|
||||
offset: Int? = null,
|
||||
limit: Int? = null
|
||||
) = execute(
|
||||
GetUserProfilePhotos(
|
||||
userId, offset, limit
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.getUserProfilePhotos(
|
||||
user: CommonUser,
|
||||
offset: Int? = null,
|
||||
limit: Int? = null
|
||||
) = getUserProfilePhotos(user.id, offset, limit)
|
||||
@@ -1,102 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendAction
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.actions.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
|
||||
suspend fun RequestsExecutor.sendBotAction(
|
||||
chatId: ChatIdentifier,
|
||||
action: BotAction
|
||||
) = execute(
|
||||
SendAction(chatId, action)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendBotAction(
|
||||
chat: Chat,
|
||||
action: BotAction
|
||||
) = sendBotAction(chat.id, action)
|
||||
|
||||
|
||||
suspend fun RequestsExecutor.sendActionTyping(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, TypingAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadPhoto(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, UploadPhotoAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionRecordVideo(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, RecordVideoAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadVideo(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, UploadVideoAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionRecordAudio(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, RecordAudioAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadAudio(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, UploadAudioAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadDocument(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, UploadDocumentAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionFindLocation(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, FindLocationAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionRecordVideoNote(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, RecordVideoNoteAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadVideoNote(
|
||||
chatId: ChatIdentifier
|
||||
) = sendBotAction(chatId, UploadVideoNoteAction)
|
||||
|
||||
|
||||
suspend fun RequestsExecutor.sendActionTyping(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, TypingAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadPhoto(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, UploadPhotoAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionRecordVideo(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, RecordVideoAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadVideo(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, UploadVideoAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionRecordAudio(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, RecordAudioAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadAudio(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, UploadAudioAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadDocument(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, UploadDocumentAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionFindLocation(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, FindLocationAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionRecordVideoNote(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, RecordVideoNoteAction)
|
||||
|
||||
suspend fun RequestsExecutor.sendActionUploadVideoNote(
|
||||
chat: Chat
|
||||
) = sendBotAction(chat, UploadVideoNoteAction)
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendContact
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
|
||||
suspend fun RequestsExecutor.sendContact(
|
||||
chatId: ChatIdentifier,
|
||||
phoneNumber: String,
|
||||
firstName: String,
|
||||
lastName: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendContact(
|
||||
chatId, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendContact(
|
||||
chatId: ChatIdentifier,
|
||||
contact: Contact,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendContact(
|
||||
chatId, contact, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendContact(
|
||||
chat: Chat,
|
||||
phoneNumber: String,
|
||||
firstName: String,
|
||||
lastName: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendContact(
|
||||
chat.id, phoneNumber, firstName, lastName, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendContact(
|
||||
chat: Chat,
|
||||
contact: Contact,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendContact(
|
||||
chat.id, contact, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendDice
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
|
||||
suspend fun RequestsExecutor.sendDice(
|
||||
chatId: ChatIdentifier,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendDice(chatId, disableNotification, replyToMessageId, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendDice(
|
||||
chat: Chat,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendDice(chat.id, disableNotification, replyToMessageId, replyMarkup)
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendLocation
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
|
||||
suspend fun RequestsExecutor.sendLocation(
|
||||
chatId: ChatIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendLocation(
|
||||
chatId,
|
||||
latitude,
|
||||
longitude,
|
||||
disableNotification = disableNotification,
|
||||
replyToMessageId = replyToMessageId,
|
||||
replyMarkup = replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendLocation(
|
||||
chatId: ChatIdentifier,
|
||||
location: Location,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendLocation(
|
||||
chatId,
|
||||
location.latitude,
|
||||
location.longitude,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendLocation(
|
||||
chat: Chat,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendLocation(
|
||||
chat.id,
|
||||
latitude,
|
||||
longitude,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendLocation(
|
||||
chat: Chat,
|
||||
location: Location,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendLocation(
|
||||
chat.id,
|
||||
location.latitude,
|
||||
location.longitude,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendTextMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
|
||||
suspend fun RequestsExecutor.sendMessage(
|
||||
chatId: ChatIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendTextMessage(chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendTextMessage(
|
||||
chatId: ChatIdentifier,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendMessage(
|
||||
chatId, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendMessage(
|
||||
chat: Chat,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup)
|
||||
|
||||
|
||||
suspend fun RequestsExecutor.sendTextMessage(
|
||||
chat: Chat,
|
||||
text: String,
|
||||
parseMode: ParseMode? = null,
|
||||
disableWebPagePreview: Boolean? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendTextMessage(chat.id, text, parseMode, disableWebPagePreview, disableNotification, replyToMessageId, replyMarkup)
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.SendVenue
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
|
||||
suspend fun RequestsExecutor.sendVenue(
|
||||
chatId: ChatIdentifier,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
title: String,
|
||||
address: String,
|
||||
foursquareId: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendVenue(
|
||||
chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendVenue(
|
||||
chat: Chat,
|
||||
latitude: Double,
|
||||
longitude: Double,
|
||||
title: String,
|
||||
address: String,
|
||||
foursquareId: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVenue(
|
||||
chat.id, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendVenue(
|
||||
chatId: ChatIdentifier,
|
||||
venue: Venue,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendVenue(
|
||||
chatId, venue, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendVenue(
|
||||
chat: Chat,
|
||||
venue: Venue,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVenue(
|
||||
chat.id, venue, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.games
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.games.SendGame
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game
|
||||
|
||||
suspend fun RequestsExecutor.sendGame(
|
||||
chatId: ChatIdentifier,
|
||||
gameShortName: String,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendGame(
|
||||
chatId, gameShortName, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendGame(
|
||||
chat: Chat,
|
||||
gameShortName: String,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendGame(
|
||||
chat.id, gameShortName, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendGame(
|
||||
chatId: ChatIdentifier,
|
||||
game: Game,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendGame(
|
||||
chatId, game.title, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendGame(
|
||||
chat: Chat,
|
||||
game: Game,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendGame(
|
||||
chat.id, game.title, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
|
||||
|
||||
suspend fun RequestsExecutor.sendAnimation(
|
||||
chatId: ChatIdentifier,
|
||||
animation: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendAnimation(
|
||||
chatId,
|
||||
animation,
|
||||
thumb,
|
||||
text,
|
||||
parseMode,
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendAnimation(
|
||||
chatId: ChatIdentifier,
|
||||
animation: AnimationFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendAnimation(
|
||||
chatId, animation.fileId, animation.thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
||||
|
||||
suspend fun RequestsExecutor.sendAudio(
|
||||
chatId: ChatIdentifier,
|
||||
audio: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
performer: String? = null,
|
||||
title: String? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendAudio(
|
||||
chatId,
|
||||
audio,
|
||||
thumb,
|
||||
text,
|
||||
parseMode,
|
||||
duration,
|
||||
performer,
|
||||
title,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendAudio(
|
||||
chatId: ChatIdentifier,
|
||||
audio: AudioFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
title: String? = audio.title,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendAudio(
|
||||
chatId, audio.fileId, audio.thumb ?.fileId, text, parseMode, audio.duration, audio.performer, title, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
|
||||
|
||||
suspend fun RequestsExecutor.sendDocument(
|
||||
chatId: ChatIdentifier,
|
||||
document: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendDocument(
|
||||
chatId,
|
||||
document,
|
||||
thumb,
|
||||
text,
|
||||
parseMode,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendDocument(
|
||||
chatId: ChatIdentifier,
|
||||
document: DocumentFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendDocument(
|
||||
chatId, document.fileId, document.thumb ?.fileId, text, parseMode, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendMediaGroup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.MediaGroupMemberInputMedia
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
|
||||
suspend fun RequestsExecutor.sendMediaGroup(
|
||||
chatId: ChatIdentifier,
|
||||
media: List<MediaGroupMemberInputMedia>,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null
|
||||
) = execute(
|
||||
SendMediaGroup(
|
||||
chatId, media, disableNotification, replyToMessageId
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendMediaGroup(
|
||||
chat: Chat,
|
||||
media: List<MediaGroupMemberInputMedia>,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null
|
||||
) = sendMediaGroup(
|
||||
chat.id, media, disableNotification, replyToMessageId
|
||||
)
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
|
||||
suspend fun RequestsExecutor.sendPhoto(
|
||||
chatId: ChatIdentifier,
|
||||
fileId: InputFile,
|
||||
caption: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendPhoto(
|
||||
chatId,
|
||||
fileId,
|
||||
caption,
|
||||
parseMode,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendSticker
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
|
||||
suspend fun RequestsExecutor.sendSticker(
|
||||
chatId: ChatIdentifier,
|
||||
sticker: InputFile,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendSticker(chatId, sticker, disableNotification, replyToMessageId, replyMarkup)
|
||||
)
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
||||
|
||||
suspend fun RequestsExecutor.sendVideo(
|
||||
chatId: ChatIdentifier,
|
||||
video: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
width: Int? = null,
|
||||
height: Int? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendVideo(
|
||||
chatId,
|
||||
video,
|
||||
thumb,
|
||||
text,
|
||||
parseMode,
|
||||
duration,
|
||||
width,
|
||||
height,
|
||||
null,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendVideo(
|
||||
chatId: ChatIdentifier,
|
||||
video: VideoFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVideo(
|
||||
chatId, video.fileId, video.thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,48 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideoNote
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
|
||||
|
||||
suspend fun RequestsExecutor.sendVideoNote(
|
||||
chatId: ChatIdentifier,
|
||||
videoNote: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
size: Int? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendVideoNote(
|
||||
chatId,
|
||||
videoNote,
|
||||
thumb,
|
||||
text,
|
||||
parseMode,
|
||||
duration,
|
||||
size,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendVideoNote(
|
||||
chatId: ChatIdentifier,
|
||||
videoNote: VideoFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVideoNote(
|
||||
chatId, videoNote.fileId, videoNote.thumb ?.fileId, text, parseMode, videoNote.duration, videoNote.width, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
|
||||
|
||||
suspend fun RequestsExecutor.sendVoice(
|
||||
chatId: ChatIdentifier,
|
||||
voice: InputFile,
|
||||
thumb: InputFile? = null,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
duration: Long? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendVoice(
|
||||
chatId,
|
||||
voice,
|
||||
thumb,
|
||||
text,
|
||||
parseMode,
|
||||
duration,
|
||||
disableNotification,
|
||||
replyToMessageId,
|
||||
replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendVoice(
|
||||
chatId: ChatIdentifier,
|
||||
voice: AudioFile,
|
||||
text: String? = null,
|
||||
parseMode: ParseMode? = null,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendVoice(
|
||||
chatId, voice.fileId, voice.thumb ?.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.payments
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments.SendInvoice
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPrice
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.abstracts.Currency
|
||||
|
||||
suspend fun RequestsExecutor.sendInvoice(
|
||||
chatId: ChatId,
|
||||
title: String,
|
||||
description: String,
|
||||
payload: String,
|
||||
providerToken: String,
|
||||
startParameter: StartParameter,
|
||||
currency: Currency,
|
||||
prices: List<LabeledPrice>,
|
||||
providerData: String? = null,
|
||||
requireName: Boolean = false,
|
||||
requirePhoneNumber: Boolean = false,
|
||||
requireEmail: Boolean = false,
|
||||
requireShippingAddress: Boolean = false,
|
||||
shouldSendPhoneNumberToProvider: Boolean = false,
|
||||
shouldSendEmailToProvider: Boolean = false,
|
||||
priceDependOnShipAddress: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendInvoice(
|
||||
user: CommonUser,
|
||||
title: String,
|
||||
description: String,
|
||||
payload: String,
|
||||
providerToken: String,
|
||||
startParameter: StartParameter,
|
||||
currency: Currency,
|
||||
prices: List<LabeledPrice>,
|
||||
providerData: String? = null,
|
||||
requireName: Boolean = false,
|
||||
requirePhoneNumber: Boolean = false,
|
||||
requireEmail: Boolean = false,
|
||||
requireShippingAddress: Boolean = false,
|
||||
shouldSendPhoneNumberToProvider: Boolean = false,
|
||||
shouldSendEmailToProvider: Boolean = false,
|
||||
priceDependOnShipAddress: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: InlineKeyboardMarkup? = null
|
||||
) = sendInvoice(user.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)
|
||||
@@ -1,135 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.polls
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls.SendQuizPoll
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls.SendRegularPoll
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.QuizPoll
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.RegularPoll
|
||||
|
||||
suspend fun RequestsExecutor.sendRegularPoll(
|
||||
chatId: ChatIdentifier,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
allowMultipleAnswers: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendRegularPoll(
|
||||
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
suspend fun RequestsExecutor.sendRegularPoll(
|
||||
chatId: ChatIdentifier,
|
||||
poll: RegularPoll,
|
||||
isClosed: Boolean = false,
|
||||
question: String = poll.question,
|
||||
options: List<String> = poll.options.map { it.text },
|
||||
isAnonymous: Boolean = poll.isAnonymous,
|
||||
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendRegularPoll(
|
||||
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendRegularPoll(
|
||||
chat: Chat,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
allowMultipleAnswers: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendRegularPoll(
|
||||
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendRegularPoll(
|
||||
chat: Chat,
|
||||
poll: RegularPoll,
|
||||
isClosed: Boolean = false,
|
||||
question: String = poll.question,
|
||||
options: List<String> = poll.options.map { it.text },
|
||||
isAnonymous: Boolean = poll.isAnonymous,
|
||||
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendRegularPoll(
|
||||
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
|
||||
suspend fun RequestsExecutor.sendQuizPoll(
|
||||
chatId: ChatIdentifier,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
correctOptionId: Int,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendQuizPoll(
|
||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendQuizPoll(
|
||||
chat: Chat,
|
||||
question: String,
|
||||
options: List<String>,
|
||||
correctOptionId: Int,
|
||||
isAnonymous: Boolean = true,
|
||||
isClosed: Boolean = false,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendQuizPoll(
|
||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendQuizPoll(
|
||||
chatId: ChatIdentifier,
|
||||
isClosed: Boolean = false,
|
||||
quizPoll: QuizPoll,
|
||||
question: String = quizPoll.question,
|
||||
options: List<String> = quizPoll.options.map { it.text },
|
||||
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
|
||||
isAnonymous: Boolean = quizPoll.isAnonymous,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = execute(
|
||||
SendQuizPoll(
|
||||
chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.sendQuizPoll(
|
||||
chat: Chat,
|
||||
isClosed: Boolean = false,
|
||||
quizPoll: QuizPoll,
|
||||
question: String = quizPoll.question,
|
||||
options: List<String> = quizPoll.options.map { it.text },
|
||||
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
|
||||
isAnonymous: Boolean = quizPoll.isAnonymous,
|
||||
disableNotification: Boolean = false,
|
||||
replyToMessageId: MessageIdentifier? = null,
|
||||
replyMarkup: KeyboardMarkup? = null
|
||||
) = sendQuizPoll(
|
||||
chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.CreateNewAnimatedStickerSet
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
|
||||
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewAnimatedStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewAnimatedStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewAnimatedStickerSet(
|
||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.createNewAnimatedStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewAnimatedStickerSet(
|
||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
||||
@@ -1,54 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.CreateNewStaticStickerSet
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
|
||||
|
||||
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||
userId: UserId,
|
||||
name: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = execute(
|
||||
CreateNewStaticStickerSet(userId, name, sticker, emojis, containsMasks, maskPosition)
|
||||
)
|
||||
|
||||
|
||||
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
sticker: FileId,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewStaticStickerSet(
|
||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.createNewStaticStickerSet(
|
||||
user: CommonUser,
|
||||
name: String,
|
||||
sticker: MultipartFile,
|
||||
emojis: String,
|
||||
containsMasks: Boolean? = null,
|
||||
maskPosition: MaskPosition? = null
|
||||
) = createNewStaticStickerSet(
|
||||
user.id, name, sticker, emojis, containsMasks, maskPosition
|
||||
)
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.DeleteStickerFromSet
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||
|
||||
suspend fun RequestsExecutor.deleteStickerFromSet(
|
||||
sticker: FileId
|
||||
) = execute(
|
||||
DeleteStickerFromSet(
|
||||
sticker
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.deleteStickerFromSet(
|
||||
sticker: Sticker
|
||||
) = deleteStickerFromSet(
|
||||
sticker.fileId
|
||||
)
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.SetStickerPositionInSet
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
|
||||
|
||||
suspend fun RequestsExecutor.setStickerPositionInSet(
|
||||
sticker: FileId,
|
||||
position: Int
|
||||
) = execute(
|
||||
SetStickerPositionInSet(
|
||||
sticker,
|
||||
position
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setStickerPositionInSet(
|
||||
sticker: Sticker,
|
||||
position: Int
|
||||
) = setStickerPositionInSet(
|
||||
sticker.fileId,
|
||||
position
|
||||
)
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.stickers
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.UploadStickerFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CommonUser
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
|
||||
|
||||
suspend fun RequestsExecutor.uploadStickerFile(
|
||||
userId: UserId,
|
||||
sticker: MultipartFile
|
||||
) = execute(
|
||||
UploadStickerFile(userId, sticker)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.uploadStickerFile(
|
||||
user: CommonUser,
|
||||
sticker: MultipartFile
|
||||
) = execute(
|
||||
UploadStickerFile(user.id, sticker)
|
||||
)
|
||||
@@ -1,177 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.updates
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.RequestException
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.convertWithMediaGroupUpdates
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.InternalUtils.lastUpdateIdentifier
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.api.getUpdates
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.updateshandlers.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.utils.PreviewFeature
|
||||
import io.ktor.client.features.HttpRequestTimeoutException
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
fun RequestsExecutor.startGettingOfUpdates(
|
||||
timeoutSeconds: Seconds = 30,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||
exceptionsHandler: (suspend (Exception) -> Unit)? = null,
|
||||
allowedUpdates: List<String>? = null,
|
||||
updatesReceiver: UpdateReceiver<Update>
|
||||
): Job = scope.launch {
|
||||
var lastUpdateIdentifier: UpdateIdentifier? = null
|
||||
|
||||
while (isActive) {
|
||||
try {
|
||||
supervisorScope {
|
||||
val updates = getUpdates(
|
||||
offset = lastUpdateIdentifier?.plus(1),
|
||||
timeout = timeoutSeconds,
|
||||
allowed_updates = allowedUpdates
|
||||
).let { originalUpdates ->
|
||||
val converted = originalUpdates.convertWithMediaGroupUpdates()
|
||||
/**
|
||||
* Dirty hack for cases when the media group was retrieved not fully:
|
||||
*
|
||||
* We are throw out the last media group and will reretrieve it again in the next get updates
|
||||
* and it will guarantee that it is full
|
||||
*/
|
||||
if (originalUpdates.size == getUpdatesLimit.last && converted.last() is SentMediaGroupUpdate) {
|
||||
converted - converted.last()
|
||||
} else {
|
||||
converted
|
||||
}
|
||||
}
|
||||
|
||||
supervisorScope {
|
||||
for (update in updates) {
|
||||
updatesReceiver(update)
|
||||
|
||||
lastUpdateIdentifier = update.lastUpdateIdentifier()
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: HttpRequestTimeoutException) {
|
||||
exceptionsHandler ?.invoke(e) // it is ok due to mechanism of long polling
|
||||
} catch (e: RequestException) {
|
||||
exceptionsHandler ?.invoke(e) // it is not ok, but in most cases it will mean that there is some limit for requests count
|
||||
delay(1000L)
|
||||
} catch (e: Exception) {
|
||||
exceptionsHandler ?.invoke(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method will create a new one [FlowsUpdatesFilter]. This method could be unsafe due to the fact that it will start
|
||||
* getting updates IMMEDIATELY. That means that your bot will be able to skip some of them until you will call
|
||||
* [kotlinx.coroutines.flow.Flow.collect] on one of [FlowsUpdatesFilter] flows. To avoid it, you can pass
|
||||
* [flowUpdatesPreset] lambda - it will be called BEFORE starting updates getting
|
||||
*/
|
||||
@PreviewFeature
|
||||
fun RequestsExecutor.startGettingFlowsUpdates(
|
||||
timeoutSeconds: Seconds = 30,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||
exceptionsHandler: (suspend (Exception) -> Unit)? = null,
|
||||
flowsUpdatesFilterUpdatesKeeperCount: Int = 64,
|
||||
flowUpdatesPreset: FlowsUpdatesFilter.() -> Unit = {}
|
||||
): FlowsUpdatesFilter = FlowsUpdatesFilter(flowsUpdatesFilterUpdatesKeeperCount).apply {
|
||||
flowUpdatesPreset()
|
||||
startGettingOfUpdates(timeoutSeconds, scope, exceptionsHandler, allowedUpdates, asUpdateReceiver)
|
||||
}
|
||||
|
||||
fun RequestsExecutor.startGettingOfUpdates(
|
||||
updatesFilter: UpdatesFilter,
|
||||
timeoutSeconds: Seconds = 30,
|
||||
exceptionsHandler: (suspend (Exception) -> Unit)? = null,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
|
||||
): Job = startGettingOfUpdates(
|
||||
timeoutSeconds,
|
||||
scope,
|
||||
exceptionsHandler,
|
||||
updatesFilter.allowedUpdates,
|
||||
updatesFilter.asUpdateReceiver
|
||||
)
|
||||
|
||||
fun RequestsExecutor.startGettingOfUpdates(
|
||||
messageCallback: UpdateReceiver<MessageUpdate>? = null,
|
||||
messageMediaGroupCallback: UpdateReceiver<MessageMediaGroupUpdate>? = null,
|
||||
editedMessageCallback: UpdateReceiver<EditMessageUpdate>? = null,
|
||||
editedMessageMediaGroupCallback: UpdateReceiver<EditMessageMediaGroupUpdate>? = null,
|
||||
channelPostCallback: UpdateReceiver<ChannelPostUpdate>? = null,
|
||||
channelPostMediaGroupCallback: UpdateReceiver<ChannelPostMediaGroupUpdate>? = null,
|
||||
editedChannelPostCallback: UpdateReceiver<EditChannelPostUpdate>? = null,
|
||||
editedChannelPostMediaGroupCallback: UpdateReceiver<EditChannelPostMediaGroupUpdate>? = null,
|
||||
chosenInlineResultCallback: UpdateReceiver<ChosenInlineResultUpdate>? = null,
|
||||
inlineQueryCallback: UpdateReceiver<InlineQueryUpdate>? = null,
|
||||
callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null,
|
||||
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||
pollCallback: UpdateReceiver<PollUpdate>? = null,
|
||||
pollAnswerCallback: UpdateReceiver<PollAnswerUpdate>? = null,
|
||||
timeoutSeconds: Seconds = 30,
|
||||
exceptionsHandler: (suspend (Exception) -> Unit)? = null,
|
||||
scope: CoroutineScope = GlobalScope
|
||||
): Job {
|
||||
return startGettingOfUpdates(
|
||||
SimpleUpdatesFilter(
|
||||
messageCallback,
|
||||
messageMediaGroupCallback,
|
||||
editedMessageCallback,
|
||||
editedMessageMediaGroupCallback,
|
||||
channelPostCallback,
|
||||
channelPostMediaGroupCallback,
|
||||
editedChannelPostCallback,
|
||||
editedChannelPostMediaGroupCallback,
|
||||
chosenInlineResultCallback,
|
||||
inlineQueryCallback,
|
||||
callbackQueryCallback,
|
||||
shippingQueryCallback,
|
||||
preCheckoutQueryCallback,
|
||||
pollCallback,
|
||||
pollAnswerCallback
|
||||
),
|
||||
timeoutSeconds,
|
||||
exceptionsHandler,
|
||||
scope
|
||||
)
|
||||
}
|
||||
|
||||
fun RequestsExecutor.startGettingOfUpdates(
|
||||
messageCallback: UpdateReceiver<MessageUpdate>? = null,
|
||||
mediaGroupCallback: UpdateReceiver<MediaGroupUpdate>? = null,
|
||||
editedMessageCallback: UpdateReceiver<EditMessageUpdate>? = null,
|
||||
channelPostCallback: UpdateReceiver<ChannelPostUpdate>? = null,
|
||||
editedChannelPostCallback: UpdateReceiver<EditChannelPostUpdate>? = null,
|
||||
chosenInlineResultCallback: UpdateReceiver<ChosenInlineResultUpdate>? = null,
|
||||
inlineQueryCallback: UpdateReceiver<InlineQueryUpdate>? = null,
|
||||
callbackQueryCallback: UpdateReceiver<CallbackQueryUpdate>? = null,
|
||||
shippingQueryCallback: UpdateReceiver<ShippingQueryUpdate>? = null,
|
||||
preCheckoutQueryCallback: UpdateReceiver<PreCheckoutQueryUpdate>? = null,
|
||||
pollCallback: UpdateReceiver<PollUpdate>? = null,
|
||||
pollAnswerCallback: UpdateReceiver<PollAnswerUpdate>? = null,
|
||||
timeoutSeconds: Seconds = 30,
|
||||
exceptionsHandler: (suspend (Exception) -> Unit)? = null,
|
||||
scope: CoroutineScope = CoroutineScope(Dispatchers.Default)
|
||||
): Job = startGettingOfUpdates(
|
||||
messageCallback = messageCallback,
|
||||
messageMediaGroupCallback = mediaGroupCallback,
|
||||
editedMessageCallback = editedMessageCallback,
|
||||
editedMessageMediaGroupCallback = mediaGroupCallback,
|
||||
channelPostCallback = channelPostCallback,
|
||||
channelPostMediaGroupCallback = mediaGroupCallback,
|
||||
editedChannelPostCallback = editedChannelPostCallback,
|
||||
editedChannelPostMediaGroupCallback = mediaGroupCallback,
|
||||
chosenInlineResultCallback = chosenInlineResultCallback,
|
||||
inlineQueryCallback = inlineQueryCallback,
|
||||
callbackQueryCallback = callbackQueryCallback,
|
||||
shippingQueryCallback = shippingQueryCallback,
|
||||
preCheckoutQueryCallback = preCheckoutQueryCallback,
|
||||
pollCallback = pollCallback,
|
||||
pollAnswerCallback = pollAnswerCallback,
|
||||
timeoutSeconds = timeoutSeconds,
|
||||
exceptionsHandler = exceptionsHandler,
|
||||
scope = scope
|
||||
)
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.webhook
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.DeleteWebhook
|
||||
|
||||
suspend fun RequestsExecutor.deleteWebhook() = execute(DeleteWebhook())
|
||||
@@ -1,6 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.webhook
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.GetWebhookInfo
|
||||
|
||||
suspend fun RequestsExecutor.getWebhookInfo() = execute(GetWebhookInfo())
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.webhook
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.requests.webhook.SetWebhook
|
||||
|
||||
suspend fun RequestsExecutor.setWebhookInfo(
|
||||
url: String,
|
||||
certificate: FileId,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null
|
||||
) = execute(
|
||||
SetWebhook(
|
||||
url, certificate, maxAllowedConnections, allowedUpdates
|
||||
)
|
||||
)
|
||||
|
||||
suspend fun RequestsExecutor.setWebhookInfo(
|
||||
url: String,
|
||||
certificate: MultipartFile,
|
||||
maxAllowedConnections: Int? = null,
|
||||
allowedUpdates: List<String>? = null
|
||||
) = execute(
|
||||
SetWebhook(
|
||||
url, certificate, maxAllowedConnections, allowedUpdates
|
||||
)
|
||||
)
|
||||
@@ -1,81 +0,0 @@
|
||||
# TelegramBotAPI Util Extensions
|
||||
|
||||
[ ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils/_latestVersion)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-utils)
|
||||
|
||||
## What is it?
|
||||
|
||||
It is wrapper library for [TelegramBotAPI](../TelegramBotAPI/README.md). Currently, this library contains some usefull filters for commands, updates types and different others.
|
||||
|
||||
## How to implement library?
|
||||
|
||||
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-extensions-utils_version`, which must be set up by developer. Available versions are presented on
|
||||
[bintray](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils), next version is last published:
|
||||
|
||||
[ ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils/_latestVersion)
|
||||
|
||||
### Maven
|
||||
|
||||
Dependency config presented here:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.github.insanusmokrassar</groupId>
|
||||
<artifactId>TelegramBotAPI-extensions-utils</artifactId>
|
||||
<version>${telegrambotapi-extensions-utils_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-extensions-utils:$telegrambotapi-extensions-utils_version"
|
||||
```
|
||||
|
||||
or for old gradle:
|
||||
|
||||
```groovy
|
||||
compile "com.github.insanusmokrassar:TelegramBotAPI-extensions-utils:$telegrambotapi-extensions-utils_version"
|
||||
```
|
||||
|
||||
## How to use?
|
||||
|
||||
Here will be presented several examples of usage. In all cases it is expected that you have created your bot and filter:
|
||||
|
||||
```kotlin
|
||||
val bot: RequestsExecutor = KtorRequestsExecutor(
|
||||
TelegramAPIUrlsKeeper(BOT_TOKEN)
|
||||
)
|
||||
val filter = FlowsUpdatesFilter(64)
|
||||
```
|
||||
|
||||
Alternative way to use the things below:
|
||||
|
||||
```kotlin
|
||||
val filter = bot.startGettingUpdates(
|
||||
scope = CoroutineScope(Dispatchers.Default)
|
||||
) {
|
||||
// place code from examples here with replacing of `filter` by `this`
|
||||
}
|
||||
```
|
||||
|
||||
### Getting of only text incoming messages
|
||||
|
||||
```kotlin
|
||||
filter.asContentMessagesFlow().onlyTextContentMessages().onEach {
|
||||
println(it.content)
|
||||
println(it.fullEntitiesList())
|
||||
}.launchIn(
|
||||
CoroutineScope(Dispatchers.Default)
|
||||
)
|
||||
```
|
||||
|
||||
As a result, each received message which will be just text message will be printed out with full list of its internal entities
|
||||
@@ -1,48 +0,0 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
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"
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||
}
|
||||
|
||||
project.version = "$library_version"
|
||||
project.group = "$library_group"
|
||||
|
||||
apply from: "publish.gradle"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js()
|
||||
|
||||
sourceSets {
|
||||
commonMain {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||
api "${project.group}:TelegramBotAPI:$library_version"
|
||||
} else {
|
||||
implementation project(":TelegramBotAPI")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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 "Util extensions for more useful work with updates and other things"
|
||||
name "Telegram Bot API Utility Extensions"
|
||||
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 Utility Extensions","description":"Util extensions for more useful work with updates and other things","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
||||
@@ -1,55 +0,0 @@
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
apply from: "maven.publish.gradle"
|
||||
|
||||
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()
|
||||
}
|
||||
}
|
||||
}
|
||||
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')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload.doFirst {
|
||||
publications = publishing.publications.collect {
|
||||
if (it.name.contains('kotlinMultiplatform')) {
|
||||
null
|
||||
} else {
|
||||
it.name
|
||||
}
|
||||
} - null
|
||||
}
|
||||
|
||||
bintrayUpload.dependsOn publishToMavenLocal
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.payments.InvoiceContent
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.mapNotNull
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
fun <T : MessageContent> Flow<ContentMessage<*>>.withContentType(contentType: KClass<T>) = mapNotNull {
|
||||
if (contentType.isInstance(it.content)) {
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
it as ContentMessage<T>
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
|
||||
fun Flow<ContentMessage<*>>.onlyAnimationContentMessages() = withContentType(AnimationContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyAudioContentMessages() = withContentType(AudioContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyContactContentMessages() = withContentType(ContactContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyDiceContentMessages() = withContentType(DiceContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyDocumentContentMessages() = withContentType(DocumentContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyGameContentMessages() = withContentType(GameContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyInvoiceContentMessages() = withContentType(InvoiceContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyLocationContentMessages() = withContentType(LocationContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyPhotoContentMessages() = withContentType(PhotoContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyPollContentMessages() = withContentType(PollContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyStickerContentMessages() = withContentType(StickerContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyTextContentMessages() = withContentType(TextContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyVenueContentMessages() = withContentType(VenueContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyVideoContentMessages() = withContentType(VideoContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyVideoNoteContentMessages() = withContentType(VideoNoteContent::class)
|
||||
fun Flow<ContentMessage<*>>.onlyVoiceContentMessages() = withContentType(VoiceContent::class)
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.*
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.CallbackQueryUpdate
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.mapNotNull
|
||||
|
||||
fun Flow<CallbackQueryUpdate>.asDataCallbackQueryFlow() = mapNotNull {
|
||||
it.data as? DataCallbackQuery
|
||||
}
|
||||
fun Flow<CallbackQueryUpdate>.asGameShortNameCallbackQueryFlow() = mapNotNull {
|
||||
it.data as? GameShortNameCallbackQuery
|
||||
}
|
||||
fun Flow<CallbackQueryUpdate>.asUnknownCallbackQueryFlow() = mapNotNull {
|
||||
it.data as? UnknownCallbackQueryType
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates
|
||||
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.onlyTextContentMessages
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.BotCommandTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.RegularTextSource
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.fullEntitiesList
|
||||
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.BaseSentMessageUpdate
|
||||
import kotlinx.coroutines.flow.*
|
||||
|
||||
fun <T : BaseSentMessageUpdate> Flow<T>.filterExactCommands(
|
||||
commandRegex: Regex
|
||||
) = asContentMessagesFlow().onlyTextContentMessages().filter { contentMessage ->
|
||||
(contentMessage.content.fullEntitiesList().singleOrNull() as? BotCommandTextSource) ?.let { commandRegex.matches(it.command) } == true
|
||||
}
|
||||
|
||||
fun <T : BaseSentMessageUpdate> Flow<T>.filterCommandsInsideTextMessages(
|
||||
commandRegex: Regex
|
||||
) = asContentMessagesFlow().onlyTextContentMessages().filter { contentMessage ->
|
||||
contentMessage.content.fullEntitiesList().any {
|
||||
(it as? BotCommandTextSource) ?.let { commandRegex.matches(it.command) } == true
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Result [Flow] will emit all [TextSource]s to the collector ONLY IN CASE if first [TextSource] is
|
||||
* [BotCommandTextSource] and its [BotCommandTextSource.command] is [Regex.matches] to incoming [commandRegex]. Internal
|
||||
* behaviour contains next rules: all incoming text sources will be passed as is, [RegularTextSource] will be divided
|
||||
* by " " for several [RegularTextSource] which will contains not empty args without spaces
|
||||
*/
|
||||
fun <T : BaseSentMessageUpdate> Flow<T>.filterCommandsWithArgs(
|
||||
commandRegex: Regex
|
||||
): Flow<List<TextSource>> = asContentMessagesFlow().onlyTextContentMessages().mapNotNull { contentMessage ->
|
||||
val allEntities = contentMessage.content.fullEntitiesList()
|
||||
(allEntities.firstOrNull() as? BotCommandTextSource) ?.let {
|
||||
if (commandRegex.matches(it.command)) {
|
||||
allEntities.flatMap {
|
||||
when (it) {
|
||||
is RegularTextSource -> it.source.split(" ").mapNotNull { regularTextSourcePart ->
|
||||
if (regularTextSourcePart.isNotBlank()) {
|
||||
RegularTextSource(regularTextSourcePart)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
else -> listOf(it)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user