mirai-ws

Crates.iomirai-ws
lib.rsmirai-ws
version0.0.2
created_at2021-09-10 18:15:24.545211+00
updated_at2021-09-12 04:52:41.923845+00
descriptionmirai-http-api rust interface, based on tungstenite.
homepage
repositoryhttps://github.com/4t145/mirai-ws
max_upload_size
id449396
size21,479
(4t145)

documentation

README

使用

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);
Commit count: 0

cargo fmt