Skip to content

Commit 074da1b

Browse files
authored
feat: add graph top order by day (MaxOhn#1034)
1 parent 8d81d3c commit 074da1b

3 files changed

Lines changed: 397 additions & 75 deletions

File tree

bathbot/src/commands/osu/graphs/mod.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use self::{
3939
sniped::sniped_graph,
4040
top_date::top_graph_date,
4141
top_index::top_graph_index,
42-
top_time::top_graph_time,
42+
top_time::{top_graph_time_day, top_graph_time_hour},
4343
};
4444
use super::{SnipeGameMode, require_link, user_not_found};
4545
use crate::{
@@ -262,8 +262,10 @@ pub enum GraphTopOrder {
262262
Date,
263263
#[option(name = "Index", value = "index")]
264264
Index,
265-
#[option(name = "Time", value = "time")]
266-
Time,
265+
#[option(name = "Time by hour", value = "time_h")]
266+
TimeByHour,
267+
#[option(name = "Time by day", value = "time_d")]
268+
TimeByDay,
267269
}
268270

269271
async fn slash_graph(mut command: InteractionCommand) -> Result<()> {
@@ -719,7 +721,7 @@ async fn top_graph(
719721
let mode = user.mode;
720722

721723
let caption = format!(
722-
"{username}'{genitive} top {mode}scores",
724+
"{username}'{genitive} {mode}top200",
723725
genitive = if username.ends_with('s') { "" } else { "s" },
724726
mode = match mode {
725727
GameMode::Osu => "",
@@ -738,9 +740,12 @@ async fn top_graph(
738740
GraphTopOrder::Index => top_graph_index(caption, &scores)
739741
.await
740742
.wrap_err("Failed to create top index graph"),
741-
GraphTopOrder::Time => top_graph_time(caption, &mut scores, tz)
743+
GraphTopOrder::TimeByHour => top_graph_time_hour(caption, &mut scores, tz)
742744
.await
743-
.wrap_err("Failed to create top time graph"),
745+
.wrap_err("Failed to create top time hour graph"),
746+
GraphTopOrder::TimeByDay => top_graph_time_day(caption, &mut scores, tz)
747+
.await
748+
.wrap_err("Failed to create top time day graph"),
744749
};
745750

746751
let bytes = match graph_result {

0 commit comments

Comments
 (0)