diff --git a/wavelink/tracks.py b/wavelink/tracks.py index 8638fa2d..8751dcf2 100644 --- a/wavelink/tracks.py +++ b/wavelink/tracks.py @@ -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) @@ -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.