maxbot 0.7.6

Автоматизация работы с чат-ботами на платформе MAX (max.ru)
Documentation
//! Демонстрация простых методов отправки.

use maxbot::{ContactData, InlineKeyboardButton, InlineKeyboardBuilder, MaxClient, MaxClientSimpleExt};

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

    client.send_plain_text_to_chat(chat_id, "Hello from simple method!").await?;
    client.send_markdown_to_chat(chat_id, "**Bold** text").await?;
    client.send_html_to_chat(chat_id, "<b>Bold</b> text").await?;
    client.send_sticker_to_chat(chat_id, "154ed15bb").await?;
    client.send_location_to_chat(chat_id, 55.7558, 37.6176).await?;

    let contact = ContactData {
        name: Some("Max Bot".to_string()),
        contact_id: Some(client.get_me().await?.user.user_id),
        vcf_info: None,
        vcf_phone: None,
    };
    client.send_contact_to_chat(chat_id, contact).await?;

    client.send_share_to_chat(chat_id, "https://dev.max.ru", Some("API MAX")).await?;

    let keyboard = InlineKeyboardBuilder::new()
        .button(InlineKeyboardButton::callback("Нажми", "data"))
        .build()?;
    client.send_keyboard_to_chat(chat_id, "Кнопка:", keyboard).await?;

    Ok(())
}