Simplified enqueue_track to parse track type (playlist or single track)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user