Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/4t145/mirai-ws
mirai-http-api rust interface, based on tungstenite.
https://github.com/4t145/mirai-ws
Last synced: about 2 months ago
JSON representation
mirai-http-api rust interface, based on tungstenite.
- Host: GitHub
- URL: https://github.com/4t145/mirai-ws
- Owner: 4t145
- License: mit
- Created: 2021-09-10T17:49:54.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-12T04:56:50.000Z (over 3 years ago)
- Last Synced: 2024-10-19T14:01:59.615Z (3 months ago)
- Language: Rust
- Size: 15.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 使用
```rust
use crate::conn::{MiraiStream, MiraiStreamConfig};
use crate::protocol::{message::MsgUnit, MiraiReply};
use futures::{StreamExt, SinkExt};
use crate::{text, img};let stream = MiraiStream::connect(
"127.0.0.1:8001",
MiraiStreamConfig {
verify_key:"no-key",
qq: "123456789"
}
).await.unwrap();
let (mut tx, mut rx) = stream.split();let msg_chain = vec![
text!("hello {}", "world"),
img!(url:"https://some.web/img.jpg")
];tx.send(
MiraiReply::new_friend_reply(msg_chain, 987654321).pack()
).await.unwrap();let resp = rx.next().await;
println!("get response {:?}", resp);
```