Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use i64 for ChatShared::chat_id #162

Merged
merged 1 commit into from
Apr 24, 2024
Merged

Use i64 for ChatShared::chat_id #162

merged 1 commit into from
Apr 24, 2024

Conversation

jelni
Copy link
Contributor

@jelni jelni commented Apr 23, 2024

Chat IDs can be negative, which causes response parsing to fail when the user selects a supergroup.

@@ -1578,7 +1578,7 @@ pub struct UsersShared {
pub struct ChatShared {
pub request_id: i32,

pub chat_id: u64,
pub chat_id: i64,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pub enum ChatId {

Suggested change
pub chat_id: i64,
pub chat_id: ChatId,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this enum is intended to be used solely in requests (as the file name suggests: API params). Is it supposed to be used to parse response data too? All other received chat IDs are parsed as i64 and u64

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Then I guess i64 is the way to go.

Copy link
Owner

@ayrat555 ayrat555 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you

@ayrat555 ayrat555 merged commit 9582830 into ayrat555:master Apr 24, 2024
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants