Skip to content

Commit

Permalink
Merge branch 'main' into feature/enhance-queue
Browse files Browse the repository at this point in the history
  • Loading branch information
Sachaa-Thanasius authored Dec 22, 2023
2 parents 253adc4 + eb98c0a commit d3163ea
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
12 changes: 8 additions & 4 deletions docs/migrating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ Added
Connecting
==========
Connecting in version **3** is similar to version **2**.
It is recommended to use discord.py ``setup_hook`` to connect your nodes.


.. important::

It is recommended to use discord.py ``setup_hook`` to connect your nodes.


.. code:: python3
Expand Down Expand Up @@ -164,10 +168,10 @@ when playing a song from a command it is advised to check whether the Player is
await player.play(track)
You can skip adding any track to your history queue in version **3** by passing ``add_history=False`` to ``.play``.
You can skip adding any track to your history queue in version **3** by passing ``add_history=False`` to :meth:`wavelink.Player.play`.

Wavelink **does not** advise using the ``on_wavelink_track_end`` event in most cases. Use this event only when you plan to
not use ``AutoPlay`` at all. Since version **3** implements ``AutPlayMode.partial``, a setting which skips fetching and recommending tracks,
Wavelink **does not** advise using the :func:`wavelink.on_wavelink_track_end` event in most cases. Use this event only when you plan to
not use ``AutoPlay`` at all. Since version **3** implements :attr:`wavelink.AutoPlayMode.partial`, a setting which skips fetching and recommending tracks,
using this event is no longer recommended in most use cases.

To send track updates or do player updates, consider using :func:`wavelink.on_wavelink_track_start` instead.
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "wavelink"
version = "3.1.0"
version = "3.2.0"
authors = [
{ name="PythonistaGuild, EvieePy", email="evieepy@gmail.com" },
]
Expand Down
2 changes: 1 addition & 1 deletion wavelink/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
__author__ = "PythonistaGuild, EvieePy"
__license__ = "MIT"
__copyright__ = "Copyright 2019-Present (c) PythonistaGuild, EvieePy"
__version__ = "3.1.0"
__version__ = "3.2.0"


from .enums import *
Expand Down
25 changes: 25 additions & 0 deletions wavelink/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ def __init__(self, data: TrackPayload, *, playlist: PlaylistInfo | None = None)

self._extras: ExtrasNamespace = ExtrasNamespace(data.get("userData", {}))

self._raw_data = data

def __hash__(self) -> int:
return hash(self.encoded)

Expand Down Expand Up @@ -294,6 +296,29 @@ def extras(self, __value: ExtrasNamespace | dict[str, Any]) -> None:
else:
self._extras = ExtrasNamespace(__value)

@property
def raw_data(self) -> TrackPayload:
"""The raw data for this ``Playable`` received via ``Lavalink``.
You can use this data to reconstruct this ``Playable`` object.
Examples
--------
.. code:: python3
# For example purposes...
old_data = track.raw_data
# Later...
track: wavelink.Playable = wavelink.Playable(old_data)
.. versionadded:: 3.2.0
"""
return self._raw_data

@classmethod
async def search(cls, query: str, /, *, source: TrackSource | str | None = TrackSource.YouTubeMusic) -> Search:
"""Search for a list of :class:`~wavelink.Playable` or a :class:`~wavelink.Playlist`, with the given query.
Expand Down

0 comments on commit d3163ea

Please sign in to comment.