Simplified enqueue_track to parse track type (playlist or single track)

This commit is contained in:
2024-12-18 19:05:13 -05:00
parent c82fee0dd3
commit aa7bad945a
5 changed files with 144 additions and 116 deletions

View File

@@ -56,14 +56,8 @@ pub async fn leave_voice_channel(manager: &Arc<Songbird>, guild_id: &GuildId) ->
* 1st tuple value is if the URL is valid.
* 2nd tuple value is if the URL is a playlist.
*/
fn is_valid_url(url: &str) -> (bool, bool) {
Url::parse(url).ok().map_or((false, false), |valid_url| {
let is_playlist: bool = valid_url
.query_pairs()
.find(|(key, _)| key == "list")
.map_or(false, |_| true);
(true, is_playlist)
})
fn is_valid_url(url: &str) -> bool {
Url::parse(url).ok().map_or(false, |valid_url| true)
}
/**