- Add WeChatBotError enum for error handling with various error types. - Create a Result type alias for easier error management. - Implement ILinkClient for low-level API interactions including QR code generation, message sending, and updates retrieval. - Define message types and structures for handling incoming messages and media content. - Add tests for error handling and message parsing to ensure reliability. Co-authored-by: Copilot <copilot@github.com>
39 lines
961 B
Rust
39 lines
961 B
Rust
//! # wechatbot
|
|
//!
|
|
//! WeChat iLink Bot SDK for Rust.
|
|
//!
|
|
//! ## Quick Start
|
|
//!
|
|
//! ```rust,no_run
|
|
//! use wechatbot::{WeChatBot, BotOptions};
|
|
//!
|
|
//! #[tokio::main]
|
|
//! async fn main() {
|
|
//! let bot = WeChatBot::new(BotOptions::default());
|
|
//! bot.login(false).await.unwrap();
|
|
//!
|
|
//! bot.on_message(Box::new(|msg| {
|
|
//! println!("{}: {}", msg.user_id, msg.text);
|
|
//! })).await;
|
|
//!
|
|
//! bot.run().await.unwrap();
|
|
//! }
|
|
//! ```
|
|
|
|
pub mod bot;
|
|
pub mod cdn;
|
|
pub mod crypto;
|
|
pub mod error;
|
|
pub mod protocol;
|
|
pub mod types;
|
|
|
|
pub use bot::{BotOptions, MessageHandler, SendContent, WeChatBot};
|
|
pub use cdn::CdnClient;
|
|
pub use crypto::{
|
|
decode_aes_key, decrypt_aes_ecb, decrypt_aes_ecb as download_decrypt, encode_aes_key_base64,
|
|
encode_aes_key_hex, encrypt_aes_ecb, generate_aes_key,
|
|
};
|
|
pub use error::{Result, WeChatBotError};
|
|
pub use protocol::{build_cdn_upload_url, GetUploadUrlParams, GetUploadUrlResponse};
|
|
pub use types::*;
|