Commit graph

345 commits

Author SHA1 Message Date
puh
94733cbcd6
changelog 2023-03-30 20:20:45 +03:00
puh
081f75546c
Merge remote-tracking branch 'master' into api_errors_custom_deserialize 2023-03-30 19:59:56 +03:00
jeorji
d036576397 Remove outdated sentence 2023-03-27 23:42:27 +07:00
jeorji
98c0fd2187 Update outdated documentation 2023-03-27 00:38:24 +07:00
Oleg A
15d2f0e3f5
Add skip_serializing_none for all structures 2023-03-21 11:35:10 +03:00
Oleg A
5c162f4899
Reorder Vec::is_empty skip 2023-03-20 15:40:21 +03:00
Oleg A
dc04b93878
Message struct skip empty Vec 2023-03-18 18:54:17 +03:00
Oleg A
4cdc214d19
Message struct skip default False fields 2023-03-18 18:42:59 +03:00
Oleg A
4d0fc03fa2
Message struct skip serializing for none fields 2023-03-18 18:36:14 +03:00
Waffle Maybe
da00c9274b
Merge pull request #837 from puuuuh/master
fix split parser for tuple struct with len <2
2023-03-17 15:01:47 +00:00
Maybe Waffle
e4f30e729a Simplify release process by using cargo-release 2023-02-28 20:45:39 +04:00
Maybe Waffle
b8f3e0e005 Fix deprecation version (core and main crates have different versions..) 2023-02-24 16:34:17 +04:00
Maybe Waffle
48c8f935a5 Update changelog 2023-02-24 16:34:13 +04:00
Maybe Waffle
35471a4a0b Add mentioned_users to update types where it makes sense 2023-02-24 16:33:53 +04:00
Maybe Waffle
16c20e371c Add Message::video_chat_participants_invited 2023-02-24 16:33:53 +04:00
Maybe Waffle
a411bff31c Rename Update::user -> Update::from 2023-02-24 16:33:53 +04:00
Maybe Waffle
96c4c83daf Add ChatPermissions::can_* helper functions 2023-02-20 18:35:46 +04:00
Maybe Waffle
0fb3cdd6b4 Fix docs.rs build 2023-02-16 00:29:13 +04:00
Maybe Waffle
e54acb76ea Release teloxide v0.12.1 2023-02-15 23:48:50 +04:00
Maybe Waffle
750d8c3209 Release teloxide-core v0.9.1 2023-02-15 23:09:01 +04:00
Maybe Waffle
a7be39f966 Fix version in teloxide core docs 2023-02-15 23:09:00 +04:00
Maybe Waffle
bb35c2c155 Update changelog 2023-02-15 22:53:22 +04:00
Maybe Waffle
6a9183a53b Update changelog 2023-02-15 18:14:28 +04:00
Maybe Waffle
3c5370548a fix a test 2023-02-15 16:58:33 +04:00
Maybe Waffle
c3a3fc4ee2 Remove unused variables in tests 2023-02-15 16:58:33 +04:00
Maybe Waffle
0b83007954 Add some deserialization tests for topic-related types/values 2023-02-15 16:58:33 +04:00
Maybe Waffle
6a2f5d7f2f Correctly deserialize Message::thread_id 2023-02-15 16:58:33 +04:00
Maybe Waffle
b7c34f8bdb Fix & test rgb deserialization 2023-02-15 16:58:33 +04:00
Waffle Maybe
758687a63e
Merge pull request #852 from teloxide/—alloc
Remove a useless allocation when attaching files
2023-02-15 12:21:12 +00:00
Sima Kinsart
42514e93db
Merge pull request #826 from teloxide/better_error_workaround
Rewrite hacks for reliable `Update` deserialization
2023-02-15 12:01:18 +00:00
Sima Kinsart
0688e1f6f1
Merge pull request #843 from beyarkay/patch-1
Add docstring to Message::from
2023-02-15 11:59:20 +00:00
puh
c29aac96a7
cleanup 2023-02-15 03:35:03 +03:00
Maybe Waffle
ef49094d28 Remove a useless allocation when attaching files 2023-02-13 22:13:59 +04:00
Maybe Waffle
119e305729 Add sqlite-storage-rustls feature 2023-02-13 11:59:06 +04:00
elpekenin
650216d373 Fix broken example links 2023-02-09 23:18:18 +01:00
Boyd Kane
f5ff145a7c
Add docstring to Message::from 2023-02-08 10:50:28 +02:00
puh
560812dfcc
Fix changelogs and TooManyArguments 2023-02-07 12:55:20 +03:00
puuuuh
18a5444f82
Merge branch 'teloxide:master' into master 2023-02-07 10:02:47 +03:00
puh
8ccac0219a
move tests, fix fmt 2023-02-06 13:12:47 +03:00
puuuuh
c7f38981a4
Apply suggestions from code review
Co-authored-by: Waffle Maybe <waffle.lapkin@gmail.com>
2023-02-06 13:04:00 +03:00
Maybe Waffle
74e32a725d Add tests for response processing 2023-02-06 12:20:51 +04:00
Maybe Waffle
2221116d9c Actually provide meaningful errors 2023-02-06 12:20:51 +04:00
Maybe Waffle
cbbfc5b3d1 Rewrite hacks for reliable Update deserialization 2023-02-06 12:20:46 +04:00
puh
27ef3409c2
add macro to implement Deserialize on ApiError enum 2023-02-05 17:15:39 +03:00
Sima Kinsart
6909353500
Merge pull request #835 from teloxide/sync-update-kinds
Synchronize places that use update kinds
2023-02-05 13:16:31 +06:00
puh
b91c79e524
fix split parser for tuple struct with len <2 2023-02-04 15:04:20 +03:00
Waffle Maybe
fb48943871
Merge pull request #836 from teloxide/multiversion
Automatically use `path` versions for development
2023-02-04 03:52:35 +04:00
Maybe Waffle
8e435c9e7f Add a reminder to update teloxide's Cargo.toml when adding features to core 2023-02-03 17:12:57 +04:00
Maybe Waffle
29a027c800 Switch to path+version teloxide-{core,macros} deps 2023-02-03 17:12:35 +04:00
Maybe Waffle
fc2b873c94 Fix deserialization of invalid token error 2023-02-03 16:59:39 +04:00
Maybe Waffle
1974341dbd Update changelogs 2023-02-03 16:53:36 +04:00
Maybe Waffle
2fee7b8503 Simplify an iterator 2023-02-03 16:44:28 +04:00
Maybe Waffle
8baf8af8c1 Document Update::{user, chat} 2023-02-03 16:41:14 +04:00
Maybe Waffle
b5bd147c7c Fix Update::user (return Some on some forgotten variants)
The following update types now are handled in `Update::user`:
- chat join requests
- chat members
- channel post
2023-02-03 16:36:01 +04:00
Maybe Waffle
7a871b7487 Add missing Update::filter_chat_join_request 2023-02-03 16:15:45 +04:00
Maybe Waffle
e97ac18060 Add notes reminding to update places after updating updates 2023-02-03 16:11:20 +04:00
Maybe Waffle
b78a3afde3 Include ChatJoinRequest in full set of update kinds 2023-02-03 16:01:38 +04:00
Waffle Maybe
6c6ae76dec
Merge pull request #825 from teloxide/image_process_failed_error
Add `ApiError::ImageProcessFailed`
2023-02-03 14:19:07 +04:00
Maybe Waffle
2ea918e050 fix fmt 2023-02-01 17:14:49 +04:00
Summer Gram
932bfa64fe
Add ApiError::RequestEntityTooLarge
Occurs when bot tries to upload a file which is larger than 50 MB using multipart/form-data.
2023-01-31 22:49:11 +08:00
Maybe Waffle
da91cc4689 Add ApiError::ImageProcessFailed 2023-01-31 12:14:22 +04:00
Hirrolot
558f2739aa
Fix the number of keywords in Cargo.toml 2023-01-18 01:35:14 +06:00
Hirrolot
125917cfeb
Release teloxide v0.12.0 2023-01-18 01:25:47 +06:00
Maybe Waffle
11defdcffb Remove 6-th keyword from teloxide-core's Cargo.toml 2023-01-17 22:35:47 +04:00
Sima Kinsart
ef17cf4fa0
Merge pull request #815 from teloxide/macros071
Prepare `teloxide-macros` release
2023-01-18 00:32:15 +06:00
Maybe Waffle
a13f0667fb Prepare teloxide-macros release 2023-01-17 20:50:52 +04:00
Maybe Waffle
dde56e5fae Prepare for the release of teloxide-core 2023-01-17 20:29:41 +04:00
Maybe Waffle
b626b3240c Fix docs 2023-01-14 20:51:20 +04:00
Maybe Waffle
950a594e78 Update supported TBA version in docs 2023-01-14 20:50:58 +04:00
Maybe Waffle
428285ef8e Add a FIXME concerning message getters 2023-01-14 20:22:24 +04:00
Maybe Waffle
7c2cf65988 fix a link in schema 2023-01-14 20:20:32 +04:00
Maybe Waffle
be7b259adf Fix ...Forum... messages deserialization 2023-01-14 20:18:09 +04:00
Maybe Waffle
f624b9a996 TBA 6.4 methods 2023-01-14 20:17:14 +04:00
Maybe Waffle
e86184fcd0 FIX codegen, again 2023-01-14 18:46:53 +04:00
Maybe Waffle
01bc5a990b ty fixes 2023-01-14 18:39:13 +04:00
Maybe Waffle
f5afbf2188 doc fix 2023-01-14 18:23:13 +04:00
Maybe Waffle
63e696d8c9 Fix formatting 2023-01-14 18:21:46 +04:00
Maybe Waffle
58fafd4280 TBA 6.4 type changes 2023-01-14 18:21:28 +04:00
Maybe Waffle
644bd6e7f4 fixup supported TBA version in docs 2023-01-14 17:19:34 +04:00
Waffle Maybe
c5cb33c242
Merge pull request #800 from Veetaha/feat/chat-member-overhaul
Overhaul `teloxide_core::types::chat_member` module
2023-01-13 10:58:29 +04:00
Veetaha
93dd8eb650 Fix and improve the changelog according to review feedback 2023-01-13 01:22:34 +01:00
Sanpi
09a1215622
Uses full qualified names in macros code 2023-01-09 19:27:01 +01:00
Veetaha
52666265c1 Replaced issue reference with full URL 2022-12-29 19:03:34 +01:00
Waffle Maybe
b826c3a34b
Merge pull request #804 from teloxide/docccc
Fix documentation build
2022-12-29 14:09:25 +04:00
Maybe Waffle
bcac39a276 Fix clippy 2022-12-29 04:04:50 +04:00
Maybe Waffle
e4fba3345f suppress rustdoc warning about "<bot" in payload docs 2022-12-29 04:04:50 +04:00
Maybe Waffle
4cae2c93cb Use new format! syntax where possible
(fix clippy)
2022-12-29 04:04:50 +04:00
Maybe Waffle
867adbb20b Update scrape examples options 2022-12-29 00:31:17 +04:00
Maybe Waffle
0253979e36 update rust version 2022-12-28 23:16:00 +04:00
Veetaha
36d4ecc884 Improve changelog 2022-12-27 19:59:42 +01:00
Veetaha
c677da42ad Add changelog entries 2022-12-27 19:51:02 +01:00
Veetaha
36da9f1ed9 Overhaul teloxide_core::types::chat_member module 2022-12-27 19:41:34 +01:00
Artyom
0be873122f Removed unnecessary break in comment. 2022-12-27 23:04:31 +06:00
Waffle Maybe
62ff003720
Merge pull request #789 from teloxide/tba63
TBA 6.3
2022-12-17 01:07:58 +04:00
Maybe Waffle
1f5b242b36 Add deprecation note 2022-12-15 17:04:05 +04:00
Maybe Waffle
6f1bb4b519 revert move of storage module 2022-12-14 19:47:21 +04:00
Maybe Waffle
a366334710 Thank god we test --no-default-features in CI uhhhhh 2022-12-14 19:30:21 +04:00
Maybe Waffle
dccd3ce4c7 Add back old module paths, but deprecate then 2022-12-12 18:30:27 +04:00
Maybe Waffle
aa8be1cd15 Flatten teloxide module structure 2022-12-12 18:30:27 +04:00
Sima Kinsart
bb6dd81f6a
Merge branch 'dev' into const-must-use 2022-12-09 19:17:55 +06:00
Hirrolot
cde45ab8ee Remove useless const 2022-12-09 19:16:41 +06:00
Maybe Waffle
7ea428a21c Properly gate tests, so that cargo test works with any features 2022-12-06 16:06:35 +04:00
Maybe Waffle
a9a2610a03 *actually* fix codegen 2022-12-05 23:36:41 +04:00
Maybe Waffle
0dd44fe739 TBA 6.3: methods 2022-12-05 19:25:11 +04:00
Maybe Waffle
eeb06337ee fix codegen (truncate files) 2022-12-05 19:24:49 +04:00
Maybe Waffle
976100e3ec TBA 6.3: types 2022-12-05 19:23:45 +04:00
Maybe Waffle
dfb22450fc Refactor Cargo.tomls 2022-11-28 22:14:49 +04:00
Lev Khoroshansky
b6c27db50e fix: Adjust to axum@0.6.0 2022-11-28 15:43:09 +01:00
Lev Khoroshansky
a6d3e1e9b1 deps: Bump axum to 0.6.0 2022-11-28 15:42:12 +01:00
Maybe Waffle
8ad3bf506b Revert "Revert "Merge branch 'dev'""
This reverts commit 4e004739ca.
2022-11-28 16:51:16 +04:00
Hirrolot
4e004739ca Revert "Merge branch 'dev'"
This reverts commit 4e2ebdcff7, reversing
changes made to c1c71c5b9c.
2022-11-28 16:43:32 +06:00
Hirrolot
6cc4b662ec Revert "Revert "Merge pull request #771 from Turbo87/fix-feature-gate""
This reverts commit 815a0a4d73.
2022-11-28 16:43:15 +06:00
Hirrolot
815a0a4d73 Revert "Merge pull request #771 from Turbo87/fix-feature-gate"
This reverts commit c1c71c5b9c, reversing
changes made to 2c52e2a1d4.
2022-11-28 16:40:13 +06:00
Hirrolot
4e2ebdcff7 Merge branch 'dev' 2022-11-23 13:16:55 +06:00
Hirrolot
762ab2f5e3 Make more functions #[must_use] 2022-11-17 14:54:40 +06:00
Hirrolot
7cd36d9c40 Make more functions const 2022-11-17 14:42:36 +06:00
Waffle Maybe
2ae03963c7
Merge pull request #761 from teloxide/unrock
Remove rocksdb storage
2022-11-16 17:42:12 +04:00
Waffle Maybe
9095aaa839
Merge pull request #764 from Veetaha/feat/add-missing-restricted-fields
Add missing fields for `Restricted` chat member
2022-11-16 17:19:36 +04:00
Veetaha
d0b71c358e Move changelog entries into teloxide-core's changelog file 2022-11-14 23:20:50 +01:00
Veetaha
170941e797 Improve spacing 2022-11-14 23:16:07 +01:00
Veetaha
1c6fc4aae0 Update the docs of is_present() method 2022-11-14 23:13:33 +01:00
Waffle Maybe
63b6f1841a
Merge pull request #765 from teloxide/remove_use_of_deprecated_fn
Remove use of deprecated fn
2022-11-14 22:23:55 +04:00
Maybe Waffle
5f0df0577f Remove use of deprecated chrono::NaiveDateTime::from_timestamp 2022-11-14 17:55:11 +04:00
Veetaha
c65996eb75 Update is_present() to take is_member into account 💪 2022-11-12 01:39:59 +01:00
Veetaha
30439d6d28 Add missing fields for Restricted chat member
These fields are present in the docs, and I tested it manually by calling the `get_chat_member` method with the changed `teloxide-core` code that parsing still works fine for the `Restricted` chat member.

