From fc5e0f48477366641b97efb0541053cc1e061be5 Mon Sep 17 00:00:00 2001 From: salmonik Date: Tue, 27 Oct 2026 18:14:07 +0100 Subject: music: add per-guild queue with now/next/last, skip and queue Tracks are queued in memory per guild, defaulting to append (last). Playback auto-advances on TrackEvent::End/Error with a per-track token so manual stops and skips cannot double-advance. /music queue shows the current track followed by pending items. /stop clears the queue. Cron audio now goes through the same MusicState instead of poking the track-handle map directly. --- src/lang.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/lang.rs') diff --git a/src/lang.rs b/src/lang.rs index 4bba9b5..de6d23f 100644 --- a/src/lang.rs +++ b/src/lang.rs @@ -91,8 +91,6 @@ pub fn fmt_math_result(r: &str) -> String { pub const L_MUSIC_NEED_NAME: &str = "Daj mi nazwę pliku, URL albo plik"; pub const L_MUSIC_NO_AUDIO_ON_CP: &str = "Brak powiązanego audio na copyparty"; pub const L_MUSIC_NO_URL_IN_RESULT: &str = "Wynik nie ma URL"; -pub const L_MUSIC_CANT_COMPRESS_LIVE: &str = - "Nie można skompresować transmisji na żywo, odtwarzam normalnie"; pub const L_MUSIC_STOPPED: &str = "wyszed"; pub const L_MUSIC_NO_AUDIO_ATTACHMENTS: &str = "Brak plików audio w wiadomości"; pub const L_VOICE_USER_NOT_IN_VC: &str = "You are not in a voice channel"; @@ -122,6 +120,21 @@ pub fn fmt_music_search_failed(e: &dyn std::fmt::Display) -> String { pub fn fmt_music_playing(name: &str) -> String { format!("Grajcowanie: `{name}`") } +pub const L_MUSIC_QUEUE_EMPTY: &str = "Kolejka jest pusta"; +pub const L_MUSIC_QUEUE_HEADER: &str = "**Kolejka:**"; +pub const L_MUSIC_SKIPPED: &str = "Pominięto"; +pub fn fmt_music_queued(name: &str, position: usize) -> String { + format!("W kolejce (#{position}): `{name}`") +} +pub fn fmt_music_track_failed(name: &str, e: &dyn std::fmt::Display) -> String { + format!("Nie udało się odtworzyć `{name}`: `{e}`") +} +pub fn fmt_music_queue_current(name: &str, who: &str) -> String { + format!("▶ `{name}`{who}") +} +pub fn fmt_music_queue_item(index: usize, name: &str, who: &str) -> String { + format!("{index}. `{name}`{who}") +} pub fn fmt_voice_joined(cid: &dyn std::fmt::Display) -> String { format!("Dołączon <#{cid}>") } -- cgit v1.2.3