PythonistaGuild / Wavelink

A powerful Lavalink library for Discord.py.
https://wavelink.dev
MIT License
389 stars 179 forks source link

Autoplay doesn't triggers the on_wavelink_track_start event. #295

Closed Saur-av closed 5 months ago

Saur-av commented 5 months ago

When a Track starts while the AutoPlay is enabled, the on_wavelink_track_start isn't being triggered when a new track is started by the autoplay.

EvieePy commented 5 months ago

Can you provide more details, like code, wavelink version, Lavalink version and any relevant logs?

The most common cause of this problem is people using the on_wavelink_track_end event in an incompatible way with AutoPlay. If you use AutoPlay we strongly recommend not doing any logic in that event.

You can avoid issues by returning early, for example:

@commands.Cog.listener()
async def on_wavelink_track_end(self, payload: wavelink.TrackEndEventPayload) -> None:
    player = payload.player

    if not player or player.autoplay is not wavelink.AutoPlayMode.disabled:
        return

    # If you get here, you aren't using AutoPlay...
    ...
Saur-av commented 5 months ago

Thanks for the help, I went through my code again and I noticed that I was getting rate limits as per what I wanted to achieve after the on_wavelink_track_end is invoked.