Skip to main content

get_me/
get_me.rs

1extern crate futures;
2extern crate telegram_bot_fork;
3extern crate tokio;
4
5use std::env;
6
7use futures::{future::lazy, Future};
8
9use telegram_bot_fork::*;
10
11fn main() {
12    tokio::runtime::current_thread::Runtime::new()
13        .unwrap()
14        .block_on(lazy(|| {
15            let token = env::var("TELEGRAM_BOT_TOKEN").unwrap();
16            let api = Api::new(token).unwrap();
17
18            tokio::executor::current_thread::spawn(api.send(GetMe).then(|r| {
19                println!("{:?}", r);
20
21                Ok(())
22            }));
23
24            Ok::<_, Error>(())
25        }))
26        .unwrap();
27}