From a1975d5b54cf06d5683247f595371f1b638980b9 Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Tue, 1 Feb 2022 16:31:33 -0500 Subject: [PATCH] Simplify some of the osu commands --- youmubot-osu/src/discord/mod.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/youmubot-osu/src/discord/mod.rs b/youmubot-osu/src/discord/mod.rs index 3100248..e803301 100644 --- a/youmubot-osu/src/discord/mod.rs +++ b/youmubot-osu/src/discord/mod.rs @@ -221,13 +221,14 @@ pub async fn save(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult #[description = "Save the given username as someone's username."] #[owners_only] #[usage = "[ping user]/[username or user_id]"] +#[delimiters(" ")] #[num_args(2)] pub async fn forcesave(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { let data = ctx.data.read().await; let osu = data.get::().unwrap(); let target = args.single::()?; - let user = args.single::()?; + let user = args.quoted().trimmed().single::()?; let user: Option = osu.user(UserID::Auto(user), |f| f).await?; match user { Some(u) => { @@ -318,13 +319,19 @@ impl FromStr for Nth { #[description = "Gets an user's recent play"] #[usage = "#[the nth recent play = --all] / [style (table or grid) = --table] / [mode (std, taiko, mania, catch) = std] / [username / user id = your saved id]"] #[example = "#1 / taiko / natsukagami"] +#[delimiters("/", " ")] #[max_args(4)] pub async fn recent(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { let data = ctx.data.read().await; let nth = args.single::().unwrap_or(Nth::All); let style = args.single::().unwrap_or_default(); let mode = args.single::().unwrap_or(ModeArg(Mode::Std)).0; - let user = to_user_id_query(args.single::().ok(), &*data, msg).await?; + let user = to_user_id_query( + args.quoted().trimmed().single::().ok(), + &*data, + msg, + ) + .await?; let osu = data.get::().unwrap(); let meta_cache = data.get::().unwrap(); @@ -385,6 +392,7 @@ impl FromStr for OptBeatmapset { #[command] #[description = "Show information from the last queried beatmap."] #[usage = "[--set/-s/--beatmapset] / [mods = no mod]"] +#[delimiters(" ")] #[max_args(2)] pub async fn last(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult { let data = ctx.data.read().await;