Update schemas and resolve some warnings
This commit is contained in:
@@ -16,17 +16,15 @@ pub async fn get_guild_roles(id: u64, cookies: &CookieJar<'_>, ctx: &State<Conte
|
||||
offline!(Ok(json!(vec![RoleInfo { name: "@everyone".to_string(), id: "1".to_string() }])));
|
||||
check_authorization(cookies, ctx.inner(), id).await?;
|
||||
|
||||
let roles_res = ctx.cache.guild_roles(id);
|
||||
let roles_res = ctx.cache.guild(id).map(|g| {
|
||||
g.roles
|
||||
.iter()
|
||||
.map(|(_, r)| RoleInfo { id: r.id.to_string(), name: r.name.to_string() })
|
||||
.collect::<Vec<RoleInfo>>()
|
||||
});
|
||||
|
||||
match roles_res {
|
||||
Some(roles) => {
|
||||
let roles = roles
|
||||
.iter()
|
||||
.map(|(_, r)| RoleInfo { id: r.id.to_string(), name: r.name.to_string() })
|
||||
.collect::<Vec<RoleInfo>>();
|
||||
|
||||
Ok(json!(roles))
|
||||
}
|
||||
Some(roles) => Ok(json!(roles)),
|
||||
None => {
|
||||
warn!("Could not fetch roles from {}", id);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user