teloxide/examples/dices.rs

18 lines
394 B
Rust
Raw Normal View History

// This bot throws a dice on each incoming message.
2020-02-18 23:54:41 +01:00
2022-03-24 12:25:42 +01:00
use teloxide::prelude::*;
2020-01-29 18:43:47 +01:00
#[tokio::main]
async fn main() {
pretty_env_logger::init();
log::info!("Starting dices_bot...");
2020-01-29 18:43:47 +01:00
2021-03-05 22:24:10 +01:00
let bot = Bot::from_env().auto_send();
2020-02-13 18:23:22 +01:00
2022-03-24 12:25:42 +01:00
teloxide::repl(bot, |message: Message, bot: AutoSend<Bot>| async move {
2021-12-03 15:02:57 +01:00
bot.send_dice(message.chat.id).await?;
2020-08-02 09:08:43 +02:00
respond(())
2020-07-30 15:07:58 +02:00
})
.await;
2020-01-29 18:43:47 +01:00
}