mirror of
https://github.com/natsukagami/youmubot.git
synced 2025-05-24 01:00:49 +00:00
osu: Allow returning a full file instead when requesting a table check/leaderboard
This commit is contained in:
parent
ed15406f51
commit
a36fa87964
4 changed files with 215 additions and 146 deletions
|
@ -6,7 +6,7 @@ use display::display_beatmapset;
|
|||
use embeds::ScoreEmbedBuilder;
|
||||
use link_parser::EmbedType;
|
||||
use poise::{ChoiceParameter, CreateReply};
|
||||
use serenity::all::User;
|
||||
use serenity::all::{CreateAttachment, User};
|
||||
use server_rank::get_leaderboard_from_embed;
|
||||
|
||||
/// osu!-related command group.
|
||||
|
@ -581,6 +581,7 @@ async fn leaderboard<U: HasOsuEnv>(
|
|||
"Here are the top scores of **{}** on {}",
|
||||
guild.name, scoreboard_msg,
|
||||
);
|
||||
let has_lazer_score = scores.iter().any(|v| v.score.mods.is_lazer);
|
||||
|
||||
match style {
|
||||
ScoreListStyle::Table => {
|
||||
|
@ -589,11 +590,30 @@ async fn leaderboard<U: HasOsuEnv>(
|
|||
ctx.serenity_context(),
|
||||
reply,
|
||||
scores,
|
||||
has_lazer_score,
|
||||
show_diff,
|
||||
sort.unwrap_or_default(),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
ScoreListStyle::File => {
|
||||
ctx.send(
|
||||
CreateReply::default()
|
||||
.content(header)
|
||||
.attachment(CreateAttachment::bytes(
|
||||
server_rank::rankings_to_table(
|
||||
&scores,
|
||||
0,
|
||||
scores.len(),
|
||||
has_lazer_score,
|
||||
show_diff,
|
||||
order,
|
||||
),
|
||||
"rankings.txt",
|
||||
)),
|
||||
)
|
||||
.await?;
|
||||
}
|
||||
ScoreListStyle::Grid => {
|
||||
let reply = ctx.reply(header).await?;
|
||||
style
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue