diff --git a/src/Lavalink4NET/Lavalink4NET.xml b/src/Lavalink4NET/Lavalink4NET.xml
index e05c6d8a..4ae9030f 100644
--- a/src/Lavalink4NET/Lavalink4NET.xml
+++ b/src/Lavalink4NET/Lavalink4NET.xml
@@ -242,11 +242,6 @@
Gets the cluster node id.
-
-
- Gets the cluster node label.
-
-
Gets the coordinated universal time (UTC) point of the last usage of the node.
@@ -4395,16 +4390,16 @@
A set of default out-of-box inactivity trackers.
-
+
An inactivity tracker ( ) which marks a player as
- "inactive" when there are no users in the channel except the bot itself.
+ "inactive" when the player is not playing a track.
-
+
An inactivity tracker ( ) which marks a player as
- "inactive" when the player is not playing a track.
+ "inactive" when there are no users in the channel except the bot itself.
diff --git a/src/Lavalink4NET/Player/LavalinkPlayer.cs b/src/Lavalink4NET/Player/LavalinkPlayer.cs
index 30b61dfd..2030161a 100644
--- a/src/Lavalink4NET/Player/LavalinkPlayer.cs
+++ b/src/Lavalink4NET/Player/LavalinkPlayer.cs
@@ -125,7 +125,9 @@ public virtual async Task ConnectAsync(ulong voiceChannelId, bool selfDeaf = fal
{
await Client.SendVoiceUpdateAsync(GuildId, voiceChannelId, selfDeaf, selfMute);
VoiceChannelId = voiceChannelId;
+
State = PlayerState.NotPlaying;
+ CurrentTrack = null;
}
///
@@ -199,6 +201,7 @@ public virtual Task OnTrackEndAsync(TrackEndEventArgs eventArgs)
{
// The track ended, set to not playing
State = PlayerState.NotPlaying;
+ CurrentTrack = null;
}
return Task.CompletedTask;
@@ -421,6 +424,9 @@ public virtual async Task StopAsync(bool disconnect = false)
{
await DisconnectAsync(PlayerDisconnectCause.Stop);
}
+
+ State = PlayerState.NotPlaying;
+ CurrentTrack = null;
}
///
@@ -563,6 +569,7 @@ await LavalinkSocket.SendPayloadAsync(new VoiceUpdatePayload(_voiceState.GuildId
// set initial player state to connected, if player was not connected or destroyed,
// see: https://github.com/angelobreuer/Lavalink4NET/issues/28
State = PlayerState.NotPlaying;
+ CurrentTrack = null;
}
// trigger event
diff --git a/src/Lavalink4NET/Player/QueuedLavalinkPlayer.cs b/src/Lavalink4NET/Player/QueuedLavalinkPlayer.cs
index 95043a82..f38857a9 100644
--- a/src/Lavalink4NET/Player/QueuedLavalinkPlayer.cs
+++ b/src/Lavalink4NET/Player/QueuedLavalinkPlayer.cs
@@ -256,10 +256,10 @@ public virtual Task SkipAsync(int count = 1)
// a track to play was found, dequeue and play
return PlayAsync(track!, false);
}
- // no tracks queued, disconnect if wanted
- else if (_disconnectOnStop)
+ // no tracks queued, stop player and disconnect if specified
+ else
{
- return DisconnectAsync();
+ StopAsync(disconnect: _disconnectOnStop);
}
return Task.CompletedTask;
diff --git a/src/Lavalink4NET/Tracking/DefaultInactivityTrackers.cs b/src/Lavalink4NET/Tracking/DefaultInactivityTrackers.cs
index 39219cae..451cf9c0 100644
--- a/src/Lavalink4NET/Tracking/DefaultInactivityTrackers.cs
+++ b/src/Lavalink4NET/Tracking/DefaultInactivityTrackers.cs
@@ -29,12 +29,20 @@ namespace Lavalink4NET.Tracking
{
using System.Linq;
using System.Threading.Tasks;
+ using Lavalink4NET.Player;
///
/// A set of default out-of-box inactivity trackers.
///
public static class DefaultInactivityTrackers
{
+ ///
+ /// An inactivity tracker ( ) which marks a player as
+ /// "inactive" when the player is not playing a track.
+ ///
+ public static InactivityTracker ChannelInactivityTracker { get; } = (player, _)
+ => Task.FromResult(player.State is PlayerState.NotPlaying);
+
///
/// An inactivity tracker ( ) which marks a player as
/// "inactive" when there are no users in the channel except the bot itself.
@@ -55,12 +63,5 @@ public static class DefaultInactivityTrackers
// check if there are no users in the channel (bot excluded)
return userCount == 0;
};
-
- ///
- /// An inactivity tracker ( ) which marks a player as
- /// "inactive" when the player is not playing a track.
- ///
- public static InactivityTracker ChannelInactivityTracker { get; } = (player, _)
- => Task.FromResult(player.State == Player.PlayerState.NotPlaying);
}
}