mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 09:49:07 +01:00
Simplify requests/send_message.rs a little bit
This commit is contained in:
parent
47e97ec2be
commit
7ec19d23c2
1 changed files with 34 additions and 33 deletions
|
@ -37,47 +37,48 @@ impl Request for SendMessage {
|
||||||
.text("chat_id", format!("{:?}", self.chat_id))
|
.text("chat_id", format!("{:?}", self.chat_id))
|
||||||
.text("text", self.text)
|
.text("text", self.text)
|
||||||
.apply(|f| {
|
.apply(|f| {
|
||||||
if let Some(parse_mode) = self.parse_mode {
|
self.parse_mode
|
||||||
f.text("parse_mode", parse_mode)
|
.map_or_else(|| f, |parse_mode| f.text("parse_mode", parse_mode))
|
||||||
} else {
|
|
||||||
f
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
.apply(|f| {
|
.apply(|f| {
|
||||||
if let Some(disable_web_page_preview) = self.disable_web_page_preview {
|
self.disable_web_page_preview.map_or_else(
|
||||||
f.text(
|
|| f,
|
||||||
"disable_web_page_preview",
|
|disable_web_page_preview| {
|
||||||
format!("{:?}", disable_web_page_preview),
|
f.text(
|
||||||
)
|
"disable_web_page_preview",
|
||||||
} else {
|
format!("{:?}", disable_web_page_preview),
|
||||||
f
|
)
|
||||||
}
|
},
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.apply(|f| {
|
.apply(|f| {
|
||||||
if let Some(disable_notification) = self.disable_notification {
|
self.disable_notification.map_or_else(
|
||||||
f.text(
|
|| f,
|
||||||
"disable_notification",
|
|disable_notification| {
|
||||||
format!("{:?}", disable_notification),
|
f.text(
|
||||||
)
|
"disable_notification",
|
||||||
} else {
|
format!("{:?}", disable_notification),
|
||||||
f
|
)
|
||||||
}
|
},
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.apply(|f| {
|
.apply(|f| {
|
||||||
if let Some(reply_to_message_id) = self.reply_to_message_id {
|
self.reply_to_message_id.map_or_else(
|
||||||
f.text("reply_to_message_id", format!("{:?}", reply_to_message_id))
|
|| f,
|
||||||
} else {
|
|reply_to_message_id| {
|
||||||
f
|
f.text("reply_to_message_id", format!("{:?}", reply_to_message_id))
|
||||||
}
|
},
|
||||||
|
)
|
||||||
})
|
})
|
||||||
.apply(|f| {
|
.apply(|f| {
|
||||||
if let Some(reply_markup) = self.reply_markup {
|
self.reply_markup.map_or_else(
|
||||||
unimplemented!();
|
|| f,
|
||||||
//f.text("reply_markup", );
|
|reply_markup| {
|
||||||
f
|
unimplemented!();
|
||||||
} else {
|
//f.text("reply_markup", );
|
||||||
f
|
f
|
||||||
}
|
},
|
||||||
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
Some(params)
|
Some(params)
|
||||||
|
|
Loading…
Reference in a new issue