From d4ab83f20956fba09133571e14a9a64244b33d64 Mon Sep 17 00:00:00 2001 From: salmonik Date: Mon, 2 Nov 2026 15:23:51 +0100 Subject: cron: keep scheduled audio silent Add a per-track silent flag. Cron already uses play_now (interrupt the current track), but play_next_locked still announced the track to the last known text channel; suppress playing and failure announcements for silent tracks, including when a cron track fails to prepare. --- src/music.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/music.rs') diff --git a/src/music.rs b/src/music.rs index 8dfc4f8..1461f6a 100644 --- a/src/music.rs +++ b/src/music.rs @@ -47,6 +47,9 @@ pub struct TrackRequest { /// re-upload the file alongside the "playing" message. pub reupload: Option<(String, String)>, pub requester: Option, + /// Suppress the "playing" and failure announcements for this track. + /// Cron audio uses this so scheduled playback stays silent. + pub silent: bool, } /// Where an enqueued track goes relative to the current playback. @@ -331,8 +334,10 @@ impl MusicState { Ok(input) => input, Err(e) => { warn!(track = %request.display_name, error = %e, "failed to prepare queued track"); - let message = lang::fmt_music_track_failed(&request.display_name, &e); - self.announce_failure(guild, message).await; + if !request.silent { + let message = lang::fmt_music_track_failed(&request.display_name, &e); + self.announce_failure(guild, message).await; + } last_error = Some(e); continue; } @@ -388,7 +393,9 @@ impl MusicState { }, ); - self.announce_playing(announce, &request).await; + if !request.silent { + self.announce_playing(announce, &request).await; + } return Ok(true); } } -- cgit v1.2.3