diff options
Diffstat (limited to 'src/commands')
| -rw-r--r-- | src/commands/autocomplete.rs | 10 |
1 files changed, 6 insertions, 4 deletions
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>( | |||
| 49 | let Some(label) = filename_label(&rp) else { | 49 | let Some(label) = filename_label(&rp) else { |
| 50 | continue; | 50 | continue; |
| 51 | }; | 51 | }; |
| 52 | ctx.data() | 52 | // Stash under the choice VALUE (`rp`), not the display label: |
| 53 | .ac_stash(ctx.author().id, label.clone(), hit) | 53 | // the command receives `rp` as its argument and looks the hit |
| 54 | .await; | 54 | // up by that same key, so the cached link is reused instead of |
| 55 | eprintln!("[DEBUG] -> cached as {label:?}"); | 55 | // triggering a fresh copyparty search. |
| 56 | ctx.data().ac_stash(ctx.author().id, rp.clone(), hit).await; | ||
| 57 | eprintln!("[DEBUG] -> cached as {rp:?}"); | ||
| 56 | choices.push(serenity::AutocompleteChoice::new(label.clone(), rp)); | 58 | choices.push(serenity::AutocompleteChoice::new(label.clone(), rp)); |
| 57 | if choices.len() >= 25 { | 59 | if choices.len() >= 25 { |
| 58 | break; | 60 | break; |
