diff --git a/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj b/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj index c00e168d..b717af8a 100644 --- a/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj +++ b/samples/Lavalink4NET.Samples.NetCord/Lavalink4NET.Samples.NetCord.csproj @@ -10,10 +10,10 @@ - - - - + + + + diff --git a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs index fe6a0d80..4664808f 100644 --- a/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs +++ b/src/Lavalink4NET.NetCord/GatewayClientWrapper.cs @@ -11,6 +11,8 @@ internal sealed class GatewayClientWrapper : GatewayClientWrapperBase, IDiscordC { private readonly GatewayClient _client; + private readonly TaskCompletionSource _ready = new(); + public GatewayClientWrapper(GatewayClient client) { ArgumentNullException.ThrowIfNull(client); @@ -19,6 +21,13 @@ public GatewayClientWrapper(GatewayClient client) _client.VoiceStateUpdate += HandleVoiceStateUpdateAsync; _client.VoiceServerUpdate += HandleVoiceServerUpdateAsync; + _client.Ready += HandleReady; + } + + private ValueTask HandleReady(ReadyEventArgs arg) + { + _ready.TrySetResult(true); + return default; } public void Dispose() @@ -31,7 +40,7 @@ public override async ValueTask WaitForReadyAsync(Cancellatio { cancellationToken.ThrowIfCancellationRequested(); - await _client.ReadyAsync + await _ready.Task .WaitAsync(cancellationToken) .ConfigureAwait(false); diff --git a/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj b/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj index c8f9ed25..46897b07 100644 --- a/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj +++ b/src/Lavalink4NET.NetCord/Lavalink4NET.NetCord.csproj @@ -11,8 +11,8 @@ - - + +