[Audio] Don't allow duplicate links in playlists (#2071)

* Just a test

* another test

* undoing my test

* First solution, style issue

* Works functionally, but there are is a minor style issue

* style fixed

* Revert README changes
This commit is contained in:
Richard Guan 2018-09-06 02:25:27 -04:00 committed by Toby Harradine
parent 9ee860c3f0
commit a2fe1a8757

View File

@ -713,6 +713,11 @@ class Audio:
if not to_append: if not to_append:
return return
track_list = playlists[playlist_name]["tracks"] track_list = playlists[playlist_name]["tracks"]
if track_list and len(to_append) == 1 and to_append[0] in track_list:
return await self._embed_msg(
ctx,
"{} already in {}.".format(to_append[0]["info"]["title"], playlist_name),
)
if track_list: if track_list:
playlists[playlist_name]["tracks"] = track_list + to_append playlists[playlist_name]["tracks"] = track_list + to_append
else: else: