From a2fe1a8757cdb3a05aa68992139c2a8addff8f7b Mon Sep 17 00:00:00 2001 From: Richard Guan <41275416+rguan72@users.noreply.github.com> Date: Thu, 6 Sep 2018 02:25:27 -0400 Subject: [PATCH] [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 --- redbot/cogs/audio/audio.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/redbot/cogs/audio/audio.py b/redbot/cogs/audio/audio.py index a36cbcb5c..7fa736367 100644 --- a/redbot/cogs/audio/audio.py +++ b/redbot/cogs/audio/audio.py @@ -713,6 +713,11 @@ class Audio: if not to_append: return 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: playlists[playlist_name]["tracks"] = track_list + to_append else: