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

Compare commits

..

443 Commits

Author SHA1 Message Date
8804a24013 small refactoring 2020-09-22 18:12:48 +06:00
8b5244d8df hotfix 2020-09-22 18:06:50 +06:00
034901a479 add publication of github release via changelog 2020-09-22 18:04:10 +06:00
7043647584 changelog parser script has been added 2020-09-22 15:15:20 +06:00
acd9505a5d inline queries extensions 2020-09-22 14:47:34 +06:00
46c33d5ec4 update dependencies 2020-09-22 11:33:47 +06:00
89dc7a4b2a InlineQueryResult#id type change 2020-09-20 20:16:14 +06:00
e4f305b3ec start 0.28.3 2020-09-20 20:11:27 +06:00
d56c132201 Reorder 0.28.* changelogs 2020-09-16 19:28:05 +06:00
d336e177dd Merge pull request #135 from InsanusMokrassar/0.28.2
0.28.2
2020-09-16 11:45:22 +06:00
15e29286fb commonMessages and sent via bot shortcuts updates 2020-09-14 00:12:28 +06:00
314ceed78e signature change in filterCommandsWithArgs 2020-09-13 23:58:09 +06:00
3fa3aa50d9 commands shortcuts 2020-09-13 23:42:59 +06:00
571296b9a0 start 0.28.2 2020-09-13 23:32:47 +06:00
3f13e5d062 Merge pull request #132 from InsanusMokrassar/0.28.1
0.28.1
2020-09-12 22:38:24 +06:00
1874023c05 fixes in build + changes in signature of executeUnsafe 2020-09-12 16:22:39 +06:00
dc0fda2066 update handleSafely 2020-09-12 16:18:00 +06:00
c0d4a4f01b update gradle wrapper version 2020-09-12 15:49:09 +06:00
603762bc22 update kotlin and UUID versions 2020-09-12 15:44:44 +06:00
4db82d6ce2 start 0.28.1 2020-09-12 15:40:12 +06:00
9bf8f56254 update SimpleInputFilesTest 2020-08-29 19:52:46 +06:00
9c926a2265 update SimpleInputFilesTest 2020-08-29 19:51:10 +06:00
747854f4f4 Merge pull request #123 from InsanusMokrassar/0.28.0
0.28.0
2020-08-29 18:46:16 +06:00
dcfb14553d JS/JVM errors opportunity note 2020-08-29 18:37:02 +06:00
6eaa9d699b crutch for inputmediaphoto 2020-08-29 12:08:37 +06:00
6788c4d1dd make the test failing again 2020-08-24 00:34:30 +06:00
6420737a82 remove arguments 2020-08-24 00:27:37 +06:00
4c36750431 add failing test which normally must be working ok 2020-08-23 23:42:50 +06:00
fd022742aa files downloading extensions in utils 2020-08-23 23:37:29 +06:00
0472e35752 Merge pull request #124 from sleshJdev/feature/download-pathed-file-extension
Extended PathedFile to get it as file/stream
2020-08-23 21:44:53 +06:00
768d00eedd total rework (by accident) 2020-08-23 21:43:58 +06:00
e9347075ed Merge remote-tracking branch 'upstream/0.28.0' into feature/download-pathed-file-extension 2020-08-23 18:57:03 +06:00
slesh
3da74b0c66 Converted to expression body 2020-08-23 01:05:12 +03:00
slesh
8b79c5c76b Use DEFAULT_BUFFER_SIZE 2020-08-23 01:04:01 +03:00
slesh
a1b471d2ca Added asBytes method. Used InputStream.copyTo 2020-08-23 01:02:50 +03:00
slesh
e2c7125f6c Extended PathedFile to get it as file/stream 2020-08-23 00:47:17 +03:00
ec8df3c31c start work with publication 2020-08-20 22:26:35 +06:00
94a35349aa temporal update 2020-08-20 17:35:26 +06:00
046402454f Revert "try to fix problem with arguments in InputMedia"
This reverts commit c3978f2dab.
2020-08-20 16:07:01 +06:00
c3978f2dab try to fix problem with arguments in InputMedia 2020-08-20 15:58:11 +06:00
1019fd4d19 turn on incremental building and add TelegramBot typealias 2020-08-20 15:00:45 +06:00
76a9fd1a55 updates in readmes 2020-08-20 13:55:34 +06:00
aec4c7323a fill changelog 2020-08-20 12:02:28 +06:00
7bdfd5cf69 update README 2020-08-20 11:58:37 +06:00
ce95a60fbc migration of artifacts names 2020-08-20 11:55:39 +06:00
3c17a67b01 rewrite on BOTH for JS 2020-08-20 10:51:05 +06:00
35bf5b9e9d fix of formatter in ChatSerializers 2020-08-20 02:00:42 +06:00
0087d02b5f potential fix of build 2020-08-20 01:17:32 +06:00
212d8946c8 update travis build 2020-08-19 13:52:18 +06:00
319e43901a several more changes in build.script's 2020-08-19 13:49:30 +06:00
da01955507 pass old way for building of js part 2020-08-19 12:14:28 +06:00
095382040c update travis build config 2020-08-19 00:31:14 +06:00
5545708d38 fix after ktor update 2020-08-19 00:28:16 +06:00
5d06d86549 update ktor version 2020-08-19 00:19:09 +06:00
c081e5c457 add IR compiling 2020-08-19 00:07:55 +06:00
555c2ffa04 try to fix 2020-08-18 20:49:27 +06:00
bcee64c103 try to fix 2020-08-18 20:44:31 +06:00
44a35bd26e upgrade travis config 2020-08-18 13:50:26 +06:00
1f5c719294 deprecations removing and several warnings fixes 2020-08-18 13:45:15 +06:00
6013c3ba86 versions updates 2020-08-18 12:50:11 +06:00
d4551490f7 start 0.28.0 2020-08-18 10:56:05 +06:00
cc0498a89a Update README.md 2020-08-14 23:44:21 +06:00
0b78c0382f Merge branch '0.27.11' 2020-08-14 19:29:16 +06:00
c91426a910 filename created 2020-08-14 19:26:51 +06:00
5d1c59ff75 Merge pull request #97 from InsanusMokrassar/0.27.11
0.27.11
2020-08-14 18:43:51 +06:00
d2228e274c sentMessages extension for FlowsUpdatesFilter 2020-08-13 15:28:10 +06:00
790959ea49 add a lot of extension for FlowUpdatesFilter and Flow 2020-08-13 14:55:21 +06:00
ce9f7f35dc fix scope of one of startGettingOfUpdatesByLongPolling 2020-08-13 13:45:25 +06:00
4f984d1dbc update documentation for FlowsAggregation 2020-08-13 12:53:04 +06:00
c83da6be70 Merge pull request #98 from InsanusMokrassar/renovate/configure
Configure Renovate
2020-08-13 02:24:42 +06:00
Renovate Bot
710438489c Add renovate.json 2020-08-12 20:21:10 +00:00
6f650f6d6c Flow<BaseSentMessageUpdate> extensions 2020-08-13 01:19:12 +06:00
2d15e13ae6 started 0.27.11 2020-08-13 01:08:44 +06:00
d60ee7b8a5 Merge pull request #96 from InsanusMokrassar/0.27.10
0.27.10
2020-08-11 12:58:45 +06:00
8f882e9825 fix links in toc of extensions readme 2020-08-10 20:02:11 +06:00
48e946c2d0 add a simple fix in readme 2020-08-10 20:00:45 +06:00
1758d80020 new telegramBot 2020-08-10 13:38:19 +06:00
63b2bd61b5 add aggregation of flows 2020-08-10 11:53:54 +06:00
ff2c70fc76 FlowsUpdatesFiler extensions 2020-08-10 11:41:46 +06:00
e3bfc4472a includeWebhookHandlingInRouteWithFlows 2020-08-10 10:46:18 +06:00
1cff6f616f start 0.27.10 2020-08-10 10:45:46 +06:00
1dfe4bf276 Merge pull request #95 from InsanusMokrassar/0.27.9
0.27.9
2020-08-06 21:38:39 +06:00
e4b09032cd deprecate PositionedInlineQueryResult 2020-08-03 12:15:59 +06:00
e8e54a0aea add labeler config for versions 2020-08-03 11:46:38 +06:00
8f85b4cba3 versions update 2020-08-03 11:41:14 +06:00
46d65a271d start 0.27.9 2020-07-29 15:38:32 +06:00
e088329ce1 Update README.md 2020-07-20 15:15:06 +06:00
8d9ebb754b Merge pull request #94 from InsanusMokrassar/0.27.8
0.27.8
2020-07-02 16:39:04 +06:00
c0a43077ad optimize imports 2020-07-02 16:15:06 +06:00
1811a63a13 update last added sendVenue 2020-07-02 16:00:38 +06:00
cba0e30710 sendVenue with Location 2020-07-02 15:55:14 +06:00
ff0b7faa48 Foursquare and fixes of deprecations in methods 2020-07-02 00:52:52 +06:00
975898660c TelegramBotAPI Venue and foursquare additions 2020-07-01 23:57:20 +06:00
cfb7f35d20 add several makeLinkToMessage 2020-06-27 10:11:03 +06:00
147889a66a update readme 2020-06-27 09:59:57 +06:00
ed9ed715a0 update defaults for new FlowsUpdatesFilter 2020-06-27 09:51:18 +06:00
a9a3f55c8d refactoring of FlowsUpdatesFilter 2020-06-27 09:44:50 +06:00
58943f2504 small refactor of BaseMessagesUpdatesConversations 2020-06-27 09:31:29 +06:00
5f7633a57e start 0.27.8 2020-06-27 09:30:25 +06:00
65cfc3220d add hierarchy diagram 2020-06-26 19:11:59 +06:00
36d30ef91b Merge pull request #92 from InsanusMokrassar/0.27.7
0.27.7
2020-06-26 17:50:05 +06:00
41e5c579a2 add excluding of CHANGELOG file for labeler 2020-06-26 17:45:16 +06:00
bbf63c51ec Revert "add com.soywiz.korlibs.krypto:krypto dependency"
This reverts commit acfb7066d2.
2020-06-25 15:45:38 +06:00
fb91199f83 Revert "start implement passport"
This reverts commit d76c09ffb2.
2020-06-25 15:45:35 +06:00
d76c09ffb2 start implement passport 2020-06-25 15:45:15 +06:00
acfb7066d2 add com.soywiz.korlibs.krypto:krypto dependency 2020-06-25 12:07:48 +06:00
7507c107b4 add one more flatMatrix 2020-06-24 20:54:22 +06:00
2acb177ad6 first keyboards improvements 2020-06-24 20:51:48 +06:00
b5a14077fd start 0.27.7 2020-06-24 20:25:51 +06:00
5f60bf003f Add useful links 2020-06-07 17:27:20 +06:00
f9b2c4c403 update README 2020-06-05 17:01:37 +06:00
c909774403 Merge pull request #91 from InsanusMokrassar/0.27.6
0.27.6
2020-06-05 15:44:30 +06:00
670cfcca13 update kotlin coroutines 2020-06-05 15:17:14 +06:00
130e00b62b extensions for CommonMessage 2020-06-05 14:57:58 +06:00
ca4beee95f add PossiblySentViaBotCommonMessage and fix error in build 2020-06-05 14:25:19 +06:00
ca784e67df add BuiltInMimeTypes, ThumbedWithMimeTypeInlineQueryResult and buildMimeType factory 2020-06-05 14:01:19 +06:00
835b8b34f9 add via_bot 2020-06-05 13:40:12 +06:00
e6430a729c work on version 0.27.6 has been started 2020-06-05 13:37:11 +06:00
6c4c9f2fc6 by default dokka task will not set up exact folder for docs 2020-06-03 15:42:00 +06:00
310a7e6e82 update docs build gradle to be able to put dokka where it is required 2020-06-03 15:39:54 +06:00
7375894645 Merge pull request #90 from InsanusMokrassar/0.27.5
0.27.5
2020-06-02 22:26:07 +06:00
69973c597b update BotCommandNameRegex 2020-06-02 22:10:33 +06:00
22e8b06fda BotBuilder fixes 2020-06-02 21:18:49 +06:00
7ede53fdbb BotCommandNameRegex and strict check of incoming command 2020-06-02 20:16:55 +06:00
ca9051920d new setMyCommands extension added 2020-06-02 19:54:13 +06:00
b477e8d585 extend getChat extensions 2020-06-02 13:54:30 +06:00
8ae2f57d55 update description of PreviewFeature annotation 2020-06-02 13:47:28 +06:00
1fb2ecf15f executes was replaced 2020-06-02 13:39:09 +06:00
6073d914d5 hotfixes in new media groups shortcuts 2020-06-02 13:22:36 +06:00
16f55d70af resend and other media group utils replaced into TelegramBotAPI_extensions-utils 2020-06-02 13:21:38 +06:00
b484a31a4a replacement of CaptionAndTextSourcesToText 2020-06-02 13:05:15 +06:00
0a162c4129 StringFormattiing replacement 2020-06-02 01:26:46 +06:00
648f1b488b add makeLinkToAddStickerSet 2020-06-02 01:15:08 +06:00
5fbde4bc06 new "row" 2020-06-02 01:02:38 +06:00
2a276d9272 safely function 2020-06-01 12:56:48 +06:00
9ae252717d versions update 2020-06-01 12:00:06 +06:00
456143a266 complete refresh of CaptinAndTextSourcesToText 2020-06-01 11:55:48 +06:00
0bcc98e126 update caption errors 2020-06-01 11:53:33 +06:00
ab9ceba41c updates in caption and text lengths 2020-06-01 11:44:58 +06:00
7cd5666e88 use maxTextLength inside of CaptionAndTextSourcesToText 2020-05-31 22:53:04 +06:00
35dcd6ada7 fix in SendMessage 2020-05-31 22:51:42 +06:00
ec37df82a9 start 0.27.5 2020-05-31 22:43:35 +06:00
220cb47615 update look like of kdocs badge 2020-05-23 15:46:49 +06:00
d79b8a337a add kdocs badge 2020-05-23 15:43:47 +06:00
cef6a6f741 update telegram badge 2020-05-23 15:27:45 +06:00
9471df1f2d Merge pull request #89 from InsanusMokrassar/0.27.4
0.27.4
2020-05-23 15:22:13 +06:00
f121e5f9c3 renames for JVM signature duplication avoiding 2020-05-23 12:53:42 +06:00
7f4fe318c5 update filters 2020-05-22 16:40:30 +06:00
dbf5c2dbb2 update publish scripts 2020-05-22 14:03:48 +06:00
105415873d updates extensions 2020-05-22 13:21:22 +06:00
ff32fd1dfc 0.27.4 started 2020-05-22 12:56:50 +06:00
006251ed07 fixes 2020-05-17 15:10:02 +06:00
9307582654 Add TelegramBotAPI-all status to readme 2020-05-17 01:30:05 +06:00
fe11a2119e Return opts in telegram bot api 2020-05-16 22:24:50 +06:00
c31403c1a2 Merge pull request #88 from InsanusMokrassar/0.27.3
0.27.3
2020-05-16 22:07:56 +06:00
0260e7bedc fixes of warnings 2020-05-16 22:02:57 +06:00
fa43a55f26 one more update of labeler 2020-05-16 21:54:54 +06:00
e9e1f4b9cf Merge branch 'master' into 0.27.3 2020-05-16 21:24:14 +06:00
e7b5b9184d update rules for labelers 2020-05-16 21:22:37 +06:00
81aa3f2307 update labeler task 2020-05-16 21:19:38 +06:00
a9fe584504 add TOC for TelegramBotAPI-extensions-utils 2020-05-16 21:14:10 +06:00
4c8861ba79 change visibility of internalSetWebhookInfoAndStartListenWebhooks 2020-05-16 20:57:57 +06:00
0ec18cbf06 dice changes 2020-05-16 20:46:49 +06:00
7008f312dc fixes 2020-05-16 20:43:09 +06:00
85317a510e update docs 2020-05-16 11:09:31 +06:00
d629aa206e fixes 2020-05-15 22:14:19 +06:00
6394e1a52b setWebhookInfo 2020-05-15 22:02:53 +06:00
23dca3d307 small grammar fix in WebhookInfo 2020-05-15 19:19:30 +06:00
3032aa8474 renaming of telegramBot functions 2020-05-15 19:14:09 +06:00
db19b69ca0 fails handler in executeUnsafe 2020-05-15 19:04:10 +06:00
f3827f81a7 change mechanism of executeUnsafe 2020-05-15 18:59:42 +06:00
0532dbb1ae fixes 2020-05-15 18:39:12 +06:00
efc2681da8 add additional signatures for setWebhookInfoAndStartListenWebhooks 2020-05-15 18:35:16 +06:00
735ed9fd86 change flowsUpdatesFilter signature 2020-05-15 18:31:49 +06:00
e856dc4754 add flowsUdatesFilter 2020-05-15 18:17:55 +06:00
0706ff1f95 Update labeler.yml 2020-05-15 18:06:29 +06:00
336b830b0b Merge branch 'master' into 0.27.3 2020-05-15 18:05:57 +06:00
1a638fe0a5 update labeler
one more update of labeler
2020-05-15 18:05:00 +06:00
45467e5bd7 Create labeler.yml 2020-05-15 18:05:00 +06:00
8419b0ab6a Create label.yml 2020-05-15 18:05:00 +06:00
49573607fb Create greetings.yml 2020-05-15 18:05:00 +06:00
35fe48db35 Create labeler.yml 2020-05-15 17:05:53 +06:00
590db3e672 Create label.yml 2020-05-15 17:02:33 +06:00
ea40474c47 add opportunity to set up media groups devounce time 2020-05-15 16:53:21 +06:00
7354389f2d Create greetings.yml 2020-05-15 15:49:10 +06:00
1f20ae16aa Update README.md 2020-05-15 00:54:00 +06:00
095c91bf39 update readmes with updates handling 2020-05-15 00:48:34 +06:00
dc173d752c optimize imports 2020-05-15 00:29:17 +06:00
a1788e35b2 clean up in webhooks 2020-05-15 00:28:16 +06:00
ea224fd765 add javax.activation dependency 2020-05-14 21:18:33 +06:00
7f51544bb9 Fix links in TelegramBotAPI-all readme 2020-05-14 16:25:39 +06:00
dfb22b0e89 update readme of all includer 2020-05-14 14:26:42 +06:00
e675e841da update urls 2020-05-14 14:23:26 +06:00
dea43aad8e update subprojects implementation types 2020-05-14 14:11:33 +06:00
52e25e934d add TelegramBotAPI-all 2020-05-14 14:07:23 +06:00
acc067585d add build instructions in README 2020-05-14 13:44:18 +06:00
47aa1a0795 fixes in CHANGELOG and docs 2020-05-14 13:26:56 +06:00
b40cc0c1ea fixes 2020-05-14 13:11:46 +06:00
b5632626ad small extention docs for RequestsExecutor 2020-05-14 12:21:38 +06:00
67fafdac00 add docs for RequestsExecutor 2020-05-14 12:14:38 +06:00
738e628a89 small change of deprecations message 2020-05-13 23:25:22 +06:00
420b846466 replace long polling and webhook tools 2020-05-13 23:22:35 +06:00
05e8c9c90d replace webhooks work into api subproject 2020-05-13 21:21:07 +06:00
e776c5182f additional setWebhook 2020-05-13 20:56:03 +06:00
be5b3745b9 extension was added 2020-05-13 20:01:58 +06:00
0de1d9cfda UpdateDeserializationStrategy currently is public 2020-05-13 19:53:27 +06:00
01da98d2fe start 0.27.3 2020-05-13 19:48:07 +06:00
e985100c21 Update README.md 2020-05-13 19:41:46 +06:00
671faabef9 add telegramBot function 2020-05-12 18:52:37 +06:00
bb9c9e22a2 remove dokka docs from github 2020-05-12 00:14:16 +06:00
42228f0eaa Merge pull request #86 from InsanusMokrassar/0.27.2
0.27.2
2020-05-11 23:42:17 +06:00
dafd0a8ece add docs 2020-05-11 23:37:38 +06:00
bee9d82372 update folder of dokka 2020-05-11 23:24:26 +06:00
ec6cf0f029 docs 2020-05-11 20:44:03 +06:00
9cee22165d start normal filling of docs 2020-05-11 20:32:14 +06:00
a58aad1198 update docs generation 2020-05-11 13:56:45 +06:00
aa78d99179 add docs project 2020-05-11 01:09:07 +06:00
603efe9259 small update of utils readme 2020-05-10 16:40:53 +06:00
21e3e10222 renames 2020-05-10 16:33:44 +06:00
34eb6eb4bf add ChatEventsConversations and refill README of telegramboapi-extensions-utils 2020-05-10 16:25:42 +06:00
565a724b9c remove todo from thumbed input media 2020-05-10 15:30:23 +06:00
e87c4a0126 MediaGroupMemberInputMedia deserialization 2020-05-10 15:26:07 +06:00
9b16d5d82b add MimeType 2020-05-10 14:37:55 +06:00
9747c8bff1 warnings fixes 2020-05-09 21:04:56 +06:00
3ee84700f4 update versions 2020-05-09 20:57:55 +06:00
04a463f42c start 0.27.2 2020-05-09 20:52:52 +06:00
668a201789 Merge pull request #85 from InsanusMokrassar/0.27.1
0.27.1
2020-04-25 10:12:53 +06:00
b336b17eef FullTextSourcesList 2020-04-25 09:57:59 +06:00
76b25d719a explanation small utils and explanationLimit 2020-04-25 09:48:23 +06:00
a4d077dd17 add Explained interface and use it in polls 2020-04-25 09:41:04 +06:00
469712150b started 0.27.1 2020-04-25 09:26:10 +06:00
fad27ede78 Merge pull request #84 from InsanusMokrassar/0.27.0
0.27.0
2020-04-24 21:25:11 +06:00
1de90412b3 addition in changelog 2020-04-24 21:24:24 +06:00
215c8793e1 optimize imports 2020-04-24 20:25:53 +06:00
54835f97d1 update TelegramBotAPI utils readme 2020-04-24 20:23:25 +06:00
923e929670 update TelegramBotAPI readme 2020-04-24 20:16:12 +06:00
37488e92e6 utils ScheduledCloseInfo shortcuts 2020-04-24 20:01:20 +06:00
830ca8122d add openPeriodPollSecondsLimit and checks 2020-04-24 19:46:47 +06:00
fbb2758bdb update changelog 2020-04-24 19:26:57 +06:00
a5c3e06f1c remove List<TextPart> extensions for texts due to JVM signature conflict and actualize TelegramBotAPI-extensions-api 2020-04-24 19:24:49 +06:00
c6fb50c4a6 SendPoll#closeInfo functionality 2020-04-24 19:08:54 +06:00
976c0b86dc send quiz poll functionality 2020-04-24 18:46:26 +06:00
fee5d8f925 texts and captions utils 2020-04-24 18:44:04 +06:00
808746e12d Dice#emoji support 2020-04-24 18:25:47 +06:00
3fb80dd475 add support of income explanation functionality in polls and polls auto close functionality 2020-04-24 17:51:09 +06:00
db8ea0da94 update versions 2020-04-24 16:18:07 +06:00
fbdfb714a3 started 0.27.0 2020-04-24 16:13:02 +06:00
1facfbc2b7 Merge pull request #83 from InsanusMokrassar/0.26.4
0.26.4
2020-04-22 15:08:35 +06:00
914a0662a9 CallbackGameInlineKeyboardButton now have only one income parameter 2020-04-22 14:11:46 +06:00
eda3003b7d change the way how we are deserializing updates in webhooks 2020-04-22 13:20:15 +06:00
459942de36 webhook update handling enhancement 2020-04-22 13:16:46 +06:00
17f64f9b48 CallbackGame update 2020-04-22 13:08:05 +06:00
3f896c2240 fix not implemented error thrown 2020-04-22 13:05:57 +06:00
94f8c971c5 started 0.26.4 2020-04-22 13:01:17 +06:00
c43109c063 Update README.md 2020-04-17 15:52:47 +06:00
f6058e29b4 Update README.md 2020-04-17 15:52:28 +06:00
3a37311331 Update README.md 2020-04-17 15:52:03 +06:00
9fe1472e64 update readme for help on JS platform 2020-04-17 15:43:43 +06:00
f1480c40a7 Merge pull request #81 from InsanusMokrassar/0.26.3
0.26.3
2020-04-13 12:55:48 +06:00
88eebdc448 small optimization of updates polling exception handling 2020-04-13 12:53:02 +06:00
8c76283db5 suspend inline function handleSafely was added 2020-04-13 12:40:14 +06:00
7668c48081 BaseEditMessageUpdate#data now is CommonMessage 2020-04-13 12:09:59 +06:00
35d2135f73 update serialization of InlineKeyboardButton 2020-04-13 11:31:36 +06:00
1cb0e096be fixes in InlineKeyboardButtonSerializer 2020-04-13 11:20:39 +06:00
31f7c7f31b UnknownUpdateType even if serialization exception 2020-04-13 11:17:15 +06:00
82d3b3bc48 add UnknownInlineKeyboardButton 2020-04-13 11:11:09 +06:00
b3734a5c2a fix of changelog 2020-04-13 01:46:58 +06:00
55b8736d50 Merge pull request #80 from Djaler/inline-keyboard-button-callback-game
Add support for inline keyboard buttons with callback_game field
2020-04-13 01:40:52 +06:00
3334fd3ca6 started 0.26.3 2020-04-13 01:39:31 +06:00
Kirill Romanov
e2416b405a add support for inline keyboard buttons with callback_game field 2020-04-12 22:30:37 +03:00
14f012fbfa Update README.md 2020-04-09 01:24:55 +06:00
1ff55057f2 Merge pull request #78 from InsanusMokrassar/0.26.2
0.26.2
2020-04-08 16:48:00 +06:00
71b5e33dbc update common README 2020-04-08 15:28:03 +06:00
08d9d183f4 add filterCommandsWithArgs 2020-04-08 15:23:12 +06:00
7183634fd6 experimentally make source string available inside of text sources 2020-04-08 15:17:13 +06:00
cf9f270651 rename new getting updates extension to avoid JVM signature collisions 2020-04-08 14:56:56 +06:00
bd87938e9c fixes in UpdatesChatFilters 2020-04-08 14:51:26 +06:00
ba76eaeb90 update readmes 2020-04-08 14:34:55 +06:00
d8492ae168 fixes, new readme 2020-04-08 14:02:55 +06:00
0db85232d3 fixes in changelog 2020-04-08 13:20:48 +06:00
bcf2325be8 make new startGettingOfUpdates more useful 2020-04-08 13:19:19 +06:00
51174a13de added some of extensions in TelegramBotAPI-extensions-utils 2020-04-08 11:50:47 +06:00
dfc1fa4d7e refill of changelog 2020-04-08 11:11:31 +06:00
10a1d1cb38 add TelegramBotAPI-extensions-utils 2020-04-08 11:05:48 +06:00
6c39dc4d06 new startGettingOfUpdates extension 2020-04-08 10:44:44 +06:00
4877b8958e start 0.26.2 2020-04-08 10:37:05 +06:00
db9c460e66 Merge pull request #75 from InsanusMokrassar/0.26.1
0.26.1
2020-04-06 12:15:27 +06:00
2bd5d53b2a fill changelog 2020-04-06 12:11:14 +06:00
577436843d fixes 2020-04-06 12:09:59 +06:00
048aa93044 InvalidPhotoDimensionsException 2020-04-05 14:06:40 +06:00
4e49de0dd7 fix in hashtag 2020-04-04 12:12:12 +06:00
9dc5a7624d complete CHANGELOG 2020-04-03 14:26:32 +06:00
21a15db031 StorageFile improvement 2020-04-03 14:22:34 +06:00
a6aa4b8758 BotCommand checks 2020-04-01 10:08:44 +06:00
e85d5df03e started 0.26.1 2020-04-01 10:05:30 +06:00
6833640c48 Create write-good.yml 2020-03-31 19:13:48 +06:00
c22c1bb144 Merge pull request #74 from InsanusMokrassar/0.26.0
0.26.0
2020-03-31 11:45:47 +06:00
8293d6683c optimize imports 2020-03-31 11:41:58 +06:00
7e6e892c45 libraries updates 2020-03-31 11:31:24 +06:00
43ac09a79b fixes in startGettingUpdates 2020-03-31 11:28:48 +06:00
ee1f115d77 refill TelegramBotAPI-extensions-api 2020-03-31 11:11:37 +06:00
7d85b6fb88 update readme of telegram bot api 2020-03-31 11:00:22 +06:00
013944c5c9 real fix:) 2020-03-30 22:52:57 +06:00
55ed3e165b resolve compiling errors 2020-03-30 22:47:20 +06:00
9c0106d229 StickerSetAction -> StandardStickerSetAction 2020-03-30 22:31:54 +06:00
9cd2a6220c add setStickerSetThumb 2020-03-30 22:29:34 +06:00
033ec8f2da update version 2020-03-30 22:18:59 +06:00
274afe8efc addAnimatedStickerToSet 2020-03-30 22:12:31 +06:00
e60630b331 add StickerSet#thumb 2020-03-30 22:07:13 +06:00
f6692a22d1 create new animated sticker set 2020-03-30 22:03:59 +06:00
53257ff131 hotfix for setMyCommands request 2020-03-30 21:53:36 +06:00
ec70813e49 commands handling added 2020-03-30 21:52:00 +06:00
54589ed17b BotCommand 2020-03-30 21:40:36 +06:00
1d3736c44e add realisation of DiceContent#createResend 2020-03-30 21:37:30 +06:00
8ef7acab2d sendDice in extensions api 2020-03-30 21:33:17 +06:00
c3fca5c6c4 include dice in TelegramBotAPI 2020-03-30 21:30:22 +06:00
84d2c88032 started 0.25.2 2020-03-30 21:16:04 +06:00
b7ec2f2b86 Merge pull request #71 from InsanusMokrassar/0.25.1
0.25.1
2020-03-26 14:36:00 +06:00
97d6d3ad13 update kotlin 2020-03-26 14:27:17 +06:00
3dd428c7d9 fix of error inside of update utils for media groups 2020-03-26 14:26:44 +06:00
688de1053b started 0.25.1 2020-03-26 14:13:00 +06:00
a4fae36b22 hotfix for ExtendedUser 2020-03-22 22:57:01 +06:00
909a7fd26a add ExtendedUser 2020-03-22 22:37:26 +06:00
041232e260 FlowUpdatesFilter update 2020-03-22 17:21:01 +06:00
d4c409107a Merge pull request #69 from InsanusMokrassar/0.25.0
0.25.0
2020-03-22 16:50:50 +06:00
a0db95d929 suppressions nad compiler args 2020-03-22 16:41:48 +06:00
fb34b0bec1 optimize imports 2020-03-22 16:04:11 +06:00
d18863b7b3 TelegramDateTests now using strict json 2020-03-22 15:56:05 +06:00
c5c8a743e6 fixes in ChatIdentifierSerializer 2020-03-22 15:53:37 +06:00
89881a7349 removing of deprecations 2020-03-22 15:15:01 +06:00
865edf385f fix several todo 2020-03-22 14:07:00 +06:00
c85faa73c0 fixes 2020-03-22 13:53:42 +06:00
6b3f836096 new libraries versions adaptation 2020-03-22 13:37:01 +06:00
574ffbc44d update versions 2020-03-22 13:04:40 +06:00
a0120afb08 now bot username is not nullable 2020-03-22 12:56:52 +06:00
0b4b4950c2 started 0.25.0 2020-03-22 12:54:15 +06:00
b3391330a0 add setting up of socketTimeoutMillis inside of abstract request call factory for GetUpdates 2020-03-19 12:41:16 +06:00
518dee46b3 now startGettingOfUpdates have exceptions handler as argument 2020-03-19 12:03:40 +06:00
c9de4bc79e hotfix for installing of HttpTimeout inside of client only in case when it was not installed previously 2020-03-19 11:10:18 +06:00
badb138bc1 Merge pull request #67 from InsanusMokrassar/0.24.1
0.24.1
2020-03-18 23:02:01 +06:00
4b980d3f44 remove redundant import from webhooks 2020-03-18 22:58:23 +06:00
b11da02c8b refactor UpdatesUtils 2020-03-18 22:56:57 +06:00
71c0b688e8 fixes and improvements 2020-03-17 21:24:04 +06:00
d61aa8b50e getting updates refactoring 2020-03-17 20:24:31 +06:00
be64287c42 copypaste functions from TelegramBotAPI to TelegramBotAPI-extensions-api with adaptation of updates 2020-03-17 19:50:25 +06:00
e7027047cb abstracts for difference between sent and edited messages updates 2020-03-17 19:46:42 +06:00
944d15f326 new startGettingUpdates method 2020-03-17 17:20:42 +06:00
ba2c4cbb30 UpdatesFilter now is interface 2020-03-17 17:16:14 +06:00
244a1e5175 replacement of UpdatesPolling help functions 2020-03-17 16:59:28 +06:00
9c9a938d94 started 0.24.1 2020-03-17 16:47:59 +06:00
a2a403045b a little fix on README 2020-03-17 13:30:01 +06:00
6858af14f8 update info sections 2020-03-17 13:25:10 +06:00
779009c2a6 Merge pull request #66 from InsanusMokrassar/0.24.0
0.24.0
2020-02-25 21:01:46 +06:00
b22d8a5a25 ForwardFromChannelInfo#channelChat now is ChannelChat 2020-02-25 13:45:32 +06:00
54e3c43999 Most part of sending media messages functions was removed and replaced with their InputFile args analogs 2020-02-23 21:29:31 +06:00
f8a312acb3 removing of deprecations 2020-02-23 20:23:33 +06:00
a51e68be04 Update LICENSE 2020-02-19 22:29:53 +06:00
39dab0b970 Replace build badge and link it with travis 2020-02-19 20:12:54 +06:00
b42a6ca0cf Create .travis.yml 2020-02-19 20:08:15 +06:00
a34e67722b update telegrambotapi-extensions-api readme 2020-02-18 19:10:08 +06:00
c0e660c8d3 replace awesome badge 2020-02-17 15:35:33 +06:00
7cca12930c fixes and fill up 2020-02-17 15:33:28 +06:00
5da60b4ac2 update README 2020-02-17 15:25:08 +06:00
51dac40e45 now for extensions api system environment will be checked too 2020-02-17 11:49:48 +06:00
51fc33960a now group is common 2020-02-17 11:47:43 +06:00
b89b798eb6 remove redundant readme 2020-02-15 16:58:26 +06:00
a9326bb374 Merge pull request #65 from InsanusMokrassar/0.23.3
0.23.3
2020-02-15 16:57:29 +06:00
edad64c6e3 actualize changelog 2020-02-15 16:56:15 +06:00
8c06322586 now LiveLocation is deprecated in TelegramBotAPI and placed into TelegramBotAPI-extensions-api 2020-02-15 16:19:12 +06:00
9684e55c12 update group badge
update group badge

