aboutsummaryrefslogtreecommitdiffstats
path: root/src/commands/music.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/commands/music.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/commands/music.rs b/src/commands/music.rs
index e528bf5..8739a5b 100644
--- a/src/commands/music.rs
+++ b/src/commands/music.rs
@@ -174,7 +174,8 @@ async fn resolve_source(
174 .search( 174 .search(
175 &name, 175 &name,
176 5, 176 5,
177 &["mp3", "wav", "ogg", "flac", "m4a", "opus", "mp4"], 177 &["mp3", "wav", "ogg", "flac", "m4a", "opus", "aac", "wma", "oga",
178 "mp4", "webm", "mkv", "avi", "mov", "flv", "wmv", "m4v", "mpg", "mpeg", "3gp", "ts"],
178 ) 179 )
179 .await 180 .await
180 .map_err(|e| { 181 .map_err(|e| {
@@ -461,15 +462,13 @@ async fn send_music_msg(
461 Ok(()) 462 Ok(())
462} 463}
463 464
464/// Right-click a message → play the first audio file, or first URL if no audio files. 465/// Right-click a message → play the first audio/video file, or first URL.
465#[poise::command(context_menu_command = "Odtwórz")] 466#[poise::command(context_menu_command = "Odtwórz")]
466pub async fn message_grajcuj(ctx: Context<'_>, message: serenity::Message) -> Result<()> { 467pub async fn message_grajcuj(ctx: Context<'_>, message: serenity::Message) -> Result<()> {
467 // Files > links: prefer audio attachments first. 468 // Files > links: prefer audio/video attachments first.
468 if let Some(att) = message 469 if let Some(att) = message.attachments.iter().find(|a| {
469 .attachments 470 matches!(file_type(&a.filename), FileType::Audio | FileType::Video)
470 .iter() 471 }) {
471 .find(|a| file_type(&a.filename) == FileType::Audio)
472 {
473 return play_impl(ctx, None, Some(att.clone()), false).await; 472 return play_impl(ctx, None, Some(att.clone()), false).await;
474 } 473 }
475 // Fallback: first URL in message content. 474 // Fallback: first URL in message content.