Skip to content

Commit

Permalink
Shuffle play fixes
Browse files Browse the repository at this point in the history
Fix that shuffleplay wasn't actually shuffling due to an early return. Follow same format as the rest of the help docs. Fix format issue for repeat command no songs errror. Add an expire in to repeat command no voice.
  • Loading branch information
BabyBoySnow committed Nov 30, 2023
1 parent 579eeb3 commit ff0cb1d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions config/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"cmd-play-eta": " - estimated time until playing: %s",
"cmd-play-eta-error": " - cannot estimate time until playing",
"cmd-play-badextractor": "You do not have permission to play media from this service.",
"cmd-shuffleplay-shuffled": "Shuffled {0}'s playlist",
"cmd-stream-limit": "You have reached your enqueued song limit ({0})",
"cmd-stream-success": "Streaming.",
"cmd-search-limit": "You have reached your playlist item limit ({0})",
Expand Down
22 changes: 16 additions & 6 deletions musicbot/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1755,14 +1755,17 @@ async def cmd_play(
async def cmd_shuffleplay(
self, message, _player, channel, author, permissions, leftover_args, song_url
):
"""Usage:
"""
Usage:
{command_prefix}shuffleplay playlist_link
Adds a playlist to be shhuffled then played. Shorthand for doing {command_prefix}play and then {command_prefix}shuffle
If nothing is playing, then the first few songs will be played in order while the rest of the playlist downloads.
"""
# TO-DO, don't play the first few songs so the entire playlist can be shuffled
# In my test run it's only 2-3 songs that get played in the order this is because of how the _cmd_play works.
return await self._cmd_play(
player = self.get_player_in(channel.guild)

await self._cmd_play(
message,
_player,
channel,
Expand All @@ -1772,7 +1775,14 @@ async def cmd_shuffleplay(
song_url,
head=False,
)

player.playlist.shuffle()
return Response(
self.str.get("cmd-shuffleplay-shuffled", "Shuffled {0}'s playlist").format(
message.guild
),
delete_after=30,
)

async def cmd_playnext(
self, message, _player, channel, author, permissions, leftover_args, song_url
Expand Down Expand Up @@ -1823,16 +1833,16 @@ async def cmd_repeat(self, channel, option=None):
"Use %ssummon to summon it to your voice channel.",
)
% self.config.command_prefix,
expire_in=30
)

if not player.current_entry:
return Response(
self.str.get(
"cmd-repeat-no-songs",
"No songs are queued. Play something with{}play.".format(
self.config.command_prefix
),
),
"No songs are queued. Play something with{}play."
).format(self.config.command_prefix),
delete_after=30,
)

if option == "all":
Expand Down

0 comments on commit ff0cb1d

Please sign in to comment.