mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 00:08:54 +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
|
}) && 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.
|
/// Handles an user/mode scan, announces all possible new scores, return the new pp value.
|
||||||
async fn fetch_user_data(
|
async fn fetch_user_data(
|
||||||
&self,
|
&self,
|
||||||
|
@ -211,7 +219,7 @@ impl Announcer {
|
||||||
let events = std::mem::take(&mut user.events)
|
let events = std::mem::take(&mut user.events)
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|v| v.to_event_rank())
|
.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))
|
.filter(|s| Self::is_announceable_date(s.date, last_update, now))
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
Ok((user, top_scores, events))
|
Ok((user, top_scores, events))
|
||||||
|
|
Loading…
Add table
Reference in a new issue