runbot 0.0.3

QQ client framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use serde_derive::{Serialize, Deserialize};
use crate::prelude::BotContext;
use crate::error::Result;
use tokio::time::Duration;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CanSendImage {
    pub yes: bool,
}

impl BotContext {
    pub async fn can_send_image(&self) -> Result<CanSendImage> {
        let response = self.websocket_send("can_send_image", serde_json::Value::Null).await?;
        let response = response.data(Duration::from_secs(10)).await?;
        let can_send_image: CanSendImage = serde_json::from_value(response)?;
        Ok(can_send_image)
    }
}