There are however some potential logic bugs here described bellow. I fixed some of them, but others are still outstanding.

\# Logic bugs

\## Shared permission fields in `Administrator` and `Restricted`

The current code of `teloxide-core` at the time of this writing doesn't take into account the shared permission fields of `Administrator` and `Restricted` because just were no such fields in `Restricted` struct. This bug is fixed by this PR.

\## Deceiving behavior of `ChatMemberKind::Member`

The existing getter methods of `ChatMember` assume that if the `ChatMemberKind` is `Member`, then the member has all rights for all fields of `Restricted` struct.

And there is also a similar problem with `Administrator` struct.

The existing getter methods of `ChatMember` assume that if the `ChatMemberKind` is `Member`, then the member has no rights for all fields of `Administrator` struct.

This isn't always true. Regular members *may or may not have* `can_invite_users` permission, for example. This is determined by the default chat parmissions. See bellow.

\# General decieving behavior of permission getters

The default chat permissions seem to override any cofigurations of `Restricted` chat members.
For example, if the `Restricted` chat member has `can_invite_users` set to `true`, but the default chat permissions have `can_invite_users` set to `false`, then the effective `can_invite_users` permission of such a user is `false` (verified experimentally).

Therefore, the getters for the permission fields of the `ChatMember` type actually don't make sense. They don't show the effective permissions of the user. Maybe we could make that clear in their docs, but the problem is that these getters don't have enough context to decide what to return for regular `ChatMemberKind::Member`.

