🚀 fixed some errors, optimised spotify playlists

This commit is contained in:
2023-11-10 15:49:30 +00:00
parent a40679ee11
commit 5206de1840
4 changed files with 102 additions and 41 deletions

View File

@@ -92,7 +92,7 @@ class music(commands.Cog):
async with ctx.typing():
#TODO potentially save requests before getting stream link
# Grab video details such as title thumbnail duration
audio = translate.main(url, self.sp)
audio = await translate.main(url, self.sp)
await msg.delete()
@@ -103,8 +103,16 @@ class music(commands.Cog):
#TODO make sure user isn't queuing in dm for some stupid reason
for song in audio:
song['position'] = await queue.add_song(
# Setup first song's position
audio[0]['position'] = await queue.add_song(
server,
audio[0],
ctx.author.display_name)
# Add any other songs
for song in audio[1:]:
await queue.add_song(
server,
song,
ctx.author.display_name)
@@ -164,7 +172,7 @@ class music(commands.Cog):
# Skip specificed number of songs
for _ in range(n-1):
await queue.pop(server.id)
await queue.pop(server.id, True)
# Safe to ignore error for now
ctx.voice_client.stop()