maxbot 0.1.1

Автоматизация работы с чат-ботами MAX
Documentation
use maxbot::{MaxClient, SendMessageParamsBuilder, InlineKeyboardButton, InlineKeyboardBuilder, Attachment};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let token = std::env::var("MAXBOT_TOKEN").expect("Missing MAXBOT_TOKEN");
    let chat_id = std::env::var("CHAT_ID")
        .expect("Missing CHAT_ID")
        .parse::<i64>()?;

    let client = MaxClient::new(token);

    let keyboard = InlineKeyboardBuilder::new()
        .button(InlineKeyboardButton::link("е1.ru", "https://www.e1.ru"))
        .button(InlineKeyboardButton::callback("Щёлк!", "callback_data"))
        .build();

    let builder = SendMessageParamsBuilder::new()
        .text("Выбери действие:")
        .chat_id(chat_id)
        .attachment(Attachment::inline_keyboard(keyboard));

    let mids = client.send_message_builder(builder).await?;
    println!("Сообщение с клавиатурой отправлено, mid = {:?}", mids);
    Ok(())
}