DraxCodes/Party-Bot

When playing song in queue it displays wrong song

dakata1337 opened this issue · 2 comments

When you add 2 or more songs in queue and the first one in the queue starts plating the bot is saying:
Now Playing and the name of the song which ended
The code is located in LavaLinkAudio.cs
public async Task TrackEnded(TrackEndedEventArgs args)
{
if (!args.Reason.ShouldPlayNext())
{
return;
}
if (!args.Player.Queue.TryDequeue(out var queueable))
{
//await args.Player.TextChannel.SendMessageAsync("Playback Finished.");
return;
}
if (!(queueable is LavaTrack track))
{
await args.Player.TextChannel.SendMessageAsync("Next item in queue is not a track.");
return;
}

        await args.Player.PlayAsync(track);
        await args.Player.TextChannel.SendMessageAsync(
            embed: await EmbedHandler.CreateBasicEmbed("Now Playing", $"[{args.Track.Title}]({args.Track.Url})", Color.Blue));
    }

I found how to fix it
Change this:

await args.Player.TextChannel.SendMessageAsync(
            embed: await EmbedHandler.CreateBasicEmbed("Now Playing", $"[{args.Track.Title}]({args.Track.Url})", Color.Blue));

To this

await args.Player.TextChannel.SendMessageAsync(
                embed: await EmbedHandler.CreateBasicEmbed("Now playing", $"[{track.Title}]({track.Url})", Color.Blue));

This has been fixed in the latest version. It was an issue caused with updating the Victoria Nuget package to the latest version which wasn't (at the time) supported.