Verified Commit 353cdd84 authored by Mathias B.'s avatar Mathias B.
Browse files

Assurer que les rôles sont triés à leur affichage dans l'embed d'informations du bot

parent dad48e25
......@@ -166,12 +166,14 @@ pub async fn user_info(ctx: &Context, msg: &Message, args: Args) -> CommandResul
};
let mut translated_roles: String = target_user.roles.iter()
.map(|role_id| { guild.roles.get(role_id) })
.filter(Option::is_some)
.map(Option::unwrap) // Safe: None roles have been filtered out
.filter(|role| role.name != "@everyone")
.filter_map(|role_id| {
guild.roles
.get(role_id)
.filter(|role| role.name != "@everyone")
})
.sorted_by(|r1, r2| Ord::cmp(&r2.position, &r1.position))
.map(|role| role.name.clone())
.collect::<Vec<String>>()
.collect_vec()
.join(" ─ ");
if translated_roles.is_empty() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment