send_self/
send_self.rs

1use telebot::Bot;
2use futures::stream::Stream;
3use std::env;
4
5// import all available functions
6use telebot::functions::*;
7
8fn main() {
9    // Create the bot
10    let mut bot = Bot::new(&env::var("TELEGRAM_BOT_KEY").unwrap()).update_interval(200);
11
12    let handle = bot.new_cmd("/send_self")
13        .and_then(|(bot, msg)| {
14            bot.document(msg.chat.id)
15                .file("examples/send_self.rs")
16                .send()
17        })
18        .for_each(|_| Ok(()));
19
20    // enter the main loop
21    bot.run_with(handle);
22}