aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsalmonik <raisersoft@proton.me>2026-07-08 14:24:55 +0200
committersalmonik <raisersoft@proton.me>2026-07-08 14:24:55 +0200
commita18c5469b0bdf430060309359b58e2f63abdc593 (patch)
tree8d591e54e1eb85f790a0889bd8ededbc4c32204c
parentrename the project to what it should be named (diff)
downloadsenator-sperma-a18c5469b0bdf430060309359b58e2f63abdc593.tar.gz
senator-sperma-a18c5469b0bdf430060309359b58e2f63abdc593.zip
remember links during audio file completion
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to '')
-rw-r--r--Cargo.lock2
-rw-r--r--Cargo.toml2
-rw-r--r--src/commands/autocomplete.rs10
3 files changed, 8 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 9532efb..0d39213 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4391,7 +4391,7 @@ dependencies = [
4391 4391
4392[[package]] 4392[[package]]
4393name = "senator-sperma" 4393name = "senator-sperma"
4394version = "0.2.1" 4394version = "0.2.2"
4395dependencies = [ 4395dependencies = [
4396 "chrono", 4396 "chrono",
4397 "cron", 4397 "cron",
diff --git a/Cargo.toml b/Cargo.toml
index 3a56fe2..31b0ea1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
1[package] 1[package]
2name = "senator-sperma" 2name = "senator-sperma"
3version = "0.2.1" 3version = "0.2.2"
4edition = "2024" 4edition = "2024"
5 5
6[profile.dev] 6[profile.dev]
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;