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

Commit db0aa3b

Browse files
authored
Fix & document set_filters & from_filters (#289)
Changed to use the properly typed keys Changes to be committed: modified: wavelink/filters.py
1 parent 66a1c9d commit db0aa3b

File tree

1 file changed

+59
-6
lines changed

1 file changed

+59
-6
lines changed

wavelink/filters.py

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -680,11 +680,38 @@ def _set_with_reset(self, filters: FiltersOptions) -> None:
680680
self._vibrato = filters.get("vibrato", Vibrato({}))
681681
self._rotation = filters.get("rotation", Rotation({}))
682682
self._distortion = filters.get("distortion", Distortion({}))
683-
self._channel_mix = filters.get("channelMix", ChannelMix({}))
684-
self._low_pass = filters.get("lowPass", LowPass({}))
683+
self._channel_mix = filters.get("channel_mix", ChannelMix({}))
684+
self._low_pass = filters.get("low_pass", LowPass({}))
685685

686686
def set_filters(self, **filters: Unpack[FiltersOptions]) -> None:
687-
# TODO: document this later maybe?
687+
"""Set multiple filters at once to a standalone Filter object.
688+
To set the filters to the player directly see :meth:`wavelink.Player.set_filters`
689+
690+
Parameters
691+
----------
692+
volume: float
693+
The Volume filter to apply to the player.
694+
equalizer: :class:`wavelink.Equalizer`
695+
The Equalizer filter to apply to the player.
696+
karaoke: :class:`wavelink.Karaoke`
697+
The Karaoke filter to apply to the player.
698+
timescale: :class:`wavelink.Timescale`
699+
The Timescale filter to apply to the player.
700+
tremolo: :class:`wavelink.Tremolo`
701+
The Tremolo filter to apply to the player.
702+
vibrato: :class:`wavelink.Vibrato`
703+
The Vibrato filter to apply to the player.
704+
rotation: :class:`wavelink.Rotation`
705+
The Rotation filter to apply to the player.
706+
distortion: :class:`wavelink.Distortion`
707+
The Distortion filter to apply to the player.
708+
channel_mix: :class:`wavelink.ChannelMix`
709+
The ChannelMix filter to apply to the player.
710+
low_pass: :class:`wavelink.LowPass`
711+
The LowPass filter to apply to the player.
712+
reset: bool
713+
Whether to reset all filters that were not specified.
714+
"""
688715

689716
reset: bool = filters.get("reset", False)
690717
if reset:
@@ -699,8 +726,8 @@ def set_filters(self, **filters: Unpack[FiltersOptions]) -> None:
699726
self._vibrato = filters.get("vibrato", self._vibrato)
700727
self._rotation = filters.get("rotation", self._rotation)
701728
self._distortion = filters.get("distortion", self._distortion)
702-
self._channel_mix = filters.get("channelMix", self._channel_mix)
703-
self._low_pass = filters.get("lowPass", self._low_pass)
729+
self._channel_mix = filters.get("channel_mix", self._channel_mix)
730+
self._low_pass = filters.get("low_pass", self._low_pass)
704731

705732
def _reset(self) -> None:
706733
self._volume = None
@@ -723,7 +750,33 @@ def reset(self) -> None:
723750

724751
@classmethod
725752
def from_filters(cls, **filters: Unpack[FiltersOptions]) -> Self:
726-
# TODO: document this later maybe?
753+
"""Creates a Filters object with specified filters.
754+
755+
Parameters
756+
----------
757+
volume: float
758+
The Volume filter to apply to the player.
759+
equalizer: :class:`wavelink.Equalizer`
760+
The Equalizer filter to apply to the player.
761+
karaoke: :class:`wavelink.Karaoke`
762+
The Karaoke filter to apply to the player.
763+
timescale: :class:`wavelink.Timescale`
764+
The Timescale filter to apply to the player.
765+
tremolo: :class:`wavelink.Tremolo`
766+
The Tremolo filter to apply to the player.
767+
vibrato: :class:`wavelink.Vibrato`
768+
The Vibrato filter to apply to the player.
769+
rotation: :class:`wavelink.Rotation`
770+
The Rotation filter to apply to the player.
771+
distortion: :class:`wavelink.Distortion`
772+
The Distortion filter to apply to the player.
773+
channel_mix: :class:`wavelink.ChannelMix`
774+
The ChannelMix filter to apply to the player.
775+
low_pass: :class:`wavelink.LowPass`
776+
The LowPass filter to apply to the player.
777+
reset: bool
778+
Whether to reset all filters that were not specified.
779+
"""
727780

728781
self = cls()
729782
self._set_with_reset(filters)

0 commit comments

Comments
 (0)