Check if there was a failure when adding a new song
This commit is contained in:
parent
534dd29f4f
commit
a65ffeb221
|
@ -90,6 +90,7 @@ class Playlist:
|
||||||
'playlists': playlists
|
'playlists': playlists
|
||||||
}
|
}
|
||||||
self.bot.db.save('user_playlists', update)
|
self.bot.db.save('user_playlists', update)
|
||||||
|
await self.update_dj_for_member(author)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def rename_playlist(self, author, old_name, new_name):
|
async def rename_playlist(self, author, old_name, new_name):
|
||||||
|
@ -109,6 +110,7 @@ class Playlist:
|
||||||
'playlists': playlists
|
'playlists': playlists
|
||||||
}
|
}
|
||||||
self.bot.db.save('user_playlists', update)
|
self.bot.db.save('user_playlists', update)
|
||||||
|
await self.update_dj_for_member(author)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def remove_from_playlist(self, author, playlist, index):
|
async def remove_from_playlist(self, author, playlist, index):
|
||||||
|
@ -128,6 +130,7 @@ class Playlist:
|
||||||
'playlists': playlists
|
'playlists': playlists
|
||||||
}
|
}
|
||||||
self.bot.db.save('user_playlists', update)
|
self.bot.db.save('user_playlists', update)
|
||||||
|
await self.update_dj_for_member(author)
|
||||||
return song
|
return song
|
||||||
|
|
||||||
async def update_dj_for_member(self, member):
|
async def update_dj_for_member(self, member):
|
||||||
|
@ -278,9 +281,11 @@ class Playlist:
|
||||||
# The "error" message is sent with our `get_response` helper method
|
# The "error" message is sent with our `get_response` helper method
|
||||||
if response:
|
if response:
|
||||||
await ctx.message.channel.trigger_typing()
|
await ctx.message.channel.trigger_typing()
|
||||||
await self.add_to_playlist(ctx.message.author, playlist, response)
|
if await self.add_to_playlist(ctx.message.author, playlist, response):
|
||||||
delete_msgs.append(await ctx.send("Successfully added song {} to playlist {}".format(response,
|
delete_msgs.append(await ctx.send("Successfully added song {} to playlist {}".format(response,
|
||||||
playlist)))
|
playlist)))
|
||||||
|
else:
|
||||||
|
delete_msgs.append(await ctx.send("Failed to lookup {}".format(response)))
|
||||||
elif 'remove' in response:
|
elif 'remove' in response:
|
||||||
await ctx.invoke(self.playlist, playlist_name=playlist)
|
await ctx.invoke(self.playlist, playlist_name=playlist)
|
||||||
question = "Please provide just the number of the song you want to delete"
|
question = "Please provide just the number of the song you want to delete"
|
||||||
|
@ -327,9 +332,6 @@ class Playlist:
|
||||||
else:
|
else:
|
||||||
delete_msgs.append(await ctx.send("That is not a valid option!"))
|
delete_msgs.append(await ctx.send("That is not a valid option!"))
|
||||||
|
|
||||||
# After whatever has been edited, we need to update the live DJ's
|
|
||||||
await self.update_dj_for_member(ctx.message.author)
|
|
||||||
|
|
||||||
if len(delete_msgs) == 1:
|
if len(delete_msgs) == 1:
|
||||||
await delete_msgs[0].delete()
|
await delete_msgs[0].delete()
|
||||||
elif len(delete_msgs) > 1:
|
elif len(delete_msgs) > 1:
|
||||||
|
|
Loading…
Reference in a new issue