| Crates.io | fishpi-sdk |
| lib.rs | fishpi-sdk |
| version | 0.1.5 |
| created_at | 2026-01-08 03:01:32.93039+00 |
| updated_at | 2026-01-23 07:27:48.198866+00 |
| description | A Rust SDK for interacting with the FishPi community API |
| homepage | https://github.com/KwdeTfpv/fishpi-rust-sdk |
| repository | https://github.com/KwdeTfpv/fishpi-rust-sdk |
| max_upload_size | |
| id | 2029451 |
| size | 266,514 |
一个用于与摸鱼派社区 API 交互的 Rust SDK,提供用户管理、文章、聊天室、私聊、通知、清风明月、红包、评论、举报、日志、文件上传等功能的异步客户端。
在 Cargo.toml 中添加:
[dependencies]
fishpi-sdk = "0.1.5"
tokio = { version = "1", features = ["full"] }
或使用 Cargo:
cargo add fishpi-sdk
use fishpi_sdk::{FishPi, api::chatroom::ChatRoom};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// 创建聊天室客户端
let mut chatroom = ChatRoom::new("your_api_key".to_string());
// 监听消息事件(直接传递具体类型,无需 match)
chatroom.on_msg(|msg| {
println!("Message: {}", msg.content);
}).await;
// 监听弹幕事件
chatroom.on_barrager(|barrager| {
println!("Barrage: {}", barrager.content);
}).await;
// 连接聊天室
chatroom.connect(false).await?;
// 发送消息
chatroom.send("Hello!".to_string()).await?;
Ok(())
}
完整文档请查看 docs.rs。
欢迎提交 Issue 和 Pull Request。请确保代码通过 cargo test 和 cargo clippy。
本项目采用 MIT 许可证。