update group badge
2020-02-15 16:11:42 +06:00
d7d92cd83f fixes in readme 2020-02-15 15:49:29 +06:00
7229d96ce7 remove redundant .gitignore 2020-02-15 15:38:24 +06:00
c32ab031dd fill changelog 2020-02-15 15:37:15 +06:00
a8d7104145 extract RequestsExecutor extensions 2020-02-15 15:33:04 +06:00
ff550fafde add subproject TelegramBotAPI-extensions-api 2020-02-15 01:23:52 +06:00
1dbb0e669d started 0.23.3 2020-02-15 00:55:37 +06:00
723818f04f improve badge 2020-02-15 00:54:44 +06:00
0c107bc512 replace TelegramBotAPI to the separated subproject 2020-02-15 00:50:35 +06:00
945df1bc5f Add chat badge in README 2020-02-14 19:18:15 +06:00
239d740587 Make text in chat badge less 2020-02-14 19:15:36 +06:00
5fdcf252b2 Create chat.svg 2020-02-14 19:14:30 +06:00
a17ae07e50 InputMedia#media fix (version 0.23.2) 2020-02-14 12:06:54 +06:00
8bbfa2ee24 Create FUNDING.yml 2020-02-10 23:13:07 +06:00
4b908f9975 Now it is possible to send broadcast channels size for FlowsUpdatesFilter 2020-02-09 15:15:36 +06:00
542fcef6da optimize imports 2020-02-08 00:00:52 +06:00
0959c0b0d7 Merge pull request #64 from InsanusMokrassar/0.23.1
0.23.1
2020-02-07 23:12:13 +06:00
34f606545e additional fixes in live location 2020-02-07 22:45:57 +06:00
0e33b123e9 additional fixes in live location 2020-02-07 22:43:48 +06:00
d6bbb0cadc update LiveLocation logic 2020-02-07 22:36:15 +06:00
8fd6a09763 toInputFile specifying return types 2020-02-07 22:12:18 +06:00
aa333d7c58 fill CHANGELOG and update README 2020-02-07 11:00:21 +06:00
fe8c3392fa Actialize bot action tests 2020-02-07 10:49:16 +06:00
c2c7ac0d1e InvoiceOfPayment is renamed to InvoiceContent 2020-02-07 10:47:35 +06:00
04e4407b96 fill changelog about new actions 2020-02-07 10:36:31 +06:00
60a30f972f add additional methods for quiz poll 2020-02-07 10:33:36 +06:00
9ed1500bee add additional methods for regular poll 2020-02-07 10:31:22 +06:00
7d0009039f logical fixes 2020-02-07 10:12:21 +06:00
e43ad41d2f complete filling of requests extensions 2020-02-07 00:56:32 +06:00
c7d5fdd2e0 fill edit and stop live location methods 2020-02-07 00:40:47 +06:00
e7bdc85279 precomplete of games extensions 2020-02-07 00:29:50 +06:00
dcfa198c8c send game and other extensions 2020-02-07 00:25:24 +06:00
a846d0031c updates in sendInvoice and its extensions 2020-02-07 00:15:28 +06:00
0dd632eb46 add send invoice extensions 2020-02-07 00:01:21 +06:00
dfe5595fd3 add delete sticker from set 2020-02-06 23:55:17 +06:00
945dd05cfd add add sticker to set and set sticker position in set extensions 2020-02-06 23:54:14 +06:00
09c623c1d7 add create new sticker set extensions 2020-02-06 23:46:16 +06:00
269a4dd707 add upload sticker file extensions 2020-02-06 23:39:57 +06:00
2399dc0d0a add get sticker set extensions 2020-02-06 23:38:37 +06:00
3a0be49cc5 additions in sendSticker 2020-02-06 23:35:51 +06:00
28898ea2d4 add sendSticker extensions 2020-02-06 23:33:58 +06:00
679f282bd2 refactor delete extensions 2020-02-06 23:28:46 +06:00
02fa83c92a small refactor in PinChatMessage 2020-02-06 23:17:55 +06:00
69f81785bf rename RequestsExecutor#setChatPermissions -> RequestsExecutor#setDefaultChatMembersPermissions 2020-02-06 23:15:13 +06:00
86f1e3ea36 add get file info extensions 2020-02-06 23:12:49 +06:00
be4043f3c2 fix in RequestsExecutor#getUserProfilePhotos extension 2020-02-06 23:09:01 +06:00
b4d0ca507b add get user profile photos extensions 2020-02-06 23:08:13 +06:00
cc433d4091 add send bot action extensions 2020-02-06 23:06:29 +06:00
f8ffd5fec3 add send polls extensions 2020-02-06 22:52:10 +06:00
799eadd7a7 add send contact extensions 2020-02-06 22:44:26 +06:00
bc7cfc0d32 add send venue extensions 2020-02-06 22:40:19 +06:00
4ca8125637 add send location extensions and LiveLocation 2020-02-06 22:32:20 +06:00
5475f27a24 add send video note extensions 2020-02-06 21:41:46 +06:00
6d425cc0f6 add send video extensions 2020-02-06 21:36:18 +06:00
ff3ef6e957 add send voice extensions 2020-02-06 21:27:42 +06:00
28eecfa3ef add send animation extensions 2020-02-06 21:23:59 +06:00
56663d8e73 add send document extensions 2020-02-06 21:15:17 +06:00
2fd842746b add send audio extensions 2020-02-06 21:05:16 +06:00
5e5dc105a5 refactor type inside edit messages extensions 2020-02-06 20:36:29 +06:00
6cf836708d complete filling of until SendPhoto for usefull extensions 2020-02-06 14:25:17 +06:00
5e6ff01940 complete update methods 2020-02-06 14:05:36 +06:00
2cfabb1c2a update Chat dependency in methods 2020-02-06 13:38:52 +06:00
de1d6aa70c LeaveChat and ExportChatInviteLink now have one more extension 2020-02-06 13:31:53 +06:00
90d5833021 CommonMultipartFileRequest now is internal 2020-02-06 13:29:14 +06:00
527b718f55 chat methods now have additional usefull extensions 2020-02-06 13:27:58 +06:00
2eb2d25662 complete answers extensions 2020-02-06 12:54:55 +06:00
9c25254937 AnswerInlineQuery simple sending extensions 2020-02-06 12:38:56 +06:00
601958a513 AnswerCallbackQuery simple sending extensions 2020-02-06 12:12:20 +06:00
ab6688bbaa additional KtorUpdatesPoller method 2020-02-06 12:08:31 +06:00
4f2a8e49bc Add maven version badge 2020-02-04 13:46:07 +06:00
0ce9080efc Add awesome badge due to merged PR in kotlin awesome
https://github.com/KotlinBy/awesome-kotlin/pull/526
2020-02-04 13:42:06 +06:00
f2701b920f start 0.23.1 2020-02-01 14:14:45 +06:00
a3b29f7db5 update link to unsupported passport API changelog 2020-01-29 12:04:40 +06:00
43a36072f1 Merge pull request #63 from InsanusMokrassar/0.23.0
0.23.0
2020-01-23 22:37:34 +06:00
668 changed files with 11021 additions and 2345 deletions

