diff --git a/youmubot-osu/src/discord/mod.rs b/youmubot-osu/src/discord/mod.rs index be4ffc0..b40aaae 100644 --- a/youmubot-osu/src/discord/mod.rs +++ b/youmubot-osu/src/discord/mod.rs @@ -197,6 +197,7 @@ pub async fn mania(ctx: &Context, msg: &Message, args: Args) -> CommandResult { get_user(ctx, &env, msg, args, Mode::Mania).await } +#[derive(Debug, Clone)] pub(crate) struct BeatmapWithMode(pub Beatmap, pub Mode); impl BeatmapWithMode { diff --git a/youmubot-osu/src/lib.rs b/youmubot-osu/src/lib.rs index 5c15bf3..0879842 100644 --- a/youmubot-osu/src/lib.rs +++ b/youmubot-osu/src/lib.rs @@ -73,12 +73,13 @@ impl Client { /// Fetch the user header. pub async fn user_header(&self, id: u64) -> Result, Error> { - Ok( - match self.user_header_cache.lock().await.get(&id).cloned() { + Ok({ + let v = self.user_header_cache.lock().await.get(&id).cloned(); + match v { Some(v) => v, None => self.user(UserID::ID(id), |f| f).await?.map(|v| v.into()), - }, - ) + } + }) } pub async fn scores(