Use u32 for voter counts in polls and u8 for option ids

This commit is contained in:
Maybe Waffle 2023-06-05 17:21:56 +04:00
parent ad10c93923
commit efd801bf2d
3 changed files with 5 additions and 3 deletions

View file

@ -56,6 +56,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `Dice::value` now use `u8`, instead of `i32` ([#887][pr887])
- `Invoice::total_amount`, `LabeledPrice::amount`, `PreCheckoutQuery::total_amount`, `SuccessfulPayment::total_amout` now use `u32`, instead of `i32` ([#887][pr887])
- `Forward::message_id` and `Message::forward_from_message_id` now use `MessageId` instead of `i32` ([#887][pr887])
- `Poll::total_voter_count` and `PollOption::voter_count` now use `u32` instead of `i32` ([#887][pr887])
- `PollAnswer::option_ids` now use `u8` instead of `i32` ([#887][pr887])
[pr852]: https://github.com/teloxide/teloxide/pull/853
[pr859]: https://github.com/teloxide/teloxide/pull/859

View file

@ -22,7 +22,7 @@ pub struct Poll {
pub is_closed: bool,
/// Total number of users that voted in the poll
pub total_voter_count: i32,
pub total_voter_count: u32,
/// True, if the poll is anonymous
pub is_anonymous: bool,
@ -64,7 +64,7 @@ pub struct PollOption {
pub text: String,
/// Number of users that voted for this option.
pub voter_count: i32,
pub voter_count: u32,
}
impl Poll {

View file

@ -12,5 +12,5 @@ pub struct PollAnswer {
/// 0-based identifiers of answer options, chosen by the user.
///
/// May be empty if the user retracted their vote.
pub option_ids: Vec<i32>,
pub option_ids: Vec<u8>,
}