mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-08 19:33:53 +01:00
Fix redundant ""
when sending messages (Note: string types should use FormBuilder::add_raw
instead of FormBuiolder::add
)
This commit is contained in:
parent
4094c1ceb8
commit
7e14e8f9e7
2 changed files with 12 additions and 1 deletions
|
@ -45,6 +45,17 @@ impl FormBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Add the supplied key-value pair to this `FormBuilder`.
|
||||||
|
/// With raw str value, so `serde_json` will not add redundant `""`
|
||||||
|
pub fn add_raw(self, name: &str, value: &str) -> Self {
|
||||||
|
Self {
|
||||||
|
form: self.form.text(
|
||||||
|
name.to_owned(),
|
||||||
|
value.to_owned(),
|
||||||
|
),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn build(self) -> Form {
|
pub fn build(self) -> Form {
|
||||||
self.form
|
self.form
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ impl<'a> Request<'a> for SendMessage<'a> {
|
||||||
Box::pin(async move {
|
Box::pin(async move {
|
||||||
let params = FormBuilder::new()
|
let params = FormBuilder::new()
|
||||||
.add("chat_id", &self.chat_id)
|
.add("chat_id", &self.chat_id)
|
||||||
.add("text", &self.text)
|
.add_raw("text", &self.text)
|
||||||
.add_if_some("parse_mode", self.parse_mode.as_ref())
|
.add_if_some("parse_mode", self.parse_mode.as_ref())
|
||||||
.add_if_some(
|
.add_if_some(
|
||||||
"disable_web_page_preview",
|
"disable_web_page_preview",
|
||||||
|
|
Loading…
Reference in a new issue