mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +01:00
Fix a few things and format the code
This commit is contained in:
parent
47d56c7ddd
commit
23b94bab01
2 changed files with 18 additions and 7 deletions
|
@ -9,6 +9,11 @@ where
|
|||
{
|
||||
value.map_or_else(
|
||||
|| form,
|
||||
|value| form.text(name.to_owned(), serde_json::to_string(value).expect("Failed to serialize a value to JSON")),
|
||||
|value| {
|
||||
form.text(
|
||||
name.to_owned(),
|
||||
serde_json::to_string(value).expect("serde_json::to_string failed"),
|
||||
)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ impl Request for SendMessage {
|
|||
}
|
||||
fn params(self) -> Option<Form> {
|
||||
let params = Form::new()
|
||||
.text("chat_id", format!("{}", self.chat_id))
|
||||
.text("chat_id", serde_json::to_string(&self.chat_id).unwrap())
|
||||
.text("text", self.text);
|
||||
let params = helpers::add_to_form_if_some(params, "parse_mode", self.parse_mode.as_ref());
|
||||
let params = helpers::add_to_form_if_some(
|
||||
|
@ -40,10 +40,16 @@ impl Request for SendMessage {
|
|||
"disable_web_page_preview",
|
||||
self.disable_web_page_preview.as_ref(),
|
||||
);
|
||||
let params =
|
||||
helpers::add_to_form_if_some(params, "disable_notification", self.disable_notification.as_ref());
|
||||
let params =
|
||||
helpers::add_to_form_if_some(params, "reply_to_message_id", self.reply_to_message_id.as_ref());
|
||||
let params = helpers::add_to_form_if_some(
|
||||
params,
|
||||
"disable_notification",
|
||||
self.disable_notification.as_ref(),
|
||||
);
|
||||
let params = helpers::add_to_form_if_some(
|
||||
params,
|
||||
"reply_to_message_id",
|
||||
self.reply_to_message_id.as_ref(),
|
||||
);
|
||||
|
||||
// TODO:
|
||||
// helpers::add_to_form_if_some(
|
||||
|
|
Loading…
Reference in a new issue