Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extern crate telegram_bot;
- extern crate crossbeam;
- use telegram_bot::*;
- fn main() {
- let bot_token = "104108634:AAHrTUCQurNh9l2tVajbxFPtLzTueGwrs3M";
- let api = Api::from_token(bot_token).unwrap();
- let mut listener = api.listener(ListeningMethod::LongPoll(None));
- let res = listener.listen(|u| {
- potato(api);
- Ok(ListeningAction::Continue)
- });
- if let Err(e) = res {
- println!("An error occured: {}", e);
- }
- }
- fn potato(api: Api) {
- crossbeam::scope(|scope| {
- scope.spawn(move || {
- println!("getMe: {:?}", api.get_me());
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement