Yucked / Victoria

🌋 - Lavalink wrapper for Discord.NET. Provides more options and performs better than all .NET Lavalink libraries combined.
https://github.com/Yucked/Victoria/wiki
193 stars 48 forks source link

[Bug]: SkipAsync does not work for child classes of LavaTrack #134

Closed DrDevinRX closed 1 year ago

DrDevinRX commented 2 years ago

Describe your issue in as much detail as possible

If you use a child class of LavaTrack and put it in the queue, SkipAsync will throw an InvalidCastException. This is done here: https://github.com/Yucked/Victoria/blob/v5/src/LavaPlayer.cs#L221.

For example, my child class:

    public class MuseTrack : LavaTrack
    {
        public IGuildUser Requester { get; }
        public MuseTrack(LavaTrack lavaTrack, IGuildUser requester) : base(lavaTrack)
        {
            Requester = requester;
        }
    }

This has worked in older version of v5, but after updating to the latest, I can't skip tracks and it throws the exception. My suggestion would be to use pattern matching instead of using GetType. if (lavaTrack is not LavaTrack)

Version

v5 (Latest)

Version

GitHub's latest

Relevant log output

No response

Yucked commented 1 year ago

Pushed it recent update