5
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
# These are supported funding model platforms
patreon: InsanusMokrassar
custom: ['https://paypal.me/InsanusMokrassar?locale.x=ru_RU']

10
.github/labeler.yml vendored Normal file
View File

@@ -0,0 +1,10 @@
api: "TelegramBotAPI-extensions-api/**"
utils: "TelegramBotAPI-extensions-utils/**"
core: "TelegramBotAPI/**" # currently not work
code: "**/*.kt"
gradle: "**/*.gradle"
versions: "**/gradle.properties"
markdown:
- "**/*.md"
- "!CHANGELOG.md"

13
.github/workflows/greetings.yml vendored Normal file
View 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'

18
.github/workflows/label.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
# 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
steps:
- uses: actions/labeler@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"

1
.github/write-good.yml vendored Normal file
View File

@@ -0,0 +1 @@
spellchecker: true

3
.gitignore vendored
View File

@@ -8,3 +8,6 @@ settings.xml
.gradle/
build/
out/
local.properties
secret.gradle

13
.travis.yml Normal file
View File

@@ -0,0 +1,13 @@
language: java
install: true
os: linux
dist: trusty
jdk: oraclejdk8
jobs:
include:
- stage: build
script: ./gradlew build -s -x jvmTest -x jsIrTest -x jsIrBrowserTest -x jsIrNodeTest -x jsLegacyTest -x jsLegacyBrowserTest -x jsLegacyNodeTest
- state: test
script: ./gradlew allTests

