#![allow(unused_imports)] use std::collections::HashMap; use serde_json::{json, Value}; use omglib::robot::lark::LarkMsg; use log4rs; use log::{error, info, LevelFilter, warn}; use omglib::utils::config::Config; use std::{env, io}; use std::ops::Deref; use toml::{Table}; use omglib::example_common::load_config; use omglib::robot::traits::IMRobot; use omglib::utils::log_util; #[tokio::main] #[allow(unused_variables)] async fn main() -> io::Result<()>{ let mut conf_path = String::new(); let config = load_config(&mut conf_path, "etc/config2.toml")?; log_util::setup_log(LevelFilter::Info, None, None, true, None).unwrap(); let key_map = config.get_hash_map("lark.tokens").unwrap(); let messenger:Box = Box::new(LarkMsg::new(key_map)); // Send a message if let Err(e) = messenger.send_text("funding", None, "Hello, Lark! All").await { error!("Error: {}", e); } // sleep(Duration::from_secs(1)).await; // Send a card (example card_body) let card_body = json!( { "header": { "template": "blue", "title": { "tag": "plain_text", "content": "HELLO CARD" } }, "elements": [ { "tag": "column_set", "flex_mode": "bisect", "background_style": "grey", "horizontal_spacing": "default", "columns": [ { "tag": "column", "width": "weighted", "weight": 1, "elements": [ { "tag": "markdown", "text_align": "center", "content": "Test \n**10000000**" } ] } ] } ] }); // if let Err(e) = lark_msg.send_card("crypto", card_body).await { // error!("Error: {}", e); // } Ok(()) }