feat: Ajout de l'id dans /info
This commit is contained in:
parent
458e239b35
commit
c8cc1dd39a
@ -17,6 +17,7 @@ use crate::api::bot::info;
|
|||||||
components(
|
components(
|
||||||
schemas(
|
schemas(
|
||||||
info::Info,
|
info::Info,
|
||||||
|
info::InfoGuild,
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
paths(
|
paths(
|
||||||
|
@ -7,12 +7,18 @@ use utoipa::ToSchema;
|
|||||||
|
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
|
|
||||||
|
#[derive(Serialize, Deserialize, ToSchema)]
|
||||||
|
pub struct InfoGuild {
|
||||||
|
pub name: String,
|
||||||
|
pub id: u64,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, ToSchema)]
|
#[derive(Serialize, Deserialize, ToSchema)]
|
||||||
pub struct Info {
|
pub struct Info {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub version: String,
|
pub version: String,
|
||||||
pub description: String,
|
pub description: String,
|
||||||
pub available_guids: Vec<String>,
|
pub available_guids: Vec<InfoGuild>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[utoipa::path(
|
#[utoipa::path(
|
||||||
@ -33,7 +39,13 @@ pub async fn get_info(config: web::Data<Config>, http: web::Data<Arc<Http>>) ->
|
|||||||
name: "BotDiscord".to_string(),
|
name: "BotDiscord".to_string(),
|
||||||
version: env!("CARGO_PKG_VERSION").to_string(),
|
version: env!("CARGO_PKG_VERSION").to_string(),
|
||||||
description: config.bot_name.clone(),
|
description: config.bot_name.clone(),
|
||||||
available_guids: guilds.iter().map(|g| g.name.clone()).collect(),
|
available_guids: guilds
|
||||||
|
.iter()
|
||||||
|
.map(|g| InfoGuild {
|
||||||
|
name: g.name.clone(),
|
||||||
|
id: g.id.get(),
|
||||||
|
})
|
||||||
|
.collect(),
|
||||||
}),
|
}),
|
||||||
Err(e) => HttpResponse::InternalServerError().body(format!("Error getting guilds: {}", e)),
|
Err(e) => HttpResponse::InternalServerError().body(format!("Error getting guilds: {}", e)),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user