mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-10 04:30:29 +00:00
osu: limit minigame rank announcement to only top 50
This commit is contained in:
parent
487f8647ba
commit
e246eb80e2
1 changed files with 9 additions and 1 deletions
|
@ -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::<Vec<_>>();
|
||||
Ok((user, top_scores, events))
|
||||
|
|
Loading…
Add table
Reference in a new issue