runbot 0.1.20

QQ client framework
Documentation
use crate::error::Result;
use crate::prelude::BotContext;
use serde_derive::{Deserialize, Serialize};
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)
    }
}