puniyu_adapter_api 0.8.10

puniyu 统一适配器 API trait 库,定义 AdapterApi 基础接口
Documentation
use async_trait::async_trait;
use puniyu_account::AccountInfo;
use puniyu_adapter_types::{AdapterInfo, SendMsgType};
use puniyu_error::Result;
use puniyu_message::Message;

#[async_trait]
pub trait OneBotAdapterApi: Send + Sync {
	/// 发送私聊消息
	async fn send_private_msg(&self, user_id: u64, message: &Message) -> Result<SendMsgType>;

	/// 发送群消息
	async fn send_group_msg(&self, group_id: u64, message: &Message) -> Result<SendMsgType>;

	// 适配器信息
	fn adapter_info(&self) -> AdapterInfo;

	// 账号信息
	fn account_info(&self) -> AccountInfo;
}