diff options
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/main.rs b/src/main.rs index 0b34f30..c46ce7d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,11 +30,12 @@ use twilight_util::builder::{ mod brain; mod database; mod import; +mod util; const PROD_APP_ID: u64 = 1363055126264283136; #[allow(dead_code)] const DEV_APP_ID: u64 = 1363494986699771984; -const APP_ID: u64 = DEV_APP_ID; +const APP_ID: u64 = PROD_APP_ID; macro_rules! bail { ($msg:expr) => { @@ -279,10 +280,23 @@ fn get_leaderboard(brain: Arc<Brain>, guild: Id<GuildMarker>) -> InteractionResp } Err(DbError::UserNotExist) => unreachable!(), Ok(data) => { - let str = data + let placed = util::tiebreak_shared_positions(data); + + let str = placed .into_iter() - .enumerate() - .map(|(idx, br)| format!("{idx}. <@{}>: {}", br.user_id, br.points)) + .map(|placement| { + if placement.placement_first_of_tie { + format!( + "`{:>2}` <@{}>: {}", + placement.placement_tie, placement.row.user_id, placement.row.points + ) + } else { + format!( + "` ` <@{}>: {}", + placement.row.user_id, placement.row.points + ) + } + }) .collect::<Vec<String>>() .join("\n"); |