From a18c5469b0bdf430060309359b58e2f63abdc593 Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 8 Jul 2026 14:24:55 +0200 Subject: remember links during audio file completion Signed-off-by: salmonik --- src/commands/autocomplete.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/commands') diff --git a/src/commands/autocomplete.rs b/src/commands/autocomplete.rs index 497aec9..422ab2d 100644 --- a/src/commands/autocomplete.rs +++ b/src/commands/autocomplete.rs @@ -49,10 +49,12 @@ pub async fn audio_file<'a>( let Some(label) = filename_label(&rp) else { continue; }; - ctx.data() - .ac_stash(ctx.author().id, label.clone(), hit) - .await; - eprintln!("[DEBUG] -> cached as {label:?}"); + // Stash under the choice VALUE (`rp`), not the display label: + // the command receives `rp` as its argument and looks the hit + // up by that same key, so the cached link is reused instead of + // triggering a fresh copyparty search. + ctx.data().ac_stash(ctx.author().id, rp.clone(), hit).await; + eprintln!("[DEBUG] -> cached as {rp:?}"); choices.push(serenity::AutocompleteChoice::new(label.clone(), rp)); if choices.len() >= 25 { break; -- cgit v1.2.3