diff options
| author | salmonik <salmonik@tuta.io> | 2026-09-09 13:31:32 +0200 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-09-09 13:31:32 +0200 |
| commit | ad5e5ae08bace9c5065365e1b71fe5abff529ce4 (patch) | |
| tree | 6d2d3590d140bbcac3ef849b94922f7b7dcaf2e8 /src/commands | |
| parent | message-contextual /grajcuj (diff) | |
| download | senator-sperma-ad5e5ae08bace9c5065365e1b71fe5abff529ce4.tar.gz senator-sperma-ad5e5ae08bace9c5065365e1b71fe5abff529ce4.zip | |
/grajcuj plays video-like extensions too
Signed-off-by: salmonik <salmonik@tuta.io>
Diffstat (limited to '')
| -rw-r--r-- | src/commands/autocomplete.rs | 3 | ||||
| -rw-r--r-- | src/commands/music.rs | 15 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/commands/autocomplete.rs b/src/commands/autocomplete.rs index 434870c..a909738 100644 --- a/src/commands/autocomplete.rs +++ b/src/commands/autocomplete.rs | |||
| @@ -197,7 +197,8 @@ pub async fn audio_file( | |||
| 197 | timed_search( | 197 | timed_search( |
| 198 | ctx, | 198 | ctx, |
| 199 | partial, | 199 | partial, |
| 200 | &["mp3", "wav", "ogg", "flac", "m4a", "opus"], | 200 | &["mp3", "wav", "ogg", "flac", "m4a", "opus", "aac", "wma", "oga", |
| 201 | "mp4", "webm", "mkv", "avi", "mov", "flv", "wmv", "m4v", "mpg", "mpeg", "3gp", "ts"], | ||
| 201 | ) | 202 | ) |
| 202 | .await | 203 | .await |
| 203 | } | 204 | } |
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")] |
| 466 | pub async fn message_grajcuj(ctx: Context<'_>, message: serenity::Message) -> Result<()> { | 467 | pub 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. |
