Skip to content
This repository was archived by the owner on Apr 5, 2025. It is now read-only.

Commit 0f7c768

Browse files
committed
Add bool to avoid breaking change
Add bool to avoid breaking change
1 parent cb90f56 commit 0f7c768

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

wavelink/tracks.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ def __contains__(self, item: Playable) -> bool:
555555
def pop(self, index: int = -1) -> Playable:
556556
return self.tracks.pop(index)
557557

558-
def track_extras(self, **attrs: object) -> None:
558+
def track_extras(self, *, extras: bool = False, **attrs: object) -> None:
559559
"""Method which sets attributes to all :class:`Playable` in this playlist, with the provided keyword arguments.
560560
561561
This is useful when you need to attach state to your :class:`Playable`, E.g. create a requester attribute.
@@ -567,6 +567,8 @@ def track_extras(self, **attrs: object) -> None:
567567
568568
Parameters
569569
----------
570+
extras: bool
571+
True sets data in track.extras and False to track. Default is False.
570572
**attrs
571573
The keyword arguments to set as attribute name=value on each :class:`Playable`.
572574
@@ -581,8 +583,9 @@ def track_extras(self, **attrs: object) -> None:
581583
print(track.requester)
582584
"""
583585
for track in self.tracks:
586+
target = track.extras if extras else track
584587
for name, value in attrs.items():
585-
setattr(track.extras, name, value)
588+
setattr(target, name, value)
586589

587590

588591
class PlaylistInfo:

0 commit comments

Comments
 (0)