2021-01-13 16:12:04 +03:00
|
|
|
use teloxide_core::{
|
|
|
|
prelude::*,
|
2021-01-26 14:10:37 +03:00
|
|
|
types::{DiceEmoji, Me, ParseMode},
|
2021-01-13 16:12:04 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
2021-07-12 16:58:51 +03:00
|
|
|
pretty_env_logger::init();
|
|
|
|
|
2022-05-24 16:59:41 +04:00
|
|
|
let chat_id = ChatId(
|
|
|
|
std::env::var("CHAT_ID")
|
|
|
|
.expect("Expected CHAT_ID env var")
|
|
|
|
.parse::<i64>()?,
|
|
|
|
);
|
2021-01-13 16:12:04 +03:00
|
|
|
|
|
|
|
let bot = Bot::from_env()
|
|
|
|
.parse_mode(ParseMode::MarkdownV2)
|
|
|
|
.auto_send();
|
|
|
|
|
2021-01-26 14:10:37 +03:00
|
|
|
let Me { user: me, .. } = bot.get_me().await?;
|
2021-01-13 16:12:04 +03:00
|
|
|
|
2021-01-26 13:43:34 +03:00
|
|
|
bot.send_dice(chat_id).emoji(DiceEmoji::Dice).await?;
|
2021-01-13 16:12:04 +03:00
|
|
|
bot.send_message(chat_id, format!("Hi, my name is **{}** 👋", me.first_name))
|
|
|
|
.await?;
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
}
|