mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-18 00:08:54 +00:00
Apply pp limit to server ranks
This commit is contained in:
parent
8e90006eb9
commit
8b40d8a56b
1 changed files with 9 additions and 0 deletions
|
@ -46,6 +46,14 @@ impl RankQuery {
|
|||
RankQuery::MapAge { newest_first: _ } => "Map age",
|
||||
}
|
||||
}
|
||||
fn pass_pp_limit(&self, mode: Mode, ou: &OsuUser) -> bool {
|
||||
match self {
|
||||
RankQuery::PP | RankQuery::TotalPP => true,
|
||||
RankQuery::MapAge { newest_first: _ } | RankQuery::MapLength => {
|
||||
ou.modes.get(&mode).is_some_and(|v| v.pp >= 500.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
fn extract_row(&self, mode: Mode, ou: &OsuUser) -> Cow<'static, str> {
|
||||
match self {
|
||||
RankQuery::PP => ou
|
||||
|
@ -110,6 +118,7 @@ pub async fn server_rank(ctx: &Context, m: &Message, mut args: Args) -> CommandR
|
|||
.all()
|
||||
.await?
|
||||
.into_iter()
|
||||
.filter(|v| query.pass_pp_limit(mode, v))
|
||||
.map(|v| (v.user_id, v))
|
||||
.collect::<HashMap<_, _>>();
|
||||
let mut users = env
|
||||
|
|
Loading…
Add table
Reference in a new issue