Skip to content

Commit

Permalink
Perform ytsearch: by default
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffo99 committed Aug 7, 2023
1 parent b4d9d3c commit ff11343
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
36 changes: 36 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ async fn play(ctx: &Context, guild: &GuildId, member: &Member, opts: OptionsHash
let audio =
// play ytdl
if option_optional_string(&opts, "ytdl").is_some() {
songbird::ytdl(what).await.map_err(AngyError::Ffmpeg)?
if what.starts_with("http://") || what.starts_with("https://") {
songbird::ytdl(what).await.map_err(AngyError::Ffmpeg)?
}
else {
let what = format!("ytsearch:{what}");
songbird::ytdl(what).await.map_err(AngyError::Ffmpeg)?
}
}
// play file
else if option_optional_string(&opts, "file").is_some() {
Expand Down

0 comments on commit ff11343

Please sign in to comment.