diff options
| author | salmonik <salmonik@tuta.io> | 2026-10-27 18:39:17 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-10-27 18:39:17 +0100 |
| commit | b8b09face27f18fd1242e55dbeabbecc3591aabe (patch) | |
| tree | 4fcf889a3bab6d479566601942865fb5ca09579d | |
| parent | docker: build and run on Debian trixie (diff) | |
| download | senator-sperma-b8b09face27f18fd1242e55dbeabbecc3591aabe.tar.gz senator-sperma-b8b09face27f18fd1242e55dbeabbecc3591aabe.zip | |
contextual play should add to the last in the queue
Signed-off-by: salmonik <salmonik@tuta.io>
| -rw-r--r-- | src/commands/music.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/commands/music.rs b/src/commands/music.rs index 26e655e..ecc75c8 100644 --- a/src/commands/music.rs +++ b/src/commands/music.rs | |||
| @@ -15,10 +15,7 @@ type Context<'a> = poise::Context<'a, Data, Error>; | |||
| 15 | // ── Source classification ────────────────────────────────────────── | 15 | // ── Source classification ────────────────────────────────────────── |
| 16 | 16 | ||
| 17 | /// Music playback and queue management. | 17 | /// Music playback and queue management. |
| 18 | #[poise::command( | 18 | #[poise::command(slash_command, subcommands("grajcuj", "skip", "queue", "stop", "join"))] |
| 19 | slash_command, | ||
| 20 | subcommands("grajcuj", "skip", "queue", "stop", "join") | ||
| 21 | )] | ||
| 22 | pub async fn music(_ctx: Context<'_>) -> Result<()> { | 19 | pub async fn music(_ctx: Context<'_>) -> Result<()> { |
| 23 | Ok(()) | 20 | Ok(()) |
| 24 | } | 21 | } |
| @@ -32,8 +29,9 @@ pub async fn grajcuj( | |||
| 32 | melodia: Option<String>, | 29 | melodia: Option<String>, |
| 33 | #[description = "Bezpośredni plik z twojego systemu"] file: Option<serenity::Attachment>, | 30 | #[description = "Bezpośredni plik z twojego systemu"] file: Option<serenity::Attachment>, |
| 34 | #[description = "Chujowa kompresja!?"] compressed: Option<bool>, | 31 | #[description = "Chujowa kompresja!?"] compressed: Option<bool>, |
| 35 | #[description = "Gdzie dodać utwór w kolejce (domyślnie: last)"] | 32 | #[description = "Gdzie dodać utwór w kolejce (domyślnie: last)"] position: Option< |
| 36 | position: Option<QueuePosition>, | 33 | QueuePosition, |
| 34 | >, | ||
| 37 | ) -> Result<()> { | 35 | ) -> Result<()> { |
| 38 | play_command(ctx, melodia, file, compressed, position).await | 36 | play_command(ctx, melodia, file, compressed, position).await |
| 39 | } | 37 | } |
| @@ -379,11 +377,11 @@ pub async fn message_grajcuj(ctx: Context<'_>, message: serenity::Message) -> Re | |||
| 379 | .iter() | 377 | .iter() |
| 380 | .find(|a| matches!(file_type(&a.filename), FileType::Audio | FileType::Video)) | 378 | .find(|a| matches!(file_type(&a.filename), FileType::Audio | FileType::Video)) |
| 381 | { | 379 | { |
| 382 | return play_impl(ctx, None, Some(att.clone()), false, QueuePosition::Now).await; | 380 | return play_impl(ctx, None, Some(att.clone()), false, QueuePosition::Last).await; |
| 383 | } | 381 | } |
| 384 | // Fallback: first URL in message content. | 382 | // Fallback: first URL in message content. |
| 385 | if let Some(url) = extract_urls(&message.content).into_iter().next() { | 383 | if let Some(url) = extract_urls(&message.content).into_iter().next() { |
| 386 | return play_impl(ctx, Some(url), None, false, QueuePosition::Now).await; | 384 | return play_impl(ctx, Some(url), None, false, QueuePosition::Last).await; |
| 387 | } | 385 | } |
| 388 | ctx.say(lang::L_MUSIC_NO_AUDIO_ATTACHMENTS).await?; | 386 | ctx.say(lang::L_MUSIC_NO_AUDIO_ATTACHMENTS).await?; |
| 389 | Ok(()) | 387 | Ok(()) |