I am not sure how to proceed here. For example, these getters could return `Option` values, and always return `None` for `ChatMemberKind::Member`.

I didn't fix that bug in this PR, because I believe it requires a more careful consideration, larger and potentially breaking changes, that I am not ready to do.

\# Intentionally left as not in scope of this PR

Telegram added topics feature recenenty, and consequently they added `can_manage_topics` field both to `Administrator` and `Restricted` structs. This field is not present in the current code of `teloxide-core` at the time of this writing, and I think it should be added in a separate PR that covers topics API as a whole.

Also, one discrapancy with the new `can_manage_topics` field is with its type and documentation.

Here is how this field looks like in `ChatMemberAdministrator` **and** `ChatAdministratorRights`:

```
can_manage_topics	Boolean	Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
```

Here is how this field looks like in `ChatMemberRestricted`:

```
can_manage_topics	Boolean	True, if the user is allowed to create forum topics
```

Here is how this field looks like in `ChatPermissions`:

```
can_manage_topics	Boolean	Optional. True, if the user is allowed to create forum topics. If omitted defaults to the value of can_pin_messages
````

There is something subtle between the semantics of `can_manage_topics` for regular users and administrators according to the difference in their documentation. I didn't dig into that rabbit hole, so I intentionally didn't include topics feature changes in this PR.
2022-11-09 03:08:52 +01:00
manorom
4f0a64e31e Derive Display Trait for MessageId type 2022-11-08 15:24:54 +01:00
Maybe Waffle
a716bd10bd Remove rocksdb storage from documentation 2022-11-08 12:53:53 +04:00
Maybe Waffle
ba8c316a4a Remove rocksdb storage 2022-11-08 11:59:19 +04:00
Maybe Waffle
9e5bb46bcc require features for rocksdb test 2022-11-07 21:17:26 +04:00
Maybe Waffle
d9bd9e131f fix clippy 2022-11-07 21:17:01 +04:00
Maybe Waffle
405cf34f03 fix readme test path 2022-11-07 20:19:49 +04:00
Maybe Waffle
178a9bcc2f CI attempt №2 2022-11-07 20:00:06 +04:00
Maybe Waffle
31e73a848b CI attempt №1 2022-11-07 19:15:30 +04:00
Maybe Waffle
5c59c6a886 link licenses 2022-11-07 16:49:58 +04:00
Maybe Waffle
05889b3797 Merge rust-toolchain.tomls 2022-11-07 16:38:57 +04:00
Maybe Waffle
b6e46f501e fix teloxide readme metadata 2022-11-07 16:31:32 +04:00
Maybe Waffle
c942459da8 Replace git dependencies with path 2022-11-07 16:19:48 +04:00
Maybe Waffle
1d84b2b76a Merge rustfmt.tomls 2022-11-07 16:13:29 +04:00
Maybe Waffle
1a56c6fc77 Move all media to media/ 2022-11-01 18:30:52 +04:00
Maybe Waffle
c84fa49600 Fix teloxide readme 2022-11-01 17:59:11 +04:00
Maybe Waffle
10c8a205b1 Merge teloxide-core into main repository 2022-11-01 16:36:55 +04:00
Maybe Waffle
71dd29b1ac move teloxide-core to crates/ 2022-11-01 16:33:54 +04:00
Maybe Waffle
6ea8fb1670 Merge teloxide-macros into main repository 2022-11-01 16:12:14 +04:00
Maybe Waffle
0a3c5519dc move teloxide-macros to crates/ 2022-11-01 16:11:50 +04:00
Maybe Waffle
c56e1cbe6f Move teloxide to crates/ folder 2022-11-01 15:13:11 +04:00