Commit graph

4109 commits

Author SHA1 Message Date
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
Waffle Maybe
45538db820
Merge pull request #762 from manorom/message-id-display
Derive Display Trait for MessageId type
2022-11-08 22:15:02 +04: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
Sima Kinsart
0df19e5fc9
Merge pull request #759 from teloxide/project-restructure
Project restructure
2022-11-08 04:47:58 +06: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
Sima Kinsart
2c52e2a1d4 Merge pull request #758 from teloxide/dev
Merge v0.11.1

Former-commit-id: 637dcb0d59090dbcf13b2e44a3cc7a27f03ac298
2022-10-31 22:04:01 +06:00
Sima Kinsart
9d37ee082d Merge pull request #757 from teloxide/release-v0.11.1
Release v0.11.1

Former-commit-id: 42fc6553c6
2022-10-31 21:44:53 +06:00
Sima Kinsart
48946f3315 Fix the version header (CHANGELOG.md)
Former-commit-id: bce24fdf8d
2022-10-31 21:29:38 +06:00
Hirrolot
727a604638 Update the migration guide version
Former-commit-id: 08d2e4f102
2022-10-31 21:26:28 +06:00
Hirrolot
6d105d3b78 Release v0.11.1
Former-commit-id: b97c2c6063
2022-10-31 16:30:49 +06:00
Sima Kinsart
6846b74447 Merge pull request #756 from teloxide/update-readme
Don't list the `auto-send` feature in `README.md`

Former-commit-id: 3fd356e0bd
2022-10-31 16:16:09 +06:00
Waffle Maybe
e93420205e Merge pull request #755 from teloxide/migration_guide_fixes
migration guide fixes

Former-commit-id: c9278e2c10
2022-10-31 14:00:52 +04:00
Sima Kinsart
ba064a243d Don't list the auto-send feature in README.md
Former-commit-id: 69d86d91dd
2022-10-31 15:56:13 +06:00
Sima Kinsart
73996fd960 Merge pull request #754 from teloxide/document-rocksdb-feature
Update the feature set with `rocksdb-storage`

Former-commit-id: b2a4073156
2022-10-31 15:45:46 +06:00
Maybe Waffle
3ecb3fb06a Add stop token changes to the migration guide
Former-commit-id: 7287ffe2f0
2022-10-31 13:44:32 +04:00
Maybe Waffle
e094d6a20a Remove ,rust from languages in MIGRATION_GUIDE.md
Anyway no one is rendering the syntax for diffs, while some even stop
understanding that it's a diff.


Former-commit-id: 2f18b5f060
2022-10-31 13:36:26 +04:00
Sima Kinsart
01929c5476 Update the feature set with rocksdb-storage
Former-commit-id: e2f6fde743
2022-10-30 14:42:33 +06:00
Sima Kinsart
44f1635db6 Merge pull request #753 from xamgore/rocksdb-storage
Extend dialogue storages with RocksDB

Former-commit-id: 926b8ef786
2022-10-30 12:13:01 +06:00
Sima Kinsart
2fd41bda94 Merge branch 'dev' into rocksdb-storage
Former-commit-id: 24f8476da7
2022-10-30 11:57:10 +06:00
Sima Kinsart
49cd9a8548 Link the PR to CHANGELOG.md
Former-commit-id: 2b749ed15c
2022-10-30 11:55:54 +06:00
Sima Kinsart
9a078b738b Merge pull request #746 from teloxide/command-repl
Implement the `CommandRepl` trait

Former-commit-id: cb2298d40d
2022-10-29 15:34:23 +06:00
Hirrolot
5532a4cd87 Rename CommandRepl => CommandReplExt
Former-commit-id: e7c5317954
2022-10-29 14:41:26 +06:00
Sima Kinsart
b147b98930 Merge pull request #752 from teloxide/update-readme-highlights
Mention graceful shutdown in the highlights

Former-commit-id: f8b03ea733
2022-10-29 14:26:46 +06:00
xamgore
6b8336a669 Extend dialogue storages with RocksDB
Former-commit-id: d75b465205
2022-10-25 17:01:02 +04:00
Sima Kinsart
7963a9184a Mention graceful shutdown in the highlights
Former-commit-id: d60a7d0341
2022-10-22 10:11:18 +06:00
Hirrolot
9b8e21231c Make CommandRepl's methods #[must_use]
Former-commit-id: 0fb9399201
2022-10-15 23:54:16 +06:00
Hirrolot
e39a9d007a Deprecate BotCommands::ty too
Former-commit-id: d90a9ff2e4
2022-10-11 15:00:02 +06:00
Hirrolot
5ed01a91d4 Use Command::repl in README.md
Former-commit-id: db30e9efbe
2022-10-11 14:57:40 +06:00
Hirrolot
f54db300ed Implement the CommandRepl trait
Former-commit-id: 739772929b
2022-10-11 14:54:51 +06:00
Waffle Maybe
eece564727 Merge pull request #743 from TmLev/master
Sync docs & comments with code, fix grammar and typos

Former-commit-id: 512e785999
2022-10-10 20:25:43 +04:00