mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-04-19 16:58:55 +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",
|
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> {
|
fn extract_row(&self, mode: Mode, ou: &OsuUser) -> Cow<'static, str> {
|
||||||
match self {
|
match self {
|
||||||
RankQuery::PP => ou
|
RankQuery::PP => ou
|
||||||
|
@ -110,6 +118,7 @@ pub async fn server_rank(ctx: &Context, m: &Message, mut args: Args) -> CommandR
|
||||||
.all()
|
.all()
|
||||||
.await?
|
.await?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
|
.filter(|v| query.pass_pp_limit(mode, v))
|
||||||
.map(|v| (v.user_id, v))
|
.map(|v| (v.user_id, v))
|
||||||
.collect::<HashMap<_, _>>();
|
.collect::<HashMap<_, _>>();
|
||||||
let mut users = env
|
let mut users = env
|
||||||
|
|
Loading…
Add table
Reference in a new issue