diff --git a/src/Lavalink4NET/Extensions/QueuedLavalinkPlayerExtensions.cs b/src/Lavalink4NET/Extensions/QueuedLavalinkPlayerExtensions.cs index e8a99baf..81b0ef41 100644 --- a/src/Lavalink4NET/Extensions/QueuedLavalinkPlayerExtensions.cs +++ b/src/Lavalink4NET/Extensions/QueuedLavalinkPlayerExtensions.cs @@ -8,16 +8,25 @@ public static class QueuedLavalinkPlayerExtensions { + /// + /// Adds a to the player's queue.
+ /// Returns the index of the track in the queue (or the last track added to the queue if is a playlist) + ///
+ /// The player to enqueue the load result to. + /// The load result you want to enqueue. + /// The cancellation token. + /// The index of the track in the queue (or the last track added to the queue if is a playlist) + /// When the contains no tracks. public static async ValueTask PlayAsync(this IQueuedLavalinkPlayer player, TrackLoadResult loadResult, CancellationToken cancellationToken = default) { cancellationToken.ThrowIfCancellationRequested(); - var queueOffset = default(int?); + int? queueOffset = default; if (loadResult.Playlist is null) { // Single track - queueOffset ??= await player + queueOffset = await player .PlayAsync(loadResult.Track!, cancellationToken: cancellationToken) .ConfigureAwait(false); } @@ -26,7 +35,7 @@ public static async ValueTask PlayAsync(this IQueuedLavalinkPlayer player, // Playlist foreach (var track in loadResult.Tracks) { - queueOffset ??= await player + queueOffset = await player .PlayAsync(track, cancellationToken: cancellationToken) .ConfigureAwait(false); }