From 7025de58f56357283280aec0e6fcdb648bf46034 Mon Sep 17 00:00:00 2001 From: Waffle Date: Mon, 22 Feb 2021 11:30:13 +0300 Subject: [PATCH] Fix typos in payloads - `get_updates`: `offset` `i64` -> `i32` - `send_location`: make `live_period` optional --- CHANGELOG.md | 4 ++++ src/bot/api.rs | 10 ++-------- src/local_macros.rs | 4 ++-- src/payloads/get_updates.rs | 2 +- src/payloads/send_location.rs | 4 ++-- src/requests/requester.rs | 8 +------- 6 files changed, 12 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6479ddc..5cf4b84a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,9 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fix typos in payloads ([#57][pr57]): + - `get_updates`: `offset` `i64` -> `i32` + - `send_location`: make `live_period` optional - `send_contact` signature (`phone_number` and `first_name` `f64` => `String`) ([#56][pr56]) [pr56]: https://github.com/teloxide/teloxide-core/pull/56 +[pr57]: https://github.com/teloxide/teloxide-core/pull/57 ## [0.1.1] - 2020-02-17 diff --git a/src/bot/api.rs b/src/bot/api.rs index 0cbcf24f..6ee44da9 100644 --- a/src/bot/api.rs +++ b/src/bot/api.rs @@ -158,19 +158,13 @@ impl Requester for Bot { type SendLocation = JsonRequest; - fn send_location( - &self, - chat_id: C, - latitude: f64, - longitude: f64, - live_period: u32, - ) -> Self::SendLocation + fn send_location(&self, chat_id: C, latitude: f64, longitude: f64) -> Self::SendLocation where C: Into, { Self::SendLocation::new( self.clone(), - payloads::SendLocation::new(chat_id, latitude, longitude, live_period), + payloads::SendLocation::new(chat_id, latitude, longitude), ) } diff --git a/src/local_macros.rs b/src/local_macros.rs index 357e17b9..bf743779 100644 --- a/src/local_macros.rs +++ b/src/local_macros.rs @@ -532,9 +532,9 @@ macro_rules! requester_forward { (@method send_location $body:ident $ty:ident) => { type SendLocation = $ty![SendLocation]; - fn send_location(&self, chat_id: C, latitude: f64, longitude: f64, live_period: u32) -> Self::SendLocation where C: Into { + fn send_location(&self, chat_id: C, latitude: f64, longitude: f64) -> Self::SendLocation where C: Into { let this = self; - $body!(send_location this (chat_id: C, latitude: f64, longitude: f64, live_period: u32)) + $body!(send_location this (chat_id: C, latitude: f64, longitude: f64)) } }; (@method edit_message_live_location $body:ident $ty:ident) => { diff --git a/src/payloads/get_updates.rs b/src/payloads/get_updates.rs index beaec909..df63aa63 100644 --- a/src/payloads/get_updates.rs +++ b/src/payloads/get_updates.rs @@ -17,7 +17,7 @@ impl_payload! { /// Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as [`GetUpdates`] is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. /// /// [`GetUpdates`]: crate::payloads::GetUpdates - pub offset: i64, + pub offset: i32, /// Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100. pub limit: u8, /// Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only. diff --git a/src/payloads/send_location.rs b/src/payloads/send_location.rs index f95cc19e..d9cbbd6e 100644 --- a/src/payloads/send_location.rs +++ b/src/payloads/send_location.rs @@ -18,12 +18,12 @@ impl_payload! { pub latitude: f64, /// Longitude of the location pub longitude: f64, + } + optional { /// Period in seconds for which the location will be updated (see [Live Locations], should be between 60 and 86400. /// /// [Live Locations]: https://telegram.org/blog/live-locations pub live_period: u32, - } - optional { /// Sends the message [silently]. Users will receive a notification with no sound. /// /// [silently]: https://telegram.org/blog/channels-2-0#silent-messages diff --git a/src/requests/requester.rs b/src/requests/requester.rs index 0335ca02..69a79199 100644 --- a/src/requests/requester.rs +++ b/src/requests/requester.rs @@ -166,13 +166,7 @@ pub trait Requester { type SendLocation: Request; /// For Telegram documentation see [`SendLocation`]. - fn send_location( - &self, - chat_id: C, - latitude: f64, - longitude: f64, - live_period: u32, - ) -> Self::SendLocation + fn send_location(&self, chat_id: C, latitude: f64, longitude: f64) -> Self::SendLocation where C: Into;