mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-22 14:35:36 +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("text", self.text)
|
||||
.apply(|f| {
|
||||
if let Some(parse_mode) = self.parse_mode {
|
||||
f.text("parse_mode", parse_mode)
|
||||
} else {
|
||||
f
|
||||
}
|
||||
self.parse_mode
|
||||
.map_or_else(|| f, |parse_mode| f.text("parse_mode", parse_mode))
|
||||
})
|
||||
.apply(|f| {
|
||||
if let Some(disable_web_page_preview) = self.disable_web_page_preview {
|
||||
self.disable_web_page_preview.map_or_else(
|
||||
|| f,
|
||||
|disable_web_page_preview| {
|
||||
f.text(
|
||||
"disable_web_page_preview",
|
||||
format!("{:?}", disable_web_page_preview),
|
||||
)
|
||||
} else {
|
||||
f
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
.apply(|f| {
|
||||
if let Some(disable_notification) = self.disable_notification {
|
||||
self.disable_notification.map_or_else(
|
||||
|| f,
|
||||
|disable_notification| {
|
||||
f.text(
|
||||
"disable_notification",
|
||||
format!("{:?}", disable_notification),
|
||||
)
|
||||
} else {
|
||||
f
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
.apply(|f| {
|
||||
if let Some(reply_to_message_id) = self.reply_to_message_id {
|
||||
self.reply_to_message_id.map_or_else(
|
||||
|| f,
|
||||
|reply_to_message_id| {
|
||||
f.text("reply_to_message_id", format!("{:?}", reply_to_message_id))
|
||||
} else {
|
||||
f
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
.apply(|f| {
|
||||
if let Some(reply_markup) = self.reply_markup {
|
||||
self.reply_markup.map_or_else(
|
||||
|| f,
|
||||
|reply_markup| {
|
||||
unimplemented!();
|
||||
//f.text("reply_markup", );
|
||||
f
|
||||
} else {
|
||||
f
|
||||
}
|
||||
},
|
||||
)
|
||||
});
|
||||
|
||||
Some(params)
|
||||
|
|
Loading…
Reference in a new issue