Skip to content

Commit b6d5849

Browse files
committed
Merge pull request #29 from LukasKalbertodt/api-update
Api update
2 parents dd2c099 + 56a1d3d commit b6d5849

File tree

7 files changed

+232
-64
lines changed

7 files changed

+232
-64
lines changed

Cargo.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "telegram-bot"
3-
version = "0.3.0"
4-
authors = ["Lukas Kalbertodt <[email protected]>"]
3+
version = "0.4.0"
4+
authors = ["Lukas Kalbertodt <[email protected]>", "Fedor Gogolev <[email protected]>"]
55

66
description = "A library for creating Telegram bots."
77

@@ -15,7 +15,7 @@ license = "MIT"
1515
exclude = ["deploy.sh"]
1616

1717
[dependencies]
18-
hyper = "*"
19-
rustc-serialize = "*"
20-
url = "*"
21-
multipart = "*"
18+
hyper = "0.7"
19+
rustc-serialize = "0.3"
20+
url = "0.5"
21+
multipart = "0.3"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ fn main() {
4242
try!(api.send_message(
4343
m.chat.id(),
4444
format!("Hi, {}! You just wrote '{}'", name, t),
45-
None, None, None));
45+
None, None, None, None));
4646
},
4747
_ => {}
4848
}
@@ -63,7 +63,7 @@ You can find a bigger example in the `examples` folder.
6363
This library is available via `crates.io`. In order to use it, just add this to your `Cargo.toml`:
6464

6565
```
66-
telegram-bot = "0.3"
66+
telegram-bot = "0.4"
6767
```
6868

6969
## Collaboration

examples/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() {
4141
try!(api.send_message(
4242
chat_id,
4343
format!("Hi, {}!", name),
44-
None, None, Some(keyboard.into())));
44+
None, None, None, Some(keyboard.into())));
4545

4646
},
4747
MessageType::Location(loc) => {

examples/simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fn main() {
2828
try!(api.send_message(
2929
m.chat.id(),
3030
format!("Hi, {}! You just wrote '{}'", name, t),
31-
None, None, None));
31+
None, None, None, None));
3232
},
3333
_ => {}
3434
}

src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
//! try!(api.send_message(
2222
//! m.chat.id(),
2323
//! format!("Hi, {}!", m.from.first_name),
24-
//! None, None, None)
24+
//! None, None, None, None)
2525
//! );
2626
//! }
2727
//! }
@@ -161,6 +161,7 @@ impl Api {
161161

162162
/// Corresponds to the "sendMessage" method of the API.
163163
pub fn send_message(&self, chat_id: Integer, text: String,
164+
parse_mode: Option<ParseMode>,
164165
disable_web_page_preview: Option<bool>,
165166
reply_to_message_id: Option<Integer>,
166167
reply_markup: Option<ReplyMarkup>)
@@ -169,6 +170,7 @@ impl Api {
169170
let mut params = Params::new();
170171
params.add_get("chat_id", chat_id);
171172
params.add_get("text", text);
173+
params.add_get_opt("parse_mode", parse_mode);
172174
params.add_get_opt("disable_web_page_preview", disable_web_page_preview);
173175
params.add_get_opt("reply_to_message_id", reply_to_message_id);
174176
try!(params.add_get_json_opt("reply_markup", reply_markup));
@@ -531,7 +533,7 @@ impl Api {
531533
// Change connect("&") to join("&") when rust 1.3 becomes stable
532534
let bodyparams = p.get_params().into_iter().map(|&(k, ref v)| {
533535
format!("{}={}", k, &**v)
534-
}).collect::<Vec<_>>().connect("&");
536+
}).collect::<Vec<_>>().join("&");
535537

536538
// Create the request with the body and headers
537539
let req = client

0 commit comments

Comments
 (0)