Skip to content

Commit

Permalink
Merge pull request #2 from WISVCH/fix/tableLength
Browse files Browse the repository at this point in the history
Correctly specify the results when less than the maximum are available
  • Loading branch information
dsluijk authored Dec 6, 2024
2 parents f510d15 + c53b9d8 commit 69b13ea
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async fn leaderboard_total(ctx: Context<'_>) -> Result<(), Error> {
.as_mut(),
);

let mut stylized_answer = table_rows[0..row_count].join("\n");
let mut stylized_answer = table_rows[0..cmp::min(row_count, table_rows.len())].join("\n");
stylized_answer = format!("```\n{}```", truncate(&*stylized_answer, 1990));

ctx.say(stylized_answer).await?;
Expand Down Expand Up @@ -151,7 +151,7 @@ async fn leaderboard_today(ctx: Context<'_>) -> Result<(), Error> {
.as_mut(),
);

let mut stylized_answer = table_rows[0..row_count].join("\n");
let mut stylized_answer = table_rows[0..cmp::min(row_count, table_rows.len())].join("\n");
stylized_answer = format!("```\n{}```", truncate(&*stylized_answer, 1990));
println!("{}", stylized_answer);
ctx.say(stylized_answer).await?;
Expand Down

0 comments on commit 69b13ea

Please sign in to comment.