From e246eb80e2e6dfc18e471591463ab27aed97b20e Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Tue, 25 Feb 2025 16:05:00 +0100 Subject: [PATCH] osu: limit minigame rank announcement to only top 50 --- youmubot-osu/src/discord/announcer.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/youmubot-osu/src/discord/announcer.rs b/youmubot-osu/src/discord/announcer.rs index d44a6a9..b819d1e 100644 --- a/youmubot-osu/src/discord/announcer.rs +++ b/youmubot-osu/src/discord/announcer.rs @@ -181,6 +181,14 @@ impl Announcer { }) && s <= now } + // Is an user_event worth announcing? + fn is_worth_announcing(s: &UserEventRank) -> bool { + if s.mode != Mode::Std && s.rank > 50 { + return false; + } + true + } + /// Handles an user/mode scan, announces all possible new scores, return the new pp value. async fn fetch_user_data( &self, @@ -211,7 +219,7 @@ impl Announcer { let events = std::mem::take(&mut user.events) .into_iter() .filter_map(|v| v.to_event_rank()) - .filter(|s| s.mode == mode) + .filter(|s| s.mode == mode && Self::is_worth_announcing(s)) .filter(|s| Self::is_announceable_date(s.date, last_update, now)) .collect::>(); Ok((user, top_scores, events))