Fix arguments and return types of live location methods

This commit is contained in:
Maybe Waffle 2023-02-14 14:47:06 +04:00
parent 387f6d1284
commit 33989c7f63
8 changed files with 16 additions and 62 deletions

View file

@ -1314,7 +1314,7 @@ Schema(
), ),
Method( Method(
names: ("editMessageLiveLocationInline", "EditMessageLiveLocationInline", "edit_message_live_location_inline"), names: ("editMessageLiveLocationInline", "EditMessageLiveLocationInline", "edit_message_live_location_inline"),
return_ty: RawTy("Message"), return_ty: True,
doc: Doc( doc: Doc(
md: "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [stopMessageLiveLocation]. On success, True is returned.", md: "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [stopMessageLiveLocation]. On success, True is returned.",
md_links: {"stopMessageLiveLocation": "https://core.telegram.org/bots/api#stopmessagelivelocation"}, md_links: {"stopMessageLiveLocation": "https://core.telegram.org/bots/api#stopmessagelivelocation"},
@ -1389,16 +1389,6 @@ Schema(
ty: RawTy("MessageId"), ty: RawTy("MessageId"),
descr: Doc(md: "Identifier of the message to edit") descr: Doc(md: "Identifier of the message to edit")
), ),
Param(
name: "latitude",
ty: f64,
descr: Doc(md: "Latitude of new location"),
),
Param(
name: "longitude",
ty: f64,
descr: Doc(md: "Longitude of new location"),
),
Param( Param(
name: "reply_markup", name: "reply_markup",
ty: Option(RawTy("ReplyMarkup")), ty: Option(RawTy("ReplyMarkup")),
@ -1415,7 +1405,7 @@ Schema(
), ),
Method( Method(
names: ("stopMessageLiveLocationInline", "StopMessageLiveLocationInline", "stop_message_live_location_inline"), names: ("stopMessageLiveLocationInline", "StopMessageLiveLocationInline", "stop_message_live_location_inline"),
return_ty: RawTy("Message"), return_ty: True,
doc: Doc( doc: Doc(
md: "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [stopMessageLiveLocation]. On success, True is returned.", md: "Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [stopMessageLiveLocation]. On success, True is returned.",
md_links: {"stopMessageLiveLocation": "https://core.telegram.org/bots/api#stopmessagelivelocation"}, md_links: {"stopMessageLiveLocation": "https://core.telegram.org/bots/api#stopmessagelivelocation"},
@ -1428,16 +1418,6 @@ Schema(
ty: String, ty: String,
descr: Doc(md: "Identifier of the inline message"), descr: Doc(md: "Identifier of the inline message"),
), ),
Param(
name: "latitude",
ty: f64,
descr: Doc(md: "Latitude of new location"),
),
Param(
name: "longitude",
ty: f64,
descr: Doc(md: "Longitude of new location"),
),
Param( Param(
name: "reply_markup", name: "reply_markup",
ty: Option(RawTy("ReplyMarkup")), ty: Option(RawTy("ReplyMarkup")),

View file

@ -402,15 +402,11 @@ trait ErasableRequester<'a> {
&self, &self,
chat_id: Recipient, chat_id: Recipient,
message_id: MessageId, message_id: MessageId,
latitude: f64,
longitude: f64,
) -> ErasedRequest<'a, StopMessageLiveLocation, Self::Err>; ) -> ErasedRequest<'a, StopMessageLiveLocation, Self::Err>;
fn stop_message_live_location_inline( fn stop_message_live_location_inline(
&self, &self,
inline_message_id: String, inline_message_id: String,
latitude: f64,
longitude: f64,
) -> ErasedRequest<'a, StopMessageLiveLocationInline, Self::Err>; ) -> ErasedRequest<'a, StopMessageLiveLocationInline, Self::Err>;
fn send_venue( fn send_venue(
@ -1064,21 +1060,15 @@ where
&self, &self,
chat_id: Recipient, chat_id: Recipient,
message_id: MessageId, message_id: MessageId,
latitude: f64,
longitude: f64,
) -> ErasedRequest<'a, StopMessageLiveLocation, Self::Err> { ) -> ErasedRequest<'a, StopMessageLiveLocation, Self::Err> {
Requester::stop_message_live_location(self, chat_id, message_id, latitude, longitude) Requester::stop_message_live_location(self, chat_id, message_id).erase()
.erase()
} }
fn stop_message_live_location_inline( fn stop_message_live_location_inline(
&self, &self,
inline_message_id: String, inline_message_id: String,
latitude: f64,
longitude: f64,
) -> ErasedRequest<'a, StopMessageLiveLocationInline, Self::Err> { ) -> ErasedRequest<'a, StopMessageLiveLocationInline, Self::Err> {
Requester::stop_message_live_location_inline(self, inline_message_id, latitude, longitude) Requester::stop_message_live_location_inline(self, inline_message_id).erase()
.erase()
} }
fn send_venue( fn send_venue(

View file

@ -198,15 +198,13 @@ impl Requester for Bot {
&self, &self,
chat_id: C, chat_id: C,
message_id: MessageId, message_id: MessageId,
latitude: f64,
longitude: f64,
) -> Self::StopMessageLiveLocation ) -> Self::StopMessageLiveLocation
where where
C: Into<Recipient>, C: Into<Recipient>,
{ {
Self::StopMessageLiveLocation::new( Self::StopMessageLiveLocation::new(
self.clone(), self.clone(),
payloads::StopMessageLiveLocation::new(chat_id, message_id, latitude, longitude), payloads::StopMessageLiveLocation::new(chat_id, message_id),
) )
} }
@ -215,15 +213,13 @@ impl Requester for Bot {
fn stop_message_live_location_inline<I>( fn stop_message_live_location_inline<I>(
&self, &self,
inline_message_id: I, inline_message_id: I,
latitude: f64,
longitude: f64,
) -> Self::StopMessageLiveLocationInline ) -> Self::StopMessageLiveLocationInline
where where
I: Into<String>, I: Into<String>,
{ {
Self::StopMessageLiveLocationInline::new( Self::StopMessageLiveLocationInline::new(
self.clone(), self.clone(),
payloads::StopMessageLiveLocationInline::new(inline_message_id, latitude, longitude), payloads::StopMessageLiveLocationInline::new(inline_message_id),
) )
} }

View file

@ -588,17 +588,17 @@ macro_rules! requester_forward {
(@method stop_message_live_location $body:ident $ty:ident) => { (@method stop_message_live_location $body:ident $ty:ident) => {
type StopMessageLiveLocation = $ty![StopMessageLiveLocation]; type StopMessageLiveLocation = $ty![StopMessageLiveLocation];
fn stop_message_live_location<C>(&self, chat_id: C, message_id: MessageId, latitude: f64, longitude: f64) -> Self::StopMessageLiveLocation where C: Into<Recipient> { fn stop_message_live_location<C>(&self, chat_id: C, message_id: MessageId) -> Self::StopMessageLiveLocation where C: Into<Recipient> {
let this = self; let this = self;
$body!(stop_message_live_location this (chat_id: C, message_id: MessageId, latitude: f64, longitude: f64)) $body!(stop_message_live_location this (chat_id: C, message_id: MessageId))
} }
}; };
(@method stop_message_live_location_inline $body:ident $ty:ident) => { (@method stop_message_live_location_inline $body:ident $ty:ident) => {
type StopMessageLiveLocationInline = $ty![StopMessageLiveLocationInline]; type StopMessageLiveLocationInline = $ty![StopMessageLiveLocationInline];
fn stop_message_live_location_inline<I>(&self, inline_message_id: I, latitude: f64, longitude: f64) -> Self::StopMessageLiveLocationInline where I: Into<String> { fn stop_message_live_location_inline<I>(&self, inline_message_id: I) -> Self::StopMessageLiveLocationInline where I: Into<String> {
let this = self; let this = self;
$body!(stop_message_live_location_inline this (inline_message_id: I, latitude: f64, longitude: f64)) $body!(stop_message_live_location_inline this (inline_message_id: I))
} }
}; };
(@method send_venue $body:ident $ty:ident) => { (@method send_venue $body:ident $ty:ident) => {

View file

@ -2,7 +2,7 @@
use serde::Serialize; use serde::Serialize;
use crate::types::{Message, ReplyMarkup}; use crate::types::{ReplyMarkup, True};
impl_payload! { impl_payload! {
/// Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [`StopMessageLiveLocation`]. On success, True is returned. /// Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [`StopMessageLiveLocation`]. On success, True is returned.
@ -11,7 +11,7 @@ impl_payload! {
/// ///
/// [`StopMessageLiveLocation`]: crate::payloads::StopMessageLiveLocation /// [`StopMessageLiveLocation`]: crate::payloads::StopMessageLiveLocation
#[derive(Debug, PartialEq, Clone, Serialize)] #[derive(Debug, PartialEq, Clone, Serialize)]
pub EditMessageLiveLocationInline (EditMessageLiveLocationInlineSetters) => Message { pub EditMessageLiveLocationInline (EditMessageLiveLocationInlineSetters) => True {
required { required {
/// Identifier of the inline message /// Identifier of the inline message
pub inline_message_id: String [into], pub inline_message_id: String [into],

View file

@ -11,7 +11,7 @@ impl_payload! {
/// ///
/// [`Message`]: crate::types::Message /// [`Message`]: crate::types::Message
/// [`StopMessageLiveLocation`]: crate::payloads::StopMessageLiveLocation /// [`StopMessageLiveLocation`]: crate::payloads::StopMessageLiveLocation
#[derive(Debug, PartialEq, Clone, Serialize)] #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub StopMessageLiveLocation (StopMessageLiveLocationSetters) => Message { pub StopMessageLiveLocation (StopMessageLiveLocationSetters) => Message {
required { required {
/// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`) /// Unique identifier for the target chat or username of the target channel (in the format `@channelusername`)
@ -19,10 +19,6 @@ impl_payload! {
/// Identifier of the message to edit /// Identifier of the message to edit
#[serde(flatten)] #[serde(flatten)]
pub message_id: MessageId, pub message_id: MessageId,
/// Latitude of new location
pub latitude: f64,
/// Longitude of new location
pub longitude: f64,
} }
optional { optional {
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user. /// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.

View file

@ -2,7 +2,7 @@
use serde::Serialize; use serde::Serialize;
use crate::types::{Message, ReplyMarkup}; use crate::types::{ReplyMarkup, True};
impl_payload! { impl_payload! {
/// Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [`StopMessageLiveLocation`]. On success, True is returned. /// Use this method to edit live location messages. A location can be edited until its live_period expires or editing is explicitly disabled by a call to [`StopMessageLiveLocation`]. On success, True is returned.
@ -10,15 +10,11 @@ impl_payload! {
/// See also: [`StopMessageLiveLocation`](crate::payloads::StopMessageLiveLocation) /// See also: [`StopMessageLiveLocation`](crate::payloads::StopMessageLiveLocation)
/// ///
/// [`StopMessageLiveLocation`]: crate::payloads::StopMessageLiveLocation /// [`StopMessageLiveLocation`]: crate::payloads::StopMessageLiveLocation
#[derive(Debug, PartialEq, Clone, Serialize)] #[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize)]
pub StopMessageLiveLocationInline (StopMessageLiveLocationInlineSetters) => Message { pub StopMessageLiveLocationInline (StopMessageLiveLocationInlineSetters) => True {
required { required {
/// Identifier of the inline message /// Identifier of the inline message
pub inline_message_id: String [into], pub inline_message_id: String [into],
/// Latitude of new location
pub latitude: f64,
/// Longitude of new location
pub longitude: f64,
} }
optional { optional {
/// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user. /// Additional interface options. A JSON-serialized object for an [inline keyboard], [custom reply keyboard], instructions to remove reply keyboard or to force a reply from the user.

View file

@ -319,8 +319,6 @@ pub trait Requester {
&self, &self,
chat_id: C, chat_id: C,
message_id: MessageId, message_id: MessageId,
latitude: f64,
longitude: f64,
) -> Self::StopMessageLiveLocation ) -> Self::StopMessageLiveLocation
where where
C: Into<Recipient>; C: Into<Recipient>;
@ -334,8 +332,6 @@ pub trait Requester {
fn stop_message_live_location_inline<I>( fn stop_message_live_location_inline<I>(
&self, &self,
inline_message_id: I, inline_message_id: I,
latitude: f64,
longitude: f64,
) -> Self::StopMessageLiveLocationInline ) -> Self::StopMessageLiveLocationInline
where where
I: Into<String>; I: Into<String>;