Skip to content

Commit

Permalink
Playlist.extras now sets track.extras
Browse files Browse the repository at this point in the history
  • Loading branch information
EvieePy committed Feb 17, 2024
1 parent af792e2 commit bf60463
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions wavelink/tracks.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def extras(self) -> ExtrasNamespace:
or a :class:`~wavelink.ExtrasNamespace`.
If a dict is passed, it will be converted into an :class:`~wavelink.ExtrasNamespace`,
which can be converted back to a dict with dict(...). Additionally, you can also use list or tuple on
which can be converted back to a dict with ``dict(...)``. Additionally, you can also use list or tuple on
:class:`~wavelink.ExtrasNamespace`.
The extras dict will be sent to Lavalink as the ``userData`` field for each track in the playlist.
Expand All @@ -612,9 +612,9 @@ def extras(self) -> ExtrasNamespace:
playlist.extras = {"requester_id": 1234567890}
# later...
print(playlist.extras.requester_id)
print(track.extras.requester_id)
# or
print(dict(playlist.extras)["requester_id"])
print(dict(track.extras)["requester_id"])
.. versionadded:: 3.2.0
Expand All @@ -629,8 +629,7 @@ def extras(self, __value: ExtrasNamespace | dict[str, Any]) -> None:
self._extras = ExtrasNamespace(__value)

for track in self.tracks:
for name, value in dict(self._extras).items():
setattr(track, name, value)
track.extras = __value


class PlaylistInfo:
Expand Down

0 comments on commit bf60463

Please sign in to comment.