From 850fad62f12b4e764f5e64036db35259237994cb Mon Sep 17 00:00:00 2001 From: salmonik Date: Wed, 19 Aug 2026 02:45:49 +0200 Subject: fix: Various cron fixes Not saving full URL Not using autocompletion content, just label --- src/commands/cron.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/commands/cron.rs') diff --git a/src/commands/cron.rs b/src/commands/cron.rs index 48f6ff1..a645581 100644 --- a/src/commands/cron.rs +++ b/src/commands/cron.rs @@ -32,12 +32,22 @@ pub async fn dodaj_audio( _ => return Err(lang::err_bad_channel_type()), }; + // Resolve full path from autocomplete cache (value is truncated to 99 chars by Discord) + let full_url = if let Some(hit) = ctx.data().ac_lookup(ctx.author().id, &audio_filename).await { + let path = hit.url_path().unwrap_or(&audio_filename); + ctx.data().copyparty.build_url_no_pw(path) + } else if audio_filename.starts_with("http://") || audio_filename.starts_with("https://") { + audio_filename.clone() + } else { + ctx.data().copyparty.build_url_no_pw(&audio_filename) + }; + database::add_cron_job( &ctx.data().db_pool, &cron_expression, "audio", channel_id, - Some(&audio_filename), + Some(&full_url), None, ) .await?; -- cgit v1.2.3