Skip to content

Commit 32f1e63

Browse files
authored
fix: Missing whitespace in /relax profile with linked profiles (#1004)
* fix: missing whitespace * fix: Adjust error messages on missing players * fix: Combine API result handling to avoid beatmap fetches
1 parent bfbdda7 commit 32f1e63

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

bathbot/src/commands/osu/relax/profile.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ pub(super) async fn relax_profile(orig: CommandOrigin<'_>, args: RelaxProfile<'_
106106
Ok(Some(info_res)) => info_res,
107107
Ok(None) => {
108108
return orig
109-
.error(format!("Relax user `{}` not found", user.username))
109+
.error(format!("Relax player `{}` not found", user.username))
110110
.await;
111111
}
112112
Err(err) => {
@@ -166,7 +166,7 @@ pub fn relax_profile_builder(args: RelaxProfileArgs) -> Result<EmbedBuilder> {
166166
let stats = &args.info;
167167
let mut description = "__**Relax user statistics".to_string();
168168
if let Some(discord_id) = args.discord_id {
169-
let _ = write!(description, "for <@{discord_id}>");
169+
let _ = write!(description, " for <@{discord_id}>");
170170
};
171171

172172
description.push_str(":**__");

bathbot/src/commands/osu/relax/top.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{cmp::Ordering, collections::HashMap};
22

33
use bathbot_util::constants::GENERAL_ISSUE;
4-
use eyre::Result;
4+
use eyre::{Report, Result};
55
use rosu_v2::{error::OsuError, model::GameMode, request::UserId};
66

77
use super::RelaxTop;
@@ -52,7 +52,7 @@ pub async fn top(orig: CommandOrigin<'_>, args: RelaxTop<'_>) -> Result<()> {
5252
}
5353
Err(err) => {
5454
let _ = orig.error(GENERAL_ISSUE).await;
55-
let err = eyre::Report::new(err).wrap_err("Failed to get user");
55+
let err = Report::new(err).wrap_err("Failed to get user");
5656

5757
return Err(err);
5858
}
@@ -66,7 +66,12 @@ pub async fn top(orig: CommandOrigin<'_>, args: RelaxTop<'_>) -> Result<()> {
6666
let relax_api_result = tokio::try_join!(scores_fut, player_fut);
6767

6868
let (mut scores, player) = match relax_api_result {
69-
Ok(v) => v,
69+
Ok((scores, Some(player))) => (scores, player),
70+
Ok((_, None)) => {
71+
return orig
72+
.error(format!("Relax user `{}` not found", user.username))
73+
.await;
74+
}
7075
Err(e) => {
7176
let _ = orig.error("Failed to get a relax player").await;
7277

@@ -91,10 +96,6 @@ pub async fn top(orig: CommandOrigin<'_>, args: RelaxTop<'_>) -> Result<()> {
9196
}
9297
};
9398

94-
let Some(player) = player else {
95-
return orig.error("Relax player not found").await;
96-
};
97-
9899
match args.sort.unwrap_or_default() {
99100
RelaxTopOrder::Acc => scores.sort_unstable_by(|lhs, rhs| {
100101
rhs.accuracy

0 commit comments

Comments
 (0)