use reqwest::Client;
use serde_json::Value;
use std::error::Error;
#[allow(dead_code)]
pub async fn check_permission(client: &Client, token: &str, guild_id: &str, user_id: &str, permission: &str) -> Result<bool, Box<dyn Error>> {
let url = format!("https://discord.com/api/v9/guilds/{}/members/{}", guild_id, user_id);
let response: Value = client.get(&url)
.bearer_auth(token)
.send()
.await?
.json()
.await?;
if let Some(permissions) = response["permissions"].as_str() {
Ok(permissions.contains(permission))
} else {
Ok(false)
}
}