Add case for missing avatars in leaderboard

late-submissions
Elnu 2 years ago
parent e3d85efe96
commit cfb2aba591

@ -379,7 +379,7 @@ pub async fn leaderboard(ctx: &Context<'_>) -> Result<(), Error> {
let profile = format!("https://discord.com/users/{id}"); let profile = format!("https://discord.com/users/{id}");
let name = &user.name; let name = &user.name;
let discriminator = user.discriminator; let discriminator = user.discriminator;
leaderboard_html.push_str(&format!("<tr><td>{place}</td><td><a href=\"{profile}\" target=\"_blank\" class=\"no-underline\"><img src=\"{avatar}\" alt=\"avatar\"> <span class=\"underline\">{name}<span class=\"muted\">#{:0>4}</span></span></a></td><td>{count}</td></tr>", discriminator)); leaderboard_html.push_str(&format!("<tr><td>{place}</td><td><a href=\"{profile}\" target=\"_blank\" class=\"no-underline\"><img src=\"{avatar}\" onerror=\"this.src='/default.png'\"> <span class=\"underline\">{name}<span class=\"muted\">#{:0>4}</span></span></a></td><td>{count}</td></tr>", discriminator));
} }
leaderboard_html.push_str("</table>"); leaderboard_html.push_str("</table>");
let mut file = std::fs::OpenOptions::new() let mut file = std::fs::OpenOptions::new()

Loading…
Cancel
Save