Fixing error in getting song original url in queue handler

This commit is contained in:
Rafael Vargas 2022-09-16 22:01:45 -03:00
parent d10264b97c
commit ef66bf8bcb

View File

@ -75,7 +75,20 @@ class QueueHandler(AbstractHandler):
startIndex = (pageNumber * self.config.MAX_SONGS_IN_PAGE) + 1 startIndex = (pageNumber * self.config.MAX_SONGS_IN_PAGE) + 1
for pos, song in enumerate(songs, start=startIndex): for pos, song in enumerate(songs, start=startIndex):
song_name = song.title[:50] if song.title else self.messages.SONG_DOWNLOADING song_name = song.title[:50] if song.title else self.messages.SONG_DOWNLOADING
text += f"**`{pos}` - ** [{song_name}]({song.identifier}) - `{Utils.format_time(song.duration)}`\n"
songURL = ''
hasURL = False
if 'original_url' in song.info.keys():
hasURL = True
songURL = song.info['original_url']
elif 'webpage_url' in song.info.keys():
hasURL = True
songURL = song.info['webpage_url']
if hasURL:
text += f"**`{pos}` - ** [{song_name}]({songURL}) - `{Utils.format_time(song.duration)}`\n"
else:
text += f"**`{pos}` - ** {song_name} - `{Utils.format_time(song.duration)}`\n"
embed = self.embeds.QUEUE(title, text) embed = self.embeds.QUEUE(title, text)
# Release the acquired Lock # Release the acquired Lock