Skip to content

Commit

Permalink
Feature/queue redesign (New Queue implementation) (#280)
Browse files Browse the repository at this point in the history
* New Queue implementation.
* Add loaded property to Queue and other review changes.
  • Loading branch information
EvieePy authored Feb 3, 2024
1 parent 654215c commit eeec649
Show file tree
Hide file tree
Showing 3 changed files with 464 additions and 150 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,7 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

.vscode/
.vscode/

# Test
test.py
11 changes: 9 additions & 2 deletions wavelink/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,13 @@ class Player(discord.VoiceProtocol):
Since the Player is a :class:`discord.VoiceProtocol`, it is attached to the various ``voice_client`` attributes
in discord.py, including ``guild.voice_client``, ``ctx.voice_client`` and ``interaction.voice_client``.
Attributes
----------
queue: :class:`~wavelink.Queue`
The queue associated with this player.
auto_queue: :class:`~wavelink.Queue`
The auto_queue associated with this player. This queue holds tracks that are recommended by the AutoPlay feature.
"""

channel: VocalGuildChannel
Expand Down Expand Up @@ -369,7 +376,7 @@ async def _search(query: str | None) -> T_a:
track._recommended = True
added += await self.auto_queue.put_wait(track)

random.shuffle(self.auto_queue._queue)
random.shuffle(self.auto_queue._items)
logger.debug(f'Player "{self.guild.id}" added "{added}" tracks to the auto_queue via AutoPlay.')

# Probably don't need this here as it's likely to be cancelled instantly...
Expand Down Expand Up @@ -943,7 +950,7 @@ async def stop(self, *, force: bool = True) -> Playable | None:
.. versionchanged:: 3.0.0
This method is now known as ``skip``, but the alias ``stop`` has been kept for backwards compatability.
This method is now known as ``skip``, but the alias ``stop`` has been kept for backwards compatibility.
"""
return await self.skip(force=force)

Expand Down
Loading

0 comments on commit eeec649

Please sign in to comment.