View File

@@ -1,5 +1,544 @@
# TelegramBotAPI changelog
## 0.28.0
**THIS VERSION CONTAINS BREAKING CHANGES**
***PROJECT PACKAGES WERE CHANGED***
* Project `TelegramBotAPI` -> `TelegramBotAPI-core`
* Project `TelegramBotAPI-all` -> `TelegramBotAPI`
* `Common`:
* Version updates:
* `Kotlin`: `1.3.72` -> `1.4.0`
* `Coroutines`: `1.3.8` -> `1.3.9`
* `Serialization`: `0.20.0` -> `1.0.0-RC`
* `Klock`: `1.11.14` -> `1.12.0`
* `UUID`: `0.1.1` -> `0.2.1`
* `Ktor`: `1.3.2` -> `1.4.0`
* `buildMimeType` function now is cache-oriented getter which will save already got mime types into internal map
* All deprecations from previous versions were removed
* `TelegramBotAPI-core`:
* Typealias `TelegramBot` was added
* Fully rebuilt `KtorCallFactory` interface to be able to handle custom answers from telegram bot api system
* New implementation of `KtorCallFactory` was added: `DownloadFileRequestCallFactory`
* `DownloadFile` request was added
* All included `KtorCallFactory` realizations (except of abstract) now are objects:
* `MultipartRequestCallFactory`
* `SimpleRequestCallFactory`
* `MediaGroupMemberInputMedia` members now will not have `arguments` property due to redundancy and buggy of that
* Field `media` now is common for all `InputMedia` objects
* `TelegramBotAPI-extensions-api`:
* Extensions `TelegramBot#downloadFile` were added
* `TelegramBotAPI-extensions-utils`:
* All extensions for media groups (except of `mediaGroupId`) have changed their context: `List<MediaGroupMessage>`
-> `List<CommonMessage<MediaGroupContent>>`
* `forwardInfo`
* `replyTo`
* `chat`
* `createResend` (several extensions)
* Several extensions for downloading of files:
* `HttpClient#loadFile`
* `PathedFile#download`
### 0.28.3
* Common:
* Version updates:
* `Klock`: `0.12.0` -> `0.12.1`
* `Kotlin serialization`: `1.0.0-RC` -> `1.0.0-RC2` (dependency `kotlinx-serialization-core` was replaced with
`kotlinx-serialization-json` due to [kotlinx.serialization library update](https://github.com/Kotlin/kotlinx.serialization/blob/master/CHANGELOG.md#100-rc2--2020-09-21))
* `TelegramBotAPI-core`:
* All `InlineQueryResult` has changed their type of id for more obvious relation between `InlineQueryResult#id` and
`ChosenInlineResult#resultId`: `String` -> `InlineQueryIdentifier`
* `TelegramBotAPI-extensions-utils`:
* Several extensions for updates flows based on `InlineQueryUpdate` has been added:
* `Flow<InlineQueryUpdate>#onlyBaseInlineQueriesWithUpdates`
* `Flow<InlineQueryUpdate>#onlyBaseInlineQueries`
* `Flow<InlineQueryUpdate>#onlyLocationInlineQueriesWithUpdates`
* `Flow<InlineQueryUpdate>#onlyLocationInlineQueries`
* Several extensions for updates flows based on `ChosenInlineResultUpdate` has been added:
* `Flow<ChosenInlineResultUpdate>.onlyBaseChosenInlineResultsWithUpdates`
* `Flow<ChosenInlineResultUpdate>.onlyBaseChosenInlineResults`
* `Flow<ChosenInlineResultUpdate>.onlyLocationChosenInlineResultsWithUpdates`
* `Flow<ChosenInlineResultUpdate>.onlyLocationChosenInlineResults`
### 0.28.2
* `TelegramBotAPI-extensions-utils`:
* Several commands shortcuts for `Flow<ContentMessage<TextContent>>` has been added:
* `filterExactCommands`
* `filterCommandsInsideTextMessages`
* `filterCommandsWithArgs`
* Extension `Flow<BaseSentMessageUpdate>.filterCommandsWithArgs` has changed its signature: now it will also have
original message paired with list of text sources
* Shortcut method `commonMessages` for `onlyCommonMessages`
* Shortcuts `onlySentViaBot` and `withoutSentViaBot` now are extensions for any `Flow` with types which implementing
`ContentMessage`
### 0.28.1
* Common:
* Versions updates:
* `Kotlin`: `1.4.0` -> `1.4.10`
* `UUID`: `0.2.1` -> `0.2.2`
* `TelegramBotAPI-core`:
* `ExceptionHandler` has changed its incoming type: `Exception` -> `Throwable`
* `handleSafely` has changed its signature
* `executeUnsafe` has changed its signature
## 0.27.0
* `Common`:
* Versions updates:
* `Kotlin`: `1.3.71` -> `1.3.72`
* `Klock`: `1.10.3` -> `1.10.5`
* `TelegramBotAPI`:
* Typealias `LongSeconds` was added for correct explanation of seconds in `Long` primitive type
* Several new fields was added:
* `explanationField`
* `explanationEntitiesField`
* `openPeriodField`
* `closeDateField`
* Extension `List<TextPart>#justTextSources` was added for mapping of `List<TextPart>` to `List<TextSource>`
* Field `SendPoll#closeInfo` was added
* Range `openPeriodPollSecondsLimit` was added and used in all `SendPoll` requests for checking income data
* `SendQuizPoll` now able to use fields `caption` and `parseMode` for `explanation` functionality
* `quizPollExplanationLimit` was added for checking `QuizPoll` explanation size
* Field `TextLinkTextSource#url` was added
* Field `TextMentionTextSource#user` was added
* Sealed class `ScheduledCloseInfo` was added
* Class `ExactScheduledCloseInfo` was added for cases with `close_date`
* Class `ApproximateScheduledCloseInfo` was added for cases with `open_period`
* Field `Poll#scheduledCloseInfo` was added
* Sealed class `MultipleAnswersPoll` was added
* Class `RegularPoll` now extends `MultipleAnswersPoll`
* `Dice` class was replaced into new package
* Sealed class `DiceAnimationType` was added
* Field `Dice#animationType` was added as `emoji` API representation
* `SendDice` now receive `animationType` as second parameter
* For `List<TextSource>` was added several extensions:
* `toMarkdownCaptions`
* `toMarkdownTexts`
* `toMarkdownV2Captions`
* `toMarkdownV2Texts`
* `toHtmlCaptions`
* `toHtmlTexts`
* `TelegramBotAPI-extensions-api`:
* All `RequestsExecutor#sendDice` extensions now accept `DiceAnimationType?` as second parameter
* All `RequestsExecutor#sendRegularPoll` extensions now accept `ScheduledCloseInfo` fourth parameter
* All `RequestsExecutor#sendQuizPoll` extensions now accept additional parameters `caption: String` and
`parseMode: ParseMode` for `explanation` functionality and `closeInfo: ScheduledCloseInfo?` for autoclose poll
functionality
* `TelegramBotAPI-extensions-utils`:
* Several shortcuts for `ScheduledCloseInfo` was added:
* `closePollExactAt`
* `closePollExactAfter`
* `closePollAfter`
### 0.27.11
* `TelegramBotAPI`:
* Extension `String#filenameFromUrl` was created
* Extension `PathedFile#filename` was created
* `TelegramBotAPI-extensions-utils`:
* `Flow<Iterable<T>>.flatMap` extension was added
* Extensions for `FlowUpdatesFilter` were added:
* `FlowsUpdatesFilter#allSentMessagesFlow` (combination of `messageFlow` and `channelPostFlow`)
* `FlowsUpdatesFilter#allSentMediaGroupsFlow` (combination of `messageMediaGroupFlow` and `channelPostMediaGroupFlow`)
* `FlowsUpdatesFilter#sentMessages`
* `FlowsUpdatesFilter#sentMessagesWithMediaGroups`
* `FlowsUpdatesFilter#photoMessagesWithMediaGroups`
* `FlowsUpdatesFilter#imageMessagesWithMediaGroups`
* `FlowsUpdatesFilter#videoMessagesWithMediaGroups`
* `FlowsUpdatesFilter#mediaGroupMessages`
* `FlowsUpdatesFilter#mediaGroupPhotosMessages`
* `FlowsUpdatesFilter#mediaGroupVideosMessages`
* A lot of extensions like `Flow<BaseSentMessageUpdate>#textMessages` were added:
* `Flow<BaseSentMessageUpdate>#animationMessages`
* `Flow<BaseSentMessageUpdate>#audioMessages`
* `Flow<BaseSentMessageUpdate>#contactMessages`
* `Flow<BaseSentMessageUpdate>#diceMessages`
* `Flow<BaseSentMessageUpdate>#documentMessages`
* `Flow<BaseSentMessageUpdate>#gameMessages`
* `Flow<BaseSentMessageUpdate>#invoiceMessages`
* `Flow<BaseSentMessageUpdate>#locationMessages`
* `Flow<BaseSentMessageUpdate>#photoMessages`
* `Flow<BaseSentMessageUpdate>#imageMessages`
* `Flow<BaseSentMessageUpdate>#pollMessages`
* `Flow<BaseSentMessageUpdate>#stickerMessages`
* `Flow<BaseSentMessageUpdate>#textMessages`
* `Flow<BaseSentMessageUpdate>#venueMessages`
* `Flow<BaseSentMessageUpdate>#videoMessages`
* `Flow<BaseSentMessageUpdate>#videoNoteMessages`
* `Flow<BaseSentMessageUpdate>#voiceMessages`
* `Flow<BaseSentMessageUpdate>#mediaGroupMessages`
* `Flow<BaseSentMessageUpdate>#mediaGroupPhotosMessages`
* `Flow<BaseSentMessageUpdate>#mediaGroupVideosMessages`
### 0.27.10
* `TelegramBotAPI-extensions-api`:
* Function `telegramBot(TelegramAPIUrlsKeeper)` was added
* `TelegramBotAPI-extensions-utils`:
* Extension `Route#includeWebhookHandlingInRouteWithFlows` was added
* A lot of extensions like `FlowsUpdatesFilter#textMessages` were added:
* `FlowsUpdatesFilter#animationMessages`
* `FlowsUpdatesFilter#audioMessages`
* `FlowsUpdatesFilter#contactMessages`
* `FlowsUpdatesFilter#diceMessages`
* `FlowsUpdatesFilter#documentMessages`
* `FlowsUpdatesFilter#gameMessages`
* `FlowsUpdatesFilter#invoiceMessages`
* `FlowsUpdatesFilter#locationMessages`
* `FlowsUpdatesFilter#photoMessages`
* `FlowsUpdatesFilter#imageMessages`
* `FlowsUpdatesFilter#pollMessages`
* `FlowsUpdatesFilter#stickerMessages`
* `FlowsUpdatesFilter#textMessages`
* `FlowsUpdatesFilter#venueMessages`
* `FlowsUpdatesFilter#videoMessages`
* `FlowsUpdatesFilter#videoNoteMessages`
* `FlowsUpdatesFilter#voiceMessages`
### 0.27.9
* `Common`
* Versions updates:
* `Gradle Wrapper`: `6.5-all` -> `6.5.1-bin`
* `Coroutines`: `1.3.7` -> `1.3.8`
* `Klock`: `1.11.3` -> `1.11.14`
* `UUID`: `0.1.0` -> `0.1.1`
### 0.27.8
* `TelegramBotAPI`:
* `UnknownUpdateType` was renamed to `UnknownUpdate`
* Refactoring and optimization of `FlowsUpdatesFilter`
* `Venue` type was replaced to a new package: `com.github.insanusmokrassar.TelegramBotAPI.types.venue.Venue`
* `Venue` type now implements `Locationed` and delegate realisation to its `location` field
* `FoursquareId` and `FoursquareType` typealiases were added
* `TelegramBotAPI-extensions-utils`:
* Several new functions `makeLinkToMessage` was added
* `Foursquare` data class was added
* Extension `Venue#foursquare` was added
* Factory function `Venue` with `Foursquare` parameter was added
### 0.27.7
* `TelegramBotAPI`:
* Operator function `unaryPlus` was added to `RowBuilder`. Now it is possible to write `row { +button }`
* Function `flatMatrix` was added for single-row columns
* Operator extension `RowBuilder#plus` was added to be able to write things like `row { this + button }`
* `TelegramBotAPI-extensions-api`:
* Extensions `RequestsExecutor#sendVenue` with `Location` args were added
* `TelegramBotAPI-extensions-utils`:
* Function `InlineKeyboardMarkup` for flat keyboards was added
* Function `ReplyKeyboardMarkup` for flat keyboards was added
### 0.27.6
* `Common`:
* Versions:
* `Kotlin Coroutines`: `1.3.6` -> `1.3.7`
* `TelegramBotAPI`:
* Interface `PossiblySentViaBot` has been added
* Additional interface `PossiblySentViaBotCommonMessage` was added for more explicit typing declaration for
compiler
* Currently, only `ChannelMessage` and `CommonMessageImpl` are implementing the interface
`PossiblySentViaBotCommonMessage`. It could be changed in future
* Factory `buildMimeType` was added
* `BuiltinMimeTypes` was added
* Abstraction `ThumbedWithMimeTypeInlineQueryResult` with `thumbMimeType` field was added
* `InlineQueryResultGif` and `InlineQueryResultMpeg4Gif` now extend `ThumbedWithMimeTypeInlineQueryResult`
instead of `ThumbedInlineQueryResult`
* `TelegramBotAPI-extensions-utils`:
* New extensions `onlyCommonMessages`, `onlySentViaBot` and `withoutSentViaBot` was added
### 0.27.5
* `Common`:
* Versions:
* `Klock`: `1.11.1` -> `1.11.3`
* `TelegramotAPI`:
* Fix: for sending requests caption and text lengths limits were updated
* New variant of `row` was added
* `makeLinkToMessage` extensions has been deprecated (replaced into `TelegramBotAPI-extensions-utils`)
* Next things was deprecated and replaced into `TelegramBotAPI-extensions-utils`:
* All `String` formatting public extensions and functions
* All extensions like `CaptionedInput#toHtmlCaptions`
* All helper extensions for `List<BaseMessageUpdate>`
* All `RequestsExecutor#executeAsync` and `RequestsExecutor#executeUnsafe`
* `BotCommand` now more strictly check commands which passed to it
* Regex `BotCommandNameRegex` was added
* `TelegramBotAPI-extensions-api`:
* A lot of `RequesstExecutor#getChat` extensions was added for more explicit types showing
* New `RequesstExecutor#setMyCommands` extension was added
* New field `BotBuilder#ktorClientEngineFactory` introduced
* Field `BotBuilder#ktorClientEngine` now is deprecated
* `TelegramBotAPI-extensions-utils`:
* `safely` function was introduced. It is in `PreviewFeature` state currently
* `makeLinkToMessage` extensions has been added
* `makeLinkToAddStickerSet` function and its variations were added
* Next tools was added from `TelegramBotAPI`:
* All `String` formatting extensions and functions
* All extensions like `CaptionedInput#toHtmlCaptions`
* All helper extensions for `List<BaseMessageUpdate>`
* Several new extensions for `SentMediaGroupUpdate` were added:
* `SentMediaGroupUpdate#forwardInfo`
* `SentMediaGroupUpdate#replyTo`
* `SentMediaGroupUpdate#chat`
* `SentMediaGroupUpdate#mediaGroupId`
* Several `List<MediaGroupMessage>.createResend` extensions were added
* `RequestsExecutor#executeAsync` and `RequestsExecutor#executeUnsafe`
### 0.27.4
* `TelegramBotAPI-extensions-utils`:
* Several extensions for updates was added:
* `onlyBaseMessageUpdates`
* `onlySentMessageUpdates`
* `onlyEditMessageUpdates`
* `onlyMediaGroupsUpdates`
* `onlySentMediaGroupUpdates`
* `onlyEditMediaGroupUpdates`
* Renames in chat filters extensions:
* `filterBaseMessageUpdates` -> `filterBaseMessageUpdatesByChatId` and `filterBaseMessageUpdatesByChat`
* `filterSentMediaGroupUpdates` -> `filterSentMediaGroupUpdatesByChatId` and `filterSentMediaGroupUpdatesByChat`
### 0.27.3
* `TelegramBotAPI`:
* `UpdateDeserializationStrategy` is publicly available now
* All `setWebhook` extensions was marked as deprecated, renamed and replaced into `TelegramBotAPI-extensions-utils`
* Typealias `ExceptionHandler` was added - it will be used for `handleSafely`
* `SetWebhook` factories signatures was changed (backward compatibility was not broken)
* `executeUnsafe` now working differently
* Now it is possible to pass exceptions handler into `executeUnsafe`
* `BasketballDiceAnimationType` was added
* `UnknownDiceAnimationType` now is deprecated due to renaming - currently it is typealias for `CustomDiceAnimationType`
* `CustomDiceAnimationType` now is `data` class instead of common class
* `FlowsUpdatesFilter` will use size 64 by default for internal broadcast channels
* `TelegramBotAPI-extensions-api`:
* Long Polling extensions now are deprecated in this project. It was replaced into `TelegramBotAPI-extensions-utils`
* Several `telegramBot` functions was renamed into `telegramBotWithCustomClientConfig`
* Add one more `setWebhookInfo` realisation
* `TelegramBotAPI-extensions-utils`:
* Extension `toTelegramUpdate` was added
* Long Polling extensions were added
* Updates utils were added
* New extensions `startListenWebhooks`, `setWebhookInfoAndStartListenWebhooks` and `includeWebhookHandlingInRoute` was added
* New extension `CoroutineScope#updateHandlerWithMediaGroupsAdaptation` was added
* New extension `flowsUpdatesFilter` was added
* `TelegramBotAPI-all`:
* Project was created
### 0.27.2
* `Common`:
* Versions:
* Coroutines: `1.3.5` -> `1.3.6`
* Klock: `1.10.5` -> `1.11.1`
* `TelegramBotAPI`:
* Expected class `MimeType` was added
* Field `MimeTyped#mimeType` now typed by `MimeType` instead of `String`
* `MediaGroupMemberInputMedia` children now can be deserialized (but only those ones who are declared inside library)
* `TelegramBotAPI-extensions-utils`:
* Chat events splitters added:
* Extension `Flow<ChatEventMessage>#onlyChannelEvents` was added
* Extension `Flow<ChatEventMessage>#onlyGroupEvents` was added
* Extension `Flow<ChatEventMessage>#onlySupergroupEvents` was added
### 0.27.1
* `TelegramBotAPI`:
* Interface `Explained` and subsinterfaces `ExplainedInput` and `ExplainedOutput` was added
* Class `QuizPoll` now implement `ExplainedInput`
* In `QuizPoll#caption` and `QuizPoll#captionEntities` are deprecated now
* Class `SendQuizPoll` now implement `ExplainedOutput`
* In `SendQuizPoll#caption` is deprecated now
* `explanationLimit` range was added as future replacement of `quizPollExplanationLimit`
* `quizPollExplanationLimit` now is deprecated
* Extensions `toMarkdownExplanations`, `toMarkdownV2Explanations` and `toHtmlExplanations` was added
* Typealias `FullTextSourcesList` was added
* All extensions `fullEntitiesList` now return `FullTextSourcesList`
* All extensions of `List<TextSource>` now are extensions for `FullTextSourcesList`
* `TelegramBotAPI-extensions-api`:
* `sendQuizPoll` now is using `explanation` parameter instead of `caption`
## 0.26.0
* `Common`:
* Versions updates:
* `Klock`: `1.10.0` -> `1.10.3`
* `TelegramBotAPI`:
* Request `SendDice` was added (calling [sendDice](https://core.telegram.org/bots/api#senddice))
* Class `Dice` was added (type [dice](https://core.telegram.org/bots/api#dice))
* Class `DiceContent` was added (for including it in [message](https://core.telegram.org/bots/api#message) object)
* `BotCommand` was added
* `GetMyCommands` request was added
* `SetMyCommands` request was added
* `GetMe` now is object instead of class
* `GetMe` was replaced into package `com.github.insanusmokrassar.TelegramBotAPI.requests.bot.GetMe`
* `CreateNewStickerSet` renamed to `CreateStaticNewStickerSet`
* `CreateNewAnimatedStickerSet` request was added (it handle work with `tgs_sticker`)
* `StickerSet#thumb` was added
* `AddStickerToSet` renamed to `AddStaticStickerToSet`
* `AddAnimatedStickerToSet` request was added
* `SetStickerSetThumb` request was added
* Most of sticker actions now implements `StandardStickerSetAction` instead of `StickerSetAction`
* `getUpdatesLimit` was added to be ensure in get updates limit
* `GetUpdates` now will check count of requesting updates and throw exception if it is not in range `1 .. 100`
* `GetUpdates#limit` now is not nullable and by default set up to 100
* `TelegramBotAPI-extensions-api`:
* Extensions `sendDice` was added
* Extension `getMyCommands` request was added
* Extension `setMyCommands` request was added
* Extension `getMe` was replaced into package `com.github.insanusmokrassar.TelegramBotAPI.extensions.api.bot.GetMeKt.getMe`
* **All extensions `createNewStickerSet` was renamed to `createNewStaticStickerSet`**
* Extensions `createNewAnimatedStickerSet` was added
* **All extensions `addStickerToSet` was renamed to `addStaticStickerToSet`**
* Extensions `addAnimatedStickerToSet` was added
* Extensions `setStickerSetThumb` was added
* Extension `startGettingUpdates` now will drop `SentMediaGroupUpdate` in case if it is the last in updates group
and size of retrieved updates is equal to 100 (max count of retrieved updates)
* Extensions `getUpdates` now will receive only not nullable `limit` parameter
### 0.26.4
* `TelegramBotAPI`:
* Now any getting of updates will return `UnknownUpdateType` when inside of deserialization will be
`SerializationException` or `NotImplemented` error
* `CallbackGame` currently is an object
* It is possible to use `CallbackGame` for now
* `CallbackGameInlineKeyboardButton` now will not accept `callbackGame` as income object
* Now it is possible to pass exception handler in webhook
### 0.26.3
* `TelegramBotAPI`:
* `CallbackGameInlineKeyboardButton` was added
([Issue-79](https://github.com/InsanusMokrassar/TelegramBotAPI/issues/79),
[PR-80](https://github.com/InsanusMokrassar/TelegramBotAPI/pull/80))
* `UnknownInlineKeyboardButton` was added. It is unavailable for creating, but you can receive it, for example, in
`InlineQueryResult`
* `Update` now will be created even if was `SerializationException` inside of creating the update instance - in this
case will be created `UnknownUpdateType`
* `UnknownUpdateType$rawJson` value now is included (`JsonElement`)
* **EXPERIMENTALLY** `BaseEditMessageUpdate#data` now is `CommonMessage<*>`
* Suspend inline function `handleSafely` was added
* `KtorRequestsExecutor` now use `handleSafely` instead of `try` with `supervisorScope`
* `UpdatesPolling` now use `handleSafely` instead of `try` with `supervisorScope`
### 0.26.2
* `TelegramBotAPI`:
* Now `EditMediaGroupUpdate` also extends `BaseEditMessageUpdate`
* **EXPERIMENTALLY** Now all `TextSource` realisations will contain `source` field as a property inside of them
* `TelegramBotAPI-extensions-api`:
* `startGettingFlowsUpdates` extension which do not require filter (but return a new one) was added
* `TelegramBotAPI-extensions-utils`:
* Subproject was added
* `filterBaseMessageUpdates`, `filterSentMediaGroupUpdates` and `filterEditMediaGroupUpdates` extensions was added
* `filterCommandsWithArgs`, `filterExactCommands` and `filterCommandsInsideTextMessages` extensions was added
* `asContentMessagesFlow`, `asChatEventsFlow` and `asUnknownMessagesFlow` extensions was added
* `withContentType` extension was added
* `onlyAnimationContentMessages` extension was added
* `onlyAudioContentMessages` extension was added
* `onlyContactContentMessages` extension was added
* `onlyDiceContentMessages` extension was added
* `onlyDocumentContentMessages` extension was added
* `onlyGameContentMessages` extension was added
* `onlyInvoiceContentMessages` extension was added
* `onlyLocationContentMessages` extension was added
* `onlyPhotoContentMessages` extension was added
* `onlyPollContentMessages` extension was added
* `onlyStickerContentMessages` extension was added
* `onlyTextContentMessages` extension was added
* `onlyVenueContentMessages` extension was added
* `onlyVideoContentMessages` extension was added
* `onlyVideoNoteContentMessages` extension was added
* `onlyVoiceContentMessages` extension was added
### 0.26.1
* `TelegramBotAPI`:
* `BotCommand` now will check and throw error in case when command or description lengths is/are incorrect
* `StorageFile` now is common for all platforms
* JavaScript realization was removed due to its redundancy
* JVM realization was replaced with `fun` factory
* `StorageFile` now able to accept any factory of `Input`
* `StorageFileInfo` was added to avoid strange collisions with throws in `StorageFile`
* Fixes issue with `hashTag` for markdown
* `InvalidPhotoDimensionsException` was added for cases when `PHOTO_INVALID_DIMENSION` answer received
* Other fixes
## 0.25.0
* Common:
* Versions updates:
* `Kotlin`: `1.3.61` -> `1.3.70`
* `Kotlin coroutines`: `1.3.3` -> `1.3.5`
* `Kotlin serialization`: `0.14.0` -> `0.20.0`
* `Ktor`: `1.3.1` -> `1.3.2`
* `Klock`: `1.8.7` -> `1.10.0`
* `UUID`: `0.0.7` -> `0.1.0`
* `TelegramBotAPI`:
* `Bot` implementations (as and `Bot` itself) now have not nullable `username`
* `File#toInputFile` extension now will throw error when file does not exists
* `InlineKeyboardMarkup` will check that `PayInlineKeyboardButton` is the first in case if it is exists in
`keyboard`
* `makeLinkToMessage` now is not `PreviewFeature`
* All deprecations was removed
* `RequestException` now extends `io.ktor.utils.io.errors.IOException` instead of `kotlinx.io.IOException`
* `Any#toJson` now is NOT `inline`
* `FlowsUpdatesFilter` now as marked my annotation `FlowPreview`
* `PathedFile#fullUrl` now is not `inline` function
* `SimpleRequest#json` now is not `inline` and `internal` function
* `FlowsUpdatesFilter` now have two additional flows: `pollAnswerFlow`, `unknownUpdateTypeFlow`
* `ExtendedUser` (`typealias`) was added as a `PreviewFeature`
### 0.25.1
* Update kotlin: `1.3.70` -> `1.3.71`
* Fix of error inside of update utils for media groups
## 0.24.0
* `TelegramBotAPI`:
* All suspend functions for `RequestsExecutor` was removed (due to replacement into
[TelegramBotAPI extensions project](TelegramBotAPI-extensions-api/README.md))
* `ForwardFromChannelInfo#channelChat` now is `ChannelChat` instead of `Chat`
* `TelegramBotAPI-extensions-api`:
* Most part of sending media messages functions was removed and replaced with their `InputFile` args analogs
### 0.24.1
* `TelegramBotAPI`:
* `UpdateReceiver` was replaced to the package `com.github.insanusmokrassar.TelegramBotAPI.updateshandlers`
* All functions inside `com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdatesPolling` are deprecated
and will be removed in some soon versions. Their replacement are able inside `TelegramBotAPI-extensions-api`
* `UpdatesFilter` is interface for now
* Previous `UpdatesFilter` class was renamed to `SimpleUpdatesFilter` and for backward compatibility was added
builder function `UpdatesFilter`, which will be removed in near releases
* `FlowsUpdatesFilter` now implements `UpdatesFilter`
* `BaseSentMessageUpdate` and `BaseEditMessageUpdate` interfaces was added
* `EditChannelPostUpdate` now is implementing `BaseEditMessageUpdate` interface
* `EditMessageUpdate` now is implementing `BaseEditMessageUpdate` interface
* `ChannelPostUpdate` now is implementing `BaseSentMessageUpdate` interface
* `MessageUpdate` now is implementing `BaseSentMessageUpdate` interface
* `UpdatesPoller` and all its usages, childs and childs usages now are deprecated
* `GetUpdates#timeout` type now is `Seconds` (in fact it is `Int` as previously)
* `KtorRequestsExecutor` now is using a copy of incoming `HttpClient` object and install `HttpTimeout` feature
* `AbstractRequestCallFactory` now setting up a custom delay in case if request is `GetUpdates`
* `TelegramBotAPI-extensions-api`:
* All functions from `com.github.insanusmokrassar.TelegramBotAPI.utils.extensions.UpdatesPolling` now available
in package `com.github.insanusmokrassar.TelegramBotAPI.extensions.api.updates.UpdatesPolling`
* Now new method of getting updates available: `startGettingUpdates` with `UpdatesFilter` as incoming first
parameter
* `startGettingUpdates` with `receiver` and `allowedUpdates` parameters now will handle updates by itself
## 0.23.0 TelegramBotAPI 4.6
* `Poll` now is sealed class
@@ -35,6 +574,38 @@
* `GetMe` now return `ExtendedBot` object
* Now extension `javaLocale` is extension for `CommonUser`
### 0.23.1
* Versions updates:
* Klock `1.8.6` -> `1.8.7`
* Ktor `1.3.0` -> `1.3.1`
* Now it is possible to get updates by polling with custom executor engine
* `CommonMultipartFileRequest` now is internal
* Added `LiveLocation` class for more useful tracking live locations
* `InvoiceOfPayment` is renamed to `InvoiceContent` and now is `MessageContent` instead of `PaymentInfo`
* `SendInvoice` now return `ContentMessage<InvoiceContent>`
* `paymentInfo` inside of `CommonMessageImpl` now can be set only to `SuccessfulPaymentInfo`
* Added `RecordVideoNoteAction` and `UploadVideoNoteAction` for `record_video_note` and `upload_video_note` actions
* For most part of messages was added `RequestsExecutor` extensions for more useful way of usage
* `toInputFile` extensions now will return more exact types
* Now it is possible to send broadcast channels size for `FlowsUpdatesFilter`
### 0.23.2
* Fixes in `InputMedia` - `media` field was not included to serialization
### 0.23.3 Project separating prepare version
__API Extensions__
* Project created
* For `SendPhoto` was added new functions for uploading of `MultipartFile`
* `deleteWebhook` extension for `RequestsExecutor` was added
__Telegram Bot API__
* All `RequestsExecutor` extensions related to Telegram Bots API was replaced into `API Extensions` project
## 0.22.0
* **`KtorCallFactory` must return `HttpStatement` instead of `HttpClientCall`**

View File

@@ -178,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
@@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2018 Insanus
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

289
README.md
View File

@@ -1,192 +1,137 @@
# TelegramBotAPI
[![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI/images/download.svg) ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion)
[![Build Status](https://jenkins.insanusmokrassar.com/buildStatus/icon?job=TelegramBotAPI_master__publishing)](https://jenkins.insanusmokrassar.com/job/TelegramBotAPI_master__publishing/)
| Common info | [![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin) [![Build Status](https://travis-ci.com/InsanusMokrassar/TelegramBotAPI.svg?branch=master)](https://travis-ci.com/InsanusMokrassar/TelegramBotAPI) [Small survey](https://forms.gle/tnjuExdSKEr32ygKA)|
| -------------------------------------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Useful links | [![Chat in Telegram](badges/chat.svg)](https://t.me/InMoTelegramBotAPI) [![KDocs](badges/kdocs.svg)](https://tgbotapi.inmo.dev/docs/index.html) [Examples](https://github.com/InsanusMokrassar/TelegramBotAPI-examples/), [Mini tutorial](https://bookstack.inmo.dev/books/telegrambotapi/chapter/introduction-tutorial) |
| TelegramBotAPI Core status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-core/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI) |
| TelegramBotAPI Extensions status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-api/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-api/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-api) |
| TelegramBotAPI Util Extensions status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-extensions-utils/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-utils/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-extensions-utils) |
| TelegramBotAPI All status | [![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI/images/download.svg)](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-all) |
## What is it?
**At the time of publication of version `0.28.0` there are errors in serialization plugins like
[kotlinx.serialization#1004](https://github.com/Kotlin/kotlinx.serialization/issues/1004). It is possible, that both JVM
and JS version may work improperly in some cases with `kotlinx.serialization` version `1.0.0-RC`**
Library for Object-Oriented and type-safe work with Telegram Bot API. Most part of some specific solves or unuseful
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:
* [TelegramBotAPI-core](TelegramBotAPI-core/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
* [TelegramBotAPI](TelegramBotAPI/README.md) - concentration of all previously mentioned libraries
Most part of some specific solves or unuseful
moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api).
## Compatibility
## JavaScript notes
This version compatible with [23th of January 2020 update of TelegramBotAPI (version 4.6)](https://core.telegram.org/bots/api#january-23-2020).
There is Telegram Passport API exception of implemented functionality, which was presented in
[August 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api#august-27-2018) update. It will be implemented
as soon as possible. All APIs that are not included are presented
[wiki](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Not-included-API).
### Versions before `0.28.0`
## How to implement library?
In case if you are want to use this library inside of browser, you will need additional settings (thanks for help to [Alexander Nozik](https://research.jetbrains.org/researchers/altavir)):
Common ways to implement this library are presented here. In some cases it will require additional steps
like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable
`telegrambotapi.version`, which must be set up by developer. Available versions are presented on
[bintray](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI), next version is last published:
[![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI/images/download.svg) ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion)
Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing
of signed artifacts in Bintray). You can:
* Use earlier version (available version you can find
[here](https://mvnrepository.com/artifact/com.github.insanusmokrassar/TelegramBotAPI))
* Add `jCenter` repository in build config
### Maven
Dependency config presented here:
```xml
<dependency>
<groupId>com.github.insanusmokrassar</groupId>
<artifactId>TelegramBotAPI</artifactId>
<version>${telegrambotapi.version}</version>
</dependency>
```
### Gradle
To use last versions you will need to add one line in repositories block of your `build.gradle`:
`jcenter()` or `mavenCentral()`
And add next line to your dependencies block:
```groovy
implementation "com.github.insanusmokrassar:TelegramBotAPI:$telegrambotapi_version"
```
or for old gradle:
```groovy
compile "com.github.insanusmokrassar:TelegramBotAPI:$telegrambotapi_version"
```
## How to work with library?
For now, this library have no some API god-object. Instead of this, this library has several
important objects:
* [RequestsExecutor](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt)
* [Requests](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests)
* [Types](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types)
### Types
Types declare different objects representation. For example, `Chat` for now represented as
interface and has several realisations:
* PrivateChat
* GroupChat
* SupergroupChat
* ChannelChat
Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat),
here it was separated for more obvious difference between chats types and their possible content.
The same principle work with a lot of others things in this Telegram bot API.
### Requests
Requests usually are very simple objects, but some of them are using their own
build factories. For example, the next code show, how to get information about bot:
```kotlin
val requestsExecutor: RequestsExecutor = ...
requestsExecutor.execute(GetMe())
```
The result type of [GetMe](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
request is
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
### RequestsExecutor
It is base object which can be used to execute requests in API. For now by default included Ktor
realisation of `RequestsExecutor`, but it is possible, that in future it will be extracted in separated
project. How to create `RequestsExecutor`:
```kotlin
val requestsExecutor = KtorRequestsExecutor(TOKEN)
```
Here `KtorRequestsExecutor` - default realisation with Ktor. `TOKEN` is just a token of bot which was retrieved
according to [instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
Besides, for correct usage of this, you must implement in your project both one of engines for client and server
Ktor libraries:
<details>
<summary>Gradle build script help (for versions before 0.28.0)</summary>
```groovy
dependencies {
// ...
implementation "io.ktor:ktor-server-cio:$ktor_version"
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
// ...
/* ... */
implementation "com.github.insanusmokrassar:TelegramBotAPI:$tgbot_api_version"
implementation "com.github.insanusmokrassar:TelegramBotAPI-extensions-api:$tgbot_api_version" // optional
implementation "com.github.insanusmokrassar:TelegramBotAPI-extensions-utils:$tgbot_api_version" // optional
/* Block of dependencies for correct building in browser */
implementation(npm("fs"))
implementation(npm("bufferutil"))
implementation(npm("utf-8-validate"))
implementation(npm("abort-controller"))
implementation(npm("text-encoding"))
}
/* ... */
kotlin {
target {
browser {
/* Block for fix of exception in absence of some functionality, https://github.com/ktorio/ktor/issues/1339 */
dceTask {
dceOptions {
keep("ktor-ktor-io.\$\$importsForInline\$\$.ktor-ktor-io.io.ktor.utils.io")
}
}
}
}
}
```
It is able to avoid using of `server` dependency in case if will not be used `Webhook`s. In this case,
dependencies list will be simplify:
</details>
## Ok, where should I start?
![Libraries hierarchy](resources/TelegramBotAPI-libraries-hierarchy.svg)
In most cases, the most simple way will be to implement [TelegramBotAPI](TelegramBotAPI/README.md) - it contains
all necessary tools for comfort usage of this library. If you want to exclude some libraries, you can implement just
[TelegramBotAPI API Extensions](TelegramBotAPI-extensions-api/README.md),
[TelegramBotAPI Util Extensions](TelegramBotAPI-extensions-utils/README.md) or even
[TelegramBotAPI-core](TelegramBotAPI-core/README.md).
If you want to dive deeper in the core of library or develop something for it - welcome to learn more from
[TelegramBotAPI-core](TelegramBotAPI-core/README.md) and our [Telegram Chat](https://teleg.one/InMoTelegramBotAPIChat).
Anyway, all libraries are very typical inside of them. Examples:
* 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 use `bot` name instead of `requestsExecutor`)
* `TelegramBotAPI-extensions-utils` will look like `filter.filterBaseMessageUpdates(chatId).filterExactCommands(Regex("^.*$"))...`
## Build instruction
If you want to build this project or to contribute, there are several recommendations:
### Build
In case if you want to just build project, run next command:
```bash
./gradlew clean build
```
On windows:
```
gradlew.bat clean build
```
### Publishing for work with your version locally
In case, if you want to work in your other projects using your modification (or some state) of this library,
you can use next code:
```bash
./gradlew clean build publishToMavenLocal
```
On windows:
```
gradlew.bat clean build publishToMavenLocal
```
But you must remember, that in this case your local maven repo must be the first one from
your project retrieving libraries:
```groovy
dependencies {
// ...
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
// ...
repositories {
mavenLocal() // that must be the first one
jcenter()
mavenCentral()
}
```
Here was used `okhttp` realisation of client, but there are several others engines for Ktor. More information
available on ktor.io site for [client](https://ktor.io/clients/http-client/engines.html) and [server](https://ktor.io/quickstart/artifacts.html)
engines.
## Getting updates
In this library currently realised two ways to get updates from telegram:
* Polling - in this case bot will request updates from time to time (you can set up delay between requests)
* Webhook via reverse proxy or something like this
### Updates filters
Currently webhook method contains `UpdatesFilter` as necessary argument for getting updates.
`UpdatesFilter` will sort updates and throw their into different callbacks. Currently supporting
separate getting updates for media groups - they are accumulating with debounce in one second
(for being sure that all objects of media group was received).
Updates polling also support `UpdatesFilter` but it is not required to use it and you can get updates directly
in `UpdateReceiver`, which you will provide to `startGettingOfUpdates` method
### Webhook set up
If you wish to use webhook method, you will need:
* White IP - your IP address or host, which available for calling. [TelegramBotAPI](https://core.telegram.org/bots/api#setwebhook)
recommend to use some unique address for each bot which you are using
* SSL certificate. Usually you can obtain the certificate using your domain provider, [Let'sEncrypt](https://letsencrypt.org/) or [create it](https://core.telegram.org/bots/self-signed)
* Nginx or something like this
Template for Nginx server config you can find in [this gist](https://gist.github.com/InsanusMokrassar/fcc6e09cebd07e46e8f0fdec234750c4#file-nginxssl-conf).
For webhook you can provide `File` with public part of certificate, `URL` where bot will be available and inner `PORT` which
will be used to start receiving of updates. Actually, you can skip passing of `File` when you have something like
nginx for proxy forwarding.
In case of using `nginx` with reverse-proxy config, setting up of Webhook will look like:
```kotlin
requestsExecutor.setWebhook(
WEBHOOK_URL,
INTERNAL_PORT,
filter,
ENGINE_FACTORY
)
```
Here:
* `WEBHOOK_URL` - the url which will be used by Telegram system to send updates
* `INTERNAL_PORT` - the port which will be used in bot for listening of updates
* `filter` - instance of [UpdatesFilter](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/updateshandlers/UpdatesFilter.kt),
which will be used to filter incoming updates
* `ENGINE_FACTORY` - used factory name, for example, `CIO` in case of usage `io.ktor:ktor-server-cio` as server engine
Besides, for your own version you can change variable `library_version` in the file [gradle.properties](./gradle.properties).

View File

@@ -0,0 +1,151 @@
# TelegramBotAPI-core
[![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-core/images/download.svg) ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core/_latestVersion)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.insanusmokrassar/TelegramBotAPI)
## What is it?
Library for Object-Oriented and type-safe work with Telegram Bot API. Most part of some specific solves or unuseful
moments are describing by official [Telegram Bot API](https://core.telegram.org/bots/api).
## Compatibility
This version compatible with [4th of June 2020 update of TelegramBotAPI (version 4.9)](https://core.telegram.org/bots/api#june-4-2020).
There is only one exception of implemented functionality - Telegram Passport API, which was presented in
[August 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api-changelog#august-27-2018) update. It will be implemented
as soon as possible.
## 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.version`, which must be set up by developer. Available versions are presented on
[bintray](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core), next version is last published:
[![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI-core/images/download.svg) ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI-core/_latestVersion)
Currently, last versions of library can be available from the Maven repository with errors (for the reason difficult in publishing
of signed artifacts in Bintray). You can:
* Use earlier version (available version you can find
[here](https://mvnrepository.com/artifact/com.github.insanusmokrassar/TelegramBotAPI) (before 0.28.0) or [here](https://mvnrepository.com/artifact/com.github.insanusmokrassar/TelegramBotAPI-core))
* Add `jCenter` repository in build config
### Maven
Dependency config presented here:
```xml
<dependency>
<groupId>com.github.insanusmokrassar</groupId>
<artifactId>TelegramBotAPI-core</artifactId>
<version>${telegrambotapi.version}</version>
</dependency>
```
### Gradle
To use last versions you will need to add one line in repositories block of your `build.gradle`:
`jcenter()` or `mavenCentral()`
And add next line to your dependencies block:
```groovy
implementation "com.github.insanusmokrassar:TelegramBotAPI-core:$telegrambotapi_version"
```
or for old gradle:
```groovy
compile "com.github.insanusmokrassar:TelegramBotAPI-core:$telegrambotapi_version"
```
## How to work with library?
For now, this library have no some API god-object. Instead of this, this library has several
important objects:
* [RequestsExecutor](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/bot/RequestsExecutor.kt)
* [Requests](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests)
* [Types](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types)
### Types
Types declare different objects representation. For example, `Chat` for now represented as
interface and has several realisations:
* `PrivateChat`
* `GroupChat`
* `SupergroupChat`
* `ChannelChat`
Instead of common garbage with all information as in original [Chat](https://core.telegram.org/bots/api#chat),
here it was separated for more obvious difference between chats types and their possible content.
The same principle work with a lot of others things in this Telegram bot API.
### Requests
Requests usually are very simple objects, but some of them are using their own
build factories. For example, the next code show, how to get information about bot:
```kotlin
val requestsExecutor: RequestsExecutor = ...
requestsExecutor.execute(GetMe())
```
Also there is an alternative syntax for requests (like `requestsExecutor.getMe()` in project
[TelegramBotAPI-extensions-api](../TelegramBotAPI-extensions-api/README.md))
The result type of [GetMe (and getMe extension)](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/requests/GetMe.kt)
request is
[ExtendedBot](https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/TelegramBotAPI-core/src/commonMain/kotlin/com/github/insanusmokrassar/TelegramBotAPI/types/User.kt).
### RequestsExecutor
It is base object which can be used to execute requests in API. For now by default included Ktor
realisation of `RequestsExecutor`, but it is possible, that in future it will be extracted in separated
project. How to create `RequestsExecutor`:
```kotlin
val requestsExecutor = KtorRequestsExecutor(
TelegramAPIUrlsKeeper(TOKEN)
)
```
Here:
* `KtorRequestsExecutor` - default realisation with [ktor](https://ktor.io)
* `TelegramAPIUrlsKeeper` - special keeper, which you can save and use for getting files full urls (`resolveFileURL`
extension inside of `PathedFile.kt`)
* `TOKEN` is just a token of bot which was retrieved according to
[instruction](https://core.telegram.org/bots#3-how-do-i-create-a-bot).
By default, for JVM there is implemented `CIO` client engine, but there is not server engine. Both can be changed like
here:
```groovy
dependencies {
// ...
implementation "io.ktor:ktor-server-cio:$ktor_version" // for implementing of server engine
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
// ...
}
```
You can avoid using of `server` dependency in case if you will not use `Webhook`s. In this case,
dependencies list will be simplify:
```groovy
dependencies {
// ...
implementation "io.ktor:ktor-client-okhttp:$ktor_version" // for implementing of additional client engine
// ...
}
```
Here was used `okhttp` realisation of client, but there are several others engines for Ktor. More information
available on ktor.io site for [client](https://ktor.io/clients/http-client/engines.html) and [server](https://ktor.io/quickstart/artifacts.html)
engines.

View File

@@ -0,0 +1,91 @@
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"
id "org.jetbrains.kotlin.plugin.serialization"
}
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(BOTH) {
browser()
nodejs()
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib')
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_runtime_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-properties:$kotlin_serialisation_runtime_version"
api "com.soywiz.korlibs.klock:klock:$klock_version"
api "com.benasher44:uuid:$uuid_version"
api "io.ktor:ktor-client-core:$ktor_version"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
api "io.ktor:ktor-server:$ktor_version"
api "io.ktor:ktor-server-host-common:$ktor_version"
api "io.ktor:ktor-client-cio:$ktor_version"
api "javax.activation:activation:$javax_activation_version"
}
}
jvmTest {
dependencies {
implementation kotlin('test-junit')
}
}
jsTest {
dependencies {
implementation kotlin('test-junit')
implementation kotlin('test-js')
}
}
}
targets.all {
compilations.all {
kotlinOptions {
freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlin.RequiresOptIn"]
}
}
}
}

View File

@@ -0,0 +1,53 @@
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 {
description = "Library for Object-Oriented and type-safe work with Telegram Bot API"
name = "Telegram Bot API Core"
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"
}
}
}
}
}

View File

@@ -0,0 +1 @@
{"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 Core","description":"Library for Object-Oriented and type-safe work with Telegram Bot API","url":"https://insanusmokrassar.github.io/TelegramBotAPI","vcsUrl":"https://github.com/insanusmokrassar/TelegramBotAPI.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}

View File

@@ -0,0 +1,26 @@
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.utils.fullListOfSubSource
interface Captioned {
val caption: String?
}
interface CaptionedOutput : Captioned {
val parseMode: ParseMode?
}
interface CaptionedInput : Captioned {
/**
* Not full list of entities. This list WILL NOT contain [TextPart]s with [com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.RegularTextSource]
* @see [CaptionedInput.fullEntitiesList]
*/
val captionEntities: List<TextPart>
}
/**
* Convert its [CaptionedInput.captionEntities] to list of [com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource]
* with [com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.RegularTextSource]
*/
fun CaptionedInput.fullEntitiesList(): FullTextSourcesList = caption ?.fullListOfSubSource(captionEntities) ?.map { it.source } ?: emptyList()

View File

@@ -0,0 +1,26 @@
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.utils.fullListOfSubSource
interface Explained {
val explanation: String?
}
interface ExplainedOutput : Explained {
val parseMode: ParseMode?
}
interface ExplainedInput : Explained {
/**
* Not full list of entities. This list WILL NOT contain [TextPart]s with [com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.RegularTextSource]
* @see [ExplainedInput.fullEntitiesList]
*/
val explanationEntities: List<TextPart>
}
/**
* Convert its [ExplainedInput.explanationEntities] to list of [com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.TextSource]
* with [com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity.textsources.RegularTextSource]
*/
fun ExplainedInput.fullEntitiesList(): FullTextSourcesList = explanation ?.fullListOfSubSource(explanationEntities) ?.map { it.source } ?: emptyList()

View File

@@ -0,0 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
import com.github.insanusmokrassar.TelegramBotAPI.utils.MimeType
interface MimeTyped {
val mimeType: MimeType?
}

View File

@@ -1,9 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
typealias FullTextSourcesList = List<TextSource>
typealias FullTextPartsList = List<TextPart>
interface TextSource {
val asMarkdownSource: String
val asMarkdownV2Source: String
val asHtmlSource: String
val source: String
}
@@ -15,3 +19,5 @@ data class TextPart(
val range: IntRange,
val source: TextSource
)
fun List<TextPart>.justTextSources() = map { it.source }

View File

@@ -0,0 +1,15 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import io.ktor.client.HttpClient
import kotlinx.serialization.json.Json
interface KtorCallFactory {
suspend fun <T: Any> makeCall(
client: HttpClient,
urlsKeeper: TelegramAPIUrlsKeeper,
request: Request<T>,
jsonFormatter: Json
): T?
}

View File

@@ -0,0 +1,77 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor
import com.github.insanusmokrassar.TelegramBotAPI.bot.BaseRequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base.*
import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.newRequestException
import com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters.EmptyLimiter
import com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters.RequestLimiter
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import com.github.insanusmokrassar.TelegramBotAPI.types.Response
import com.github.insanusmokrassar.TelegramBotAPI.utils.*
import io.ktor.client.HttpClient
import io.ktor.client.features.*
import io.ktor.client.statement.HttpStatement
import io.ktor.client.statement.readText
import kotlinx.serialization.json.Json
class KtorRequestsExecutor(
telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper,
client: HttpClient = HttpClient(),
callsFactories: List<KtorCallFactory> = emptyList(),
excludeDefaultFactories: Boolean = false,
private val requestsLimiter: RequestLimiter = EmptyLimiter,
private val jsonFormatter: Json = nonstrictJsonFormat
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
if (!excludeDefaultFactories) {
this + listOf(SimpleRequestCallFactory, MultipartRequestCallFactory, DownloadFileRequestCallFactory)
} else {
this
}
}
private val client = client.config {
if (client.feature(HttpTimeout) == null) {
install(HttpTimeout)
}
}
override suspend fun <T : Any> execute(request: Request<T>): T {
return handleSafely(
{ e ->
throw if (e is ClientRequestException) {
val content = e.response ?.readText() ?: throw e
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
newRequestException(
responseObject,
content,
"Can't get result object from $content"
)
} else {
e
}
}
) {
requestsLimiter.limit {
var result: T? = null
for (potentialFactory in callsFactories) {
result = potentialFactory.makeCall(
client,
telegramAPIUrlsKeeper,
request,
jsonFormatter
)
if (result != null) {
break
}
}
result ?: error("Can't execute request: $request")
}
}
}
override fun close() {
client.close()
}
}

View File

@@ -0,0 +1,79 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorCallFactory
import com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions.newRequestException
import com.github.insanusmokrassar.TelegramBotAPI.requests.GetUpdates
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import com.github.insanusmokrassar.TelegramBotAPI.types.Response
import com.github.insanusmokrassar.TelegramBotAPI.types.RetryAfterError
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import io.ktor.client.HttpClient
import io.ktor.client.call.receive
import io.ktor.client.features.timeout
import io.ktor.client.request.*
import io.ktor.client.statement.HttpResponse
import io.ktor.http.ContentType
import kotlinx.coroutines.delay
import kotlinx.serialization.json.Json
import kotlin.collections.set
abstract class AbstractRequestCallFactory : KtorCallFactory {
private val methodsCache: MutableMap<String, String> = mutableMapOf()
override suspend fun <T : Any> makeCall(
client: HttpClient,
urlsKeeper: TelegramAPIUrlsKeeper,
request: Request<T>,
jsonFormatter: Json
): T? {
val preparedBody = prepareCallBody(client, urlsKeeper, request) ?: return null
client.post<HttpResponse> {
url(
methodsCache[request.method()] ?: "${urlsKeeper.commonAPIUrl}/${request.method()}".also {
methodsCache[request.method()] = it
}
)
accept(ContentType.Application.Json)
if (request is GetUpdates) {
request.timeout?.times(1000L)?.let { customTimeoutMillis ->
if (customTimeoutMillis > 0) {
timeout {
requestTimeoutMillis = customTimeoutMillis
socketTimeoutMillis = customTimeoutMillis
}
}
}
}
body = preparedBody
}.let { response ->
val content = response.receive<String>()
val responseObject = jsonFormatter.decodeFromString(Response.serializer(), content)
return (responseObject.result?.let {
jsonFormatter.decodeFromJsonElement(request.resultDeserializer, it)
} ?: responseObject.parameters?.let {
val error = it.error
if (error is RetryAfterError) {
delay(error.leftToRetry)
makeCall(client, urlsKeeper, request, jsonFormatter)
} else {
null
}
} ?: response.let {
throw newRequestException(
responseObject,
content,
"Can't get result object from $content"
)
})
}
}
protected abstract fun <T : Any> prepareCallBody(
client: HttpClient,
urlsKeeper: TelegramAPIUrlsKeeper,
request: Request<T>
): Any?
}

View File

@@ -0,0 +1,29 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base
import com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorCallFactory
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.DownloadFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import com.github.insanusmokrassar.TelegramBotAPI.utils.handleSafely
import io.ktor.client.HttpClient
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.http.HttpMethod
import kotlinx.serialization.json.Json
object DownloadFileRequestCallFactory : KtorCallFactory {
override suspend fun <T : Any> makeCall(
client: HttpClient,
urlsKeeper: TelegramAPIUrlsKeeper,
request: Request<T>,
jsonFormatter: Json
): T? = (request as? DownloadFile) ?.let {
val fullUrl = "${urlsKeeper.fileBaseUrl}/${it.filePath}"
return handleSafely {
@Suppress("UNCHECKED_CAST")
client.get<ByteArray>(fullUrl) as T // always ByteArray
}
}
}

View File

@@ -1,6 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import com.github.insanusmokrassar.TelegramBotAPI.utils.mapWithCommonValues
import io.ktor.client.HttpClient
import io.ktor.client.request.forms.MultiPartFormDataContent
@@ -8,11 +9,10 @@ import io.ktor.client.request.forms.formData
import io.ktor.http.Headers
import io.ktor.http.HttpHeaders
class MultipartRequestCallFactory : AbstractRequestCallFactory() {
object MultipartRequestCallFactory : AbstractRequestCallFactory() {
override fun <T : Any> prepareCallBody(
client: HttpClient,
baseUrl: String,
urlsKeeper: TelegramAPIUrlsKeeper,
request: Request<T>
): Any? = (request as? MultipartRequest) ?.let { castedRequest ->
MultiPartFormDataContent(

View File

@@ -1,14 +1,15 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.base
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import io.ktor.client.HttpClient
import io.ktor.http.ContentType
import io.ktor.http.content.TextContent
class SimpleRequestCallFactory : AbstractRequestCallFactory() {
object SimpleRequestCallFactory : AbstractRequestCallFactory() {
override fun <T : Any> prepareCallBody(
client: HttpClient,
baseUrl: String,
urlsKeeper: TelegramAPIUrlsKeeper,
request: Request<T>
): Any? = (request as? SimpleRequest<T>) ?.let { _ ->
val content = request.json().toString()

View File

@@ -0,0 +1,24 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import io.ktor.utils.io.core.Closeable
/**
* Interface for making requests to Telegram Bot API. Currently, there is only one built-in implementation -
* [com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorRequestsExecutor]
*
* @see Request
* @see com.github.insanusmokrassar.TelegramBotAPI.bot.Ktor.KtorRequestsExecutor
*/
interface RequestsExecutor : Closeable {
/**
* Unsafe execution of incoming [request]. Can throw almost any exception. So, it is better to use
* something like [com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.shortcuts.executeAsync] or
* [com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.shortcuts.executeUnsafe]
*
* @throws Exception
*/
suspend fun <T : Any> execute(request: Request<T>): T
}
typealias TelegramBot = RequestsExecutor

View File

@@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions
import com.github.insanusmokrassar.TelegramBotAPI.types.Response
import kotlinx.io.IOException
import io.ktor.utils.io.errors.IOException
fun newRequestException(
response: Response,
@@ -14,6 +14,7 @@ fun newRequestException(
description == "Bad Request: message to edit not found" -> MessageToEditNotFoundException(response, plainAnswer, message, cause)
description.contains("Bad Request: message is not modified") -> MessageIsNotModifiedException(response, plainAnswer, message, cause)
description == "Unauthorized" -> UnauthorizedException(response, plainAnswer, message, cause)
description.contains("PHOTO_INVALID_DIMENSIONS") -> InvalidPhotoDimensionsException(response, plainAnswer, message, cause)
else -> null
}
} ?: CommonRequestException(response, plainAnswer, message, cause)
@@ -41,3 +42,6 @@ class MessageIsNotModifiedException(response: Response, plainAnswer: String, mes
class MessageToEditNotFoundException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
RequestException(response, plainAnswer, message, cause)
class InvalidPhotoDimensionsException(response: Response, plainAnswer: String, message: String?, cause: Throwable?) :
RequestException(response, plainAnswer, message, cause)

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageA
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class DeleteMessage(
@@ -16,7 +16,7 @@ data class DeleteMessage(
override fun method(): String = "deleteMessage"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -0,0 +1,14 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.builtins.ByteArraySerializer
class DownloadFile(
val filePath: String
) : Request<ByteArray> {
override fun method(): String = filePath
override val resultDeserializer: DeserializationStrategy<ByteArray>
get() = ByteArraySerializer()
}

View File

@@ -0,0 +1,43 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateSerializerWithoutSerialization
import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer
private val updatesListSerializer = ListSerializer(
UpdateSerializerWithoutSerialization
)
/**
* Request updates from Telegram Bot API system. It is important, that the result updates WILL NOT include
* [com.github.insanusmokrassar.TelegramBotAPI.types.update.MediaGroupUpdates.MediaGroupUpdate] objects due to the fact,
* that it is internal abstraction and in fact any [com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage]
* is just a common [com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message]
*
* @see com.github.insanusmokrassar.TelegramBotAPI.extensions.utils.updates.retrieving.updateHandlerWithMediaGroupsAdaptation
* @see com.github.insanusmokrassar.TelegramBotAPI.utils.convertWithMediaGroupUpdates
*/
@Serializable
data class GetUpdates(
val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
val limit: Int = getUpdatesLimit.last,
val timeout: Seconds? = null,
val allowed_updates: List<String>? = ALL_UPDATES_LIST
): SimpleRequest<List<Update>> {
override fun method(): String = "getUpdates"
override val resultDeserializer: DeserializationStrategy<List<Update>>
get() = updatesListSerializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (limit !in getUpdatesLimit) {
error("GetUpdates request can be called only with limit in range $getUpdatesLimit (actual value is $limit)")
}
}
}

View File

@@ -0,0 +1,50 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.toInputMediaFileAttachmentName
import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
@Serializable(InputFileSerializer::class)
sealed class InputFile {
abstract val fileId: String
}
// TODO:: add checks for file url/file id regex
/**
* Contains file id or file url
*/
@Serializable(InputFileSerializer::class)
data class FileId(
override val fileId: String
) : InputFile()
fun String.toInputFile() = FileId(this)
@Serializer(InputFile::class)
internal object InputFileSerializer : KSerializer<InputFile> {
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor(FileId::class.toString(), PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId)
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString())
}
internal val InputFile.asMediaData: String
get() = when (this) {
is FileId -> fileId
is MultipartFile -> fileId.toInputMediaFileAttachmentName()
}
// TODO:: add checks for files size
/**
* Contains info about file for sending
*/
@Serializable(InputFileSerializer::class)
data class MultipartFile (
val file: StorageFile,
val mimeType: String = file.storageFileInfo.contentType,
val filename: String = file.storageFileInfo.fileName
) : InputFile() {
override val fileId: String = file.storageFileInfo.generateCustomName()
}

View File

@@ -9,4 +9,4 @@ interface SimpleRequest<T: Any> : Request<T> {
}
@Suppress("UNCHECKED_CAST")
inline fun <T: Any, K: SimpleRequest<T>> K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy<K>)
internal fun <T: Any, K: SimpleRequest<T>> K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy<K>)

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class AnswerCallbackQuery(
@@ -21,7 +21,7 @@ data class AnswerCallbackQuery(
) : SimpleRequest<Boolean> {
override fun method(): String = "answerCallbackQuery"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -6,8 +6,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQuer
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery
import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class AnswerInlineQuery(
@@ -29,7 +29,7 @@ data class AnswerInlineQuery(
): SimpleRequest<Boolean> {
override fun method(): String = "answerInlineQuery"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}
@@ -51,6 +51,6 @@ fun InlineQuery.createAnswer(
switchPmParameter
)
internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ArrayListSerializer(
internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ListSerializer(
InlineQueryResultSerializer
)

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery
import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer
import kotlinx.serialization.builtins.ListSerializer
@Serializable
data class AnswerShippingQueryOk(
@@ -21,7 +21,7 @@ data class AnswerShippingQueryOk(
get() = serializer()
}
internal object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ArrayListSerializer(
internal object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ListSerializer(
ShippingOption.serializer()
)

View File

@@ -3,12 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abs
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.PreCheckoutQueryId
import kotlinx.serialization.KSerializer
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
interface AnswerPreCheckoutQuery : SimpleRequest<Boolean> {
override fun method(): String = "answerPreCheckoutQuery"
override val resultDeserializer: KSerializer<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
val preCheckoutQueryId: PreCheckoutQueryId
val isOk: Boolean

View File

@@ -3,12 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abs
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ShippingQueryIdentifier
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
interface AnswerShippingQuery : SimpleRequest<Boolean> {
override fun method(): String = "answerShippingQuery"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
val shippingQueryId: ShippingQueryIdentifier
val isOk: Boolean

View File

@@ -1,11 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests
package com.github.insanusmokrassar.TelegramBotAPI.requests.bot
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ExtendedBot
import kotlinx.serialization.*
@Serializable
class GetMe : SimpleRequest<ExtendedBot> {
object GetMe : SimpleRequest<ExtendedBot> {
override fun method(): String = "getMe"
override val resultDeserializer: DeserializationStrategy<ExtendedBot>
get() = ExtendedBot.serializer()

View File

@@ -0,0 +1,17 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.bot
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.BotCommand
import kotlinx.serialization.*
import kotlinx.serialization.builtins.ListSerializer
private val getMyCommandsSerializer = ListSerializer(BotCommand.serializer())
@Serializable
object GetMyCommands : SimpleRequest<List<BotCommand>> {
override fun method(): String = "getMyCommands"
override val resultDeserializer: DeserializationStrategy<List<BotCommand>>
get() = getMyCommandsSerializer
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -0,0 +1,24 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.bot
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.builtins.serializer
@Serializable
class SetMyCommands(
@SerialName(botCommandsField)
val commands: List<BotCommand>
) : SimpleRequest<Boolean> {
override fun method(): String = "setMyCommands"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
init {
if (commands.size !in botCommandsLimit) {
error("Bot commands list size able to be in range $botCommandsLimit, but incoming size is ${commands.size}")
}
}
}

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class ExportChatInviteLink(
@@ -14,7 +14,7 @@ data class ExportChatInviteLink(
): ChatRequest, SimpleRequest<String> {
override fun method(): String = "exportChatInviteLink"
override val resultDeserializer: DeserializationStrategy<String>
get() = StringSerializer
get() = String.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class LeaveChat(
@@ -14,7 +14,7 @@ data class LeaveChat(
): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "leaveChat"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -7,9 +7,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.Adm
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer
import kotlinx.serialization.builtins.ListSerializer
private val chatMembersListSerializer = ArrayListSerializer(
private val chatMembersListSerializer = ListSerializer(
AdministratorChatMemberSerializerWithoutDeserialization
)

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.IntSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class GetChatMembersCount(
@@ -14,7 +14,7 @@ data class GetChatMembersCount(
): ChatRequest, SimpleRequest<Int> {
override fun method(): String = "getChatMembersCount"
override val resultDeserializer: DeserializationStrategy<Int>
get() = IntSerializer
get() = Int.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDat
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class KickChatMember(
@@ -17,7 +17,7 @@ data class KickChatMember(
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "kickChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDat
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class PromoteChatMember(
@@ -33,7 +33,7 @@ data class PromoteChatMember(
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "promoteChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMe
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class RestrictChatMember(
@@ -16,11 +16,11 @@ data class RestrictChatMember(
@SerialName(untilDateField)
override val untilDate: TelegramDate? = null,
@SerialName(permissionsField)
val permissions: ChatPermissions
val permissions: ChatPermissions = ChatPermissions()
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "restrictChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -3,17 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
/**
* Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle
*
* Please, remember about restrictions for characters in custom title
*/
@Serializable
data class SetChatAdministratorCustomTitle(
@SerialName(chatIdField)
override val chatId: ChatId,
override val chatId: ChatIdentifier,
@SerialName(userIdField)
override val userId: UserId,
@SerialName(customTitleField)
@@ -21,7 +16,7 @@ data class SetChatAdministratorCustomTitle(
) : ChatMemberRequest<Boolean> {
override fun method(): String = "setChatAdministratorCustomTitle"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = RestrictChatMember.serializer()

View File

@@ -3,7 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class UnbanChatMember(
@@ -14,7 +14,7 @@ data class UnbanChatMember(
) : ChatMemberRequest<Boolean> {
override fun method(): String = "unbanChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class DeleteChatPhoto(
@@ -14,7 +14,7 @@ data class DeleteChatPhoto(
): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "deleteChatPhoto"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class PinChatMessage (
@@ -17,7 +17,7 @@ data class PinChatMessage (
): ChatRequest, SimpleRequest<Boolean>, MessageAction, DisableNotification {
override fun method(): String = "pinChatMessage"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequ
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class SetChatDescription (
@@ -21,7 +21,7 @@ data class SetChatDescription (
override fun method(): String = "setChatDescription"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class SetChatPermissions (
@@ -16,7 +16,7 @@ data class SetChatPermissions (
): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "setChatPermissions"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -6,7 +6,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRe
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.JsonObject
@Serializable
@@ -17,7 +17,7 @@ data class SetChatPhoto (
): ChatRequest, MultipartRequest<Boolean> {
override fun method(): String = "setChatPhoto"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val mediaMap: Map<String, MultipartFile> = mapOf(photoField to photo)
override val paramsJson: JsonObject = toJson(serializer())
}

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequ
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class SetChatTitle (
@@ -21,7 +21,7 @@ data class SetChatTitle (
override fun method(): String = "setChatTitle"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class UnpinChatMessage(
@@ -14,7 +14,7 @@ data class UnpinChatMessage(
): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "unpinChatMessage"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class DeleteChatStickerSet(
@@ -14,7 +14,7 @@ data class DeleteChatStickerSet(
): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "deleteChatStickerSet"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequ
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
@Serializable
data class SetChatStickerSet(
@@ -15,7 +15,7 @@ data class SetChatStickerSet(
): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "setChatStickerSet"
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*>
get() = serializer()
}

View File

@@ -3,7 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.common
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import kotlinx.serialization.json.JsonObject
data class CommonMultipartFileRequest<T: Any>(
internal data class CommonMultipartFileRequest<T: Any>(
val data: SimpleRequest<T>,
override val mediaMap: Map<String, MultipartFile>
) : MultipartRequest<T>, Request<T> by data {

View File

@@ -3,10 +3,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.internal.BooleanSerializer
import kotlinx.serialization.builtins.serializer
interface EditInlineMessage : SimpleRequest<Boolean> {
val inlineMessageId: InlineMessageIdentifier
override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer
get() = Boolean.serializer()